Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

render_test.gno

0.68 Kb · 51 lines
 1package sapin
 2
 3import (
 4	"testing"
 5)
 6
 7func TestRender(t *testing.T) {
 8	tt := []struct {
 9		path string
10		want string
11	}{
12		{"1", "```" + `
13   *
14  ***
15 *****
16*******
17  |||
18` + "```\n"},
19		{"", "```" + `
20         *
21        ***
22       *****
23      *******
24       *****
25      *******
26     *********
27    ***********
28   *************
29     *********
30    ***********
31   *************
32  ***************
33 *****************
34*******************
35        |||
36        |||
37        |||
38` + "```\n"},
39	}
40
41	for _, tc := range tt {
42		name := tc.path
43		t.Run(name, func(t *testing.T) {
44			got := Render(tc.path)
45			want := tc.want
46			if got != want {
47				t.Errorf("expected \n%s\n, got \n%s\n.", want, got)
48			}
49		})
50	}
51}