Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit deec7ef

Browse files
Fixing tests
1 parent 8e2ddf5 commit deec7ef

3 files changed

Lines changed: 19 additions & 13 deletions

File tree

claat/parser/gdoc/parse_test.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func TestParseTopCodeBlock(t *testing.T) {
110110
code := "start func() {\n}\n\nfunc2() {\n} // comment"
111111
term := "adb shell am start -a VIEW \\\n-d \"http://host\" app"
112112
content := types.NewListNode()
113-
var lang string;
113+
var lang string
114114
content.Append(types.NewCodeNode(code, false, lang))
115115
content.Append(types.NewCodeNode(term, true, lang))
116116

@@ -127,9 +127,9 @@ func TestParseTopCodeBlock(t *testing.T) {
127127
cur: doc.FirstChild,
128128
}
129129
parseTop(ds)
130-
131-
html1, _ := render.HTML("", ds.step.Content)
132-
html2, _ := render.HTML("", content)
130+
var ctx render.Context
131+
html1, _ := render.HTML(ctx, ds.step.Content)
132+
html2, _ := render.HTML(ctx, content)
133133
s1 := strings.TrimSpace(string(html1))
134134
s2 := strings.TrimSpace(string(html2))
135135
if s1 != s2 {
@@ -492,7 +492,7 @@ func TestParseDoc(t *testing.T) {
492492
"http://host/file.java", types.NewTextNode("a file")))
493493
content.Append(h)
494494

495-
var lang string;
495+
var lang string
496496
code := "start func() {\n}\n\nfunc2() {\n} // comment"
497497
cn := types.NewCodeNode(code, false, lang)
498498
cn.MutateBlock(1)
@@ -523,8 +523,9 @@ func TestParseDoc(t *testing.T) {
523523
})
524524
content.Append(sv)
525525

526-
html1, _ := render.HTML("", step.Content)
527-
html2, _ := render.HTML("", content)
526+
var ctx render.Context
527+
html1, _ := render.HTML(ctx, step.Content)
528+
html2, _ := render.HTML(ctx, content)
528529
if html1 != html2 {
529530
t.Errorf("step.Content:\n\n%s\nwant:\n\n%s", html1, html2)
530531
}
@@ -577,8 +578,9 @@ func TestParseFragment(t *testing.T) {
577578
para.MutateBlock(true)
578579
want = append(want, para)
579580

580-
html1, _ := render.HTML("", nodes...)
581-
html2, _ := render.HTML("", want...)
581+
var ctx render.Context
582+
html1, _ := render.HTML(ctx, nodes...)
583+
html2, _ := render.HTML(ctx, want...)
582584
if html1 != html2 {
583585
t.Errorf("nodes:\n\n%s\nwant:\n\n%s", html1, html2)
584586
}

claat/render/html_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ func TestHTMLEnv(t *testing.T) {
3939
{"four", ""},
4040
}
4141
for i, test := range tests {
42-
h, err := HTML(test.env, one, two, three)
42+
var ctx Context
43+
ctx.Env = test.env
44+
h, err := HTML(ctx, one, two, three)
4345
if err != nil {
4446
t.Errorf("%d: %v", i, err)
4547
continue

claat/render/template_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ func TestExecuteBuiltin(t *testing.T) {
2626
Title: "Test step",
2727
Content: types.NewListNode(types.NewTextNode("text")),
2828
}
29-
ctx := &Context{
29+
data := &struct {
30+
Context
31+
}{Context: Context{
3032
Meta: &types.Meta{},
3133
Steps: []*types.Step{step},
32-
}
34+
}}
3335
for _, f := range []string{"html", "md"} {
3436
var buf bytes.Buffer
35-
if err := Execute(&buf, f, ctx); err != nil {
37+
if err := Execute(&buf, f, data); err != nil {
3638
t.Errorf("%s: %v", f, err)
3739
}
3840
}

0 commit comments

Comments
 (0)