-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfocused_execution_test.go
72 lines (51 loc) · 1.07 KB
/
focused_execution_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package convey
import "testing"
func TestFocusOnlyAtTopLevel(t *testing.T) {
output := prepare()
FocusConvey("hi", t, func() {
output += "done"
})
expectEqual(t, "done", output)
}
func TestFocus(t *testing.T) {
output := prepare()
FocusConvey("hi", t, func() {
output += "1"
Convey("bye", func() {
output += "2"
})
})
expectEqual(t, "1", output)
}
func TestNestedFocus(t *testing.T) {
output := prepare()
FocusConvey("hi", t, func() {
output += "1"
Convey("This shouldn't run", func() {
output += "boink!"
})
FocusConvey("This should run", func() {
output += "2"
FocusConvey("The should run too", func() {
output += "3"
})
Convey("The should NOT run", func() {
output += "blah blah blah!"
})
})
})
expectEqual(t, "123", output)
}
func TestForgotTopLevelFocus(t *testing.T) {
output := prepare()
Convey("1", t, func() {
output += "1"
FocusConvey("This will be run because the top-level lacks Focus", func() {
output += "2"
})
Convey("3", func() {
output += "3"
})
})
expectEqual(t, "1213", output)
}