4
4
package renderhelper
5
5
6
6
import (
7
- "context"
8
7
"testing"
9
8
10
9
repo_model "code.gitea.io/gitea/models/repo"
@@ -22,7 +21,7 @@ func TestRepoFile(t *testing.T) {
22
21
repo1 := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 })
23
22
24
23
t .Run ("AutoLink" , func (t * testing.T ) {
25
- rctx := NewRenderContextRepoFile (context . Background (), repo1 ).WithMarkupType (markdown .MarkupName )
24
+ rctx := NewRenderContextRepoFile (t . Context (), repo1 ).WithMarkupType (markdown .MarkupName )
26
25
rendered , err := markup .RenderString (rctx , `
27
26
65f1bf27bc3bf70f64657658635e66094edbcb4d
28
27
#1
@@ -37,7 +36,7 @@ func TestRepoFile(t *testing.T) {
37
36
})
38
37
39
38
t .Run ("AbsoluteAndRelative" , func (t * testing.T ) {
40
- rctx := NewRenderContextRepoFile (context . Background (), repo1 , RepoFileOptions {CurrentRefPath : "branch/main" }).
39
+ rctx := NewRenderContextRepoFile (t . Context (), repo1 , RepoFileOptions {CurrentRefPath : "branch/main" }).
41
40
WithMarkupType (markdown .MarkupName )
42
41
rendered , err := markup .RenderString (rctx , `
43
42
[/test](/test)
@@ -55,7 +54,7 @@ func TestRepoFile(t *testing.T) {
55
54
})
56
55
57
56
t .Run ("WithCurrentRefPath" , func (t * testing.T ) {
58
- rctx := NewRenderContextRepoFile (context . Background (), repo1 , RepoFileOptions {CurrentRefPath : "/commit/1234" }).
57
+ rctx := NewRenderContextRepoFile (t . Context (), repo1 , RepoFileOptions {CurrentRefPath : "/commit/1234" }).
59
58
WithMarkupType (markdown .MarkupName )
60
59
rendered , err := markup .RenderString (rctx , `
61
60
[/test](/test)
@@ -68,7 +67,7 @@ func TestRepoFile(t *testing.T) {
68
67
})
69
68
70
69
t .Run ("WithCurrentRefPathByTag" , func (t * testing.T ) {
71
- rctx := NewRenderContextRepoFile (context . Background (), repo1 , RepoFileOptions {
70
+ rctx := NewRenderContextRepoFile (t . Context (), repo1 , RepoFileOptions {
72
71
CurrentRefPath : "/commit/1234" ,
73
72
CurrentTreePath : "my-dir" ,
74
73
}).
@@ -89,7 +88,7 @@ func TestRepoFileOrgMode(t *testing.T) {
89
88
repo1 := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 })
90
89
91
90
t .Run ("Links" , func (t * testing.T ) {
92
- rctx := NewRenderContextRepoFile (context . Background (), repo1 , RepoFileOptions {
91
+ rctx := NewRenderContextRepoFile (t . Context (), repo1 , RepoFileOptions {
93
92
CurrentRefPath : "/commit/1234" ,
94
93
CurrentTreePath : "my-dir" ,
95
94
}).WithRelativePath ("my-dir/a.org" )
@@ -106,7 +105,7 @@ func TestRepoFileOrgMode(t *testing.T) {
106
105
})
107
106
108
107
t .Run ("CodeHighlight" , func (t * testing.T ) {
109
- rctx := NewRenderContextRepoFile (context . Background (), repo1 , RepoFileOptions {}).WithRelativePath ("my-dir/a.org" )
108
+ rctx := NewRenderContextRepoFile (t . Context (), repo1 , RepoFileOptions {}).WithRelativePath ("my-dir/a.org" )
110
109
111
110
rendered , err := markup .RenderString (rctx , `
112
111
#+begin_src c
0 commit comments