counter_test.gno
0.39 Kb ยท 22 lines
1package counter
2
3import "testing"
4
5func TestIncrement(t *testing.T) {
6 counter = 0
7 val := Increment()
8 if val != 1 {
9 t.Fatalf("result from Increment(): %d != 1", val)
10 }
11 if counter != val {
12 t.Fatalf("counter (%d) != val (%d)", counter, val)
13 }
14}
15
16func TestRender(t *testing.T) {
17 counter = 1337
18 res := Render("")
19 if res != "1337" {
20 t.Fatalf("render result %q != %q", res, "1337")
21 }
22}