forked from tychofreeman/go-gherkin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscenario_test.go
56 lines (45 loc) · 1.53 KB
/
scenario_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
package gherkin
import (
"testing"
. "github.com/tychofreeman/go-matchers"
"regexp"
)
func TestReportsNumberOfPendingSteps(t *testing.T) {
scen := &scenario{}
scen.AddStep(step{line:".", isPending:true})
regex, _ := regexp.Compile(".")
sd := stepdef{r:regex, f:func(w *World){ }}
rpt := scen.Execute([]stepdef{sd}, nil)
AssertThat(t, rpt.pendingSteps, Equals(1))
}
func TestReportsNumberOfSkippedSteps(t *testing.T) {
scen := &scenario{}
scen.AddStep(step{line:".", isPending:true})
scen.AddStep(step{line:".", isPending:true})
regex, _ := regexp.Compile(".")
sd := stepdef{r:regex, f:func(w *World){ }}
rpt := scen.Execute([]stepdef{sd}, nil)
AssertThat(t, rpt.skippedSteps, Equals(1))
}
func TestReportsNumberOfPassedSteps(t *testing.T) {
scen := &scenario{}
scen.AddStep(step{line:"."})
regex, _ := regexp.Compile(".")
sd := stepdef{r:regex, f:func(w *World){ }}
rpt := scen.Execute([]stepdef{sd}, nil)
AssertThat(t, rpt.passedSteps, Equals(1))
}
func TestReportsNumberOfFailedSteps(t *testing.T) {
scen := &scenario{}
scen.AddStep(step{line:"."})
regex, _ := regexp.Compile(".")
sd := stepdef{r:regex, f:func(w *World){ AssertThat(w, true, IsFalse) }}
rpt := scen.Execute([]stepdef{sd}, nil)
AssertThat(t, rpt.failedSteps, Equals(1))
}
func TestReportsNumberOfUndefinedSteps(t *testing.T) {
scen := &scenario{}
scen.AddStep(step{line:"."})
rpt := scen.Execute([]stepdef{}, nil)
AssertThat(t, rpt.undefinedSteps, Equals(1))
}