@@ -10,6 +10,11 @@ import (
10
10
zmq "github.com/pebbe/zmq4"
11
11
)
12
12
13
+ const (
14
+ failure = "\u2717 "
15
+ success = "\u2713 "
16
+ )
17
+
13
18
func TestMain (m * testing.M ) {
14
19
os .Exit (runTest (m ))
15
20
}
@@ -34,19 +39,26 @@ func TestEvaluate(t *testing.T) {
34
39
}{
35
40
{"import \" fmt\" \n a := 1\n fmt.Println(a)" , "1\n " },
36
41
{"a = 2\n fmt.Println(a)" , "2\n " },
37
- {"func myFunc(x int) int {\n return x+1\n }\n fmt.Println(\" func defined\" )" , "func defined \n " },
42
+ {"func myFunc(x int) int {\n return x+1\n }\n fmt.Println(\" func defined\" )" , "func dfined \n " },
38
43
{"b := myFunc(1)\n fmt.Println(b)" , "2\n " },
39
44
}
40
45
46
+ t .Logf ("Should be able to evaluate valid code in notebook cells." )
47
+
41
48
for k , tc := range cases {
42
49
50
+ // Give a progress report.
51
+ t .Logf (" Evaluating code snippet %d/%d." , k + 1 , len (cases ))
52
+
43
53
// Get the result.
44
54
result := testEvaluate (t , tc .Input , k )
45
55
46
56
// Compare the result.
47
57
if result != tc .Output {
48
- t .Fatalf ("[test case %d]: result -> %s\n expected -> %s" , k + 1 , result , tc .Output )
58
+ t .Errorf ("\t %s Test case produced unexpected results." , failure )
59
+ continue
49
60
}
61
+ t .Logf ("\t %s Should return the correct cell output." , success )
50
62
}
51
63
}
52
64
0 commit comments