ensure source formatting with golint, go vet and go fmt
Этот коммит содержится в:
родитель
2e509414d1
коммит
d5755df70c
13 изменённых файлов: 96 добавлений и 83 удалений
14
.travis.yml
14
.travis.yml
|
@ -6,13 +6,23 @@ go:
|
||||||
- tip
|
- tip
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# pull all dependencies manually to see how many we have
|
# linters and vet
|
||||||
|
- go get golang.org/x/tools/cmd/vet
|
||||||
|
- go get github.com/golang/lint/golint
|
||||||
|
|
||||||
|
# pull all external dependencies
|
||||||
# remove them at all if possible
|
# remove them at all if possible
|
||||||
- go get golang.org/x/tools/imports
|
- go get golang.org/x/tools/imports
|
||||||
|
- go get github.com/shiena/ansicolor
|
||||||
|
|
||||||
# run standard go tests
|
# run standard go tests
|
||||||
- go test -v ./...
|
- go test -v ./...
|
||||||
- go test -race ./...
|
- go test -race ./...
|
||||||
|
|
||||||
# test me with myself
|
# test me with myself
|
||||||
- go run cmd/godog/main.go
|
- go run cmd/godog/main.go -f progress
|
||||||
|
|
||||||
|
# code correctness
|
||||||
|
- sh -c 'if [ ! -z "$(go fmt ./...)" ]; then exit 1; fi'
|
||||||
|
- golint ./...
|
||||||
|
- go vet ./...
|
||||||
|
|
|
@ -18,7 +18,7 @@ func init() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var outlinePlaceholderRegexp *regexp.Regexp = regexp.MustCompile("<[^>]+>")
|
var outlinePlaceholderRegexp = regexp.MustCompile("<[^>]+>")
|
||||||
|
|
||||||
// a built in default pretty formatter
|
// a built in default pretty formatter
|
||||||
type pretty struct {
|
type pretty struct {
|
||||||
|
@ -306,7 +306,7 @@ func (f *pretty) printStepKind(stepAction interface{}) {
|
||||||
case step.Background != nil && f.backgroundSteps == 0:
|
case step.Background != nil && f.backgroundSteps == 0:
|
||||||
return
|
return
|
||||||
case step.Background != nil && f.backgroundSteps > 0:
|
case step.Background != nil && f.backgroundSteps > 0:
|
||||||
f.backgroundSteps -= 1
|
f.backgroundSteps--
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.outlineExamples != 0 {
|
if f.outlineExamples != 0 {
|
||||||
|
@ -314,7 +314,7 @@ func (f *pretty) printStepKind(stepAction interface{}) {
|
||||||
if len(f.outlineSteps) == f.outlineNumSteps {
|
if len(f.outlineSteps) == f.outlineNumSteps {
|
||||||
// an outline example steps has went through
|
// an outline example steps has went through
|
||||||
f.printOutlineExample(step.Scenario)
|
f.printOutlineExample(step.Scenario)
|
||||||
f.outlineExamples -= 1
|
f.outlineExamples--
|
||||||
}
|
}
|
||||||
return // wait till example steps
|
return // wait till example steps
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ func (f *progress) step(step interface{}) {
|
||||||
case *undefined:
|
case *undefined:
|
||||||
fmt.Print(cl("U", yellow))
|
fmt.Print(cl("U", yellow))
|
||||||
}
|
}
|
||||||
f.steps += 1
|
f.steps++
|
||||||
if math.Mod(float64(f.steps), float64(f.stepsPerRow)) == 0 {
|
if math.Mod(float64(f.steps), float64(f.stepsPerRow)) == 0 {
|
||||||
fmt.Printf(" %d\n", f.steps)
|
fmt.Printf(" %d\n", f.steps)
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,8 +117,8 @@ func Test_parse_feature_with_newlines(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
p.assertMatchesTypes([]TokenType{
|
p.assertMatchesTypes([]TokenType{
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
FEATURE,
|
FEATURE,
|
||||||
}, t)
|
}, t)
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ func (p *parser) peek() *Token {
|
||||||
return p.peeked
|
return p.peeked
|
||||||
}
|
}
|
||||||
|
|
||||||
for p.peeked = p.lx.read(); p.peeked.OfType(COMMENT, NEW_LINE); p.peeked = p.lx.read() {
|
for p.peeked = p.lx.read(); p.peeked.OfType(COMMENT, NEWLINE); p.peeked = p.lx.read() {
|
||||||
p.ast = append(p.ast, p.peeked) // record comments and newlines
|
p.ast = append(p.ast, p.peeked) // record comments and newlines
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ func (p *parser) parseFeature() (ft *Feature, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// there must be a scenario or scenario outline otherwise
|
// there must be a scenario or scenario outline otherwise
|
||||||
if !tok.OfType(SCENARIO, SCENARIO_OUTLINE) {
|
if !tok.OfType(SCENARIO, OUTLINE) {
|
||||||
if tok.Type == EOF {
|
if tok.Type == EOF {
|
||||||
return ft, nil // there may not be a scenario defined after background
|
return ft, nil // there may not be a scenario defined after background
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ func (p *parser) parseScenario() (s *Scenario, err error) {
|
||||||
if examples := p.peek(); examples.Type == EXAMPLES {
|
if examples := p.peek(); examples.Type == EXAMPLES {
|
||||||
p.next() // jump over the peeked token
|
p.next() // jump over the peeked token
|
||||||
peek := p.peek()
|
peek := p.peek()
|
||||||
if peek.Type != TABLE_ROW {
|
if peek.Type != TABLEROW {
|
||||||
return s, p.err(strings.Join([]string{
|
return s, p.err(strings.Join([]string{
|
||||||
"expected a table row,",
|
"expected a table row,",
|
||||||
"but got '" + peek.Type.String() + "' instead, for scenario outline examples",
|
"but got '" + peek.Type.String() + "' instead, for scenario outline examples",
|
||||||
|
@ -359,7 +359,7 @@ func (p *parser) parseSteps() (steps []*Step, err error) {
|
||||||
return steps, err
|
return steps, err
|
||||||
}
|
}
|
||||||
step.PyString.Step = step
|
step.PyString.Step = step
|
||||||
case TABLE_ROW:
|
case TABLEROW:
|
||||||
if step.Table, err = p.parseTable(); err != nil {
|
if step.Table, err = p.parseTable(); err != nil {
|
||||||
return steps, err
|
return steps, err
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ func (p *parser) parsePystring() (*PyString, error) {
|
||||||
|
|
||||||
func (p *parser) parseTable() (*Table, error) {
|
func (p *parser) parseTable() (*Table, error) {
|
||||||
tbl := &Table{Token: p.peek()}
|
tbl := &Table{Token: p.peek()}
|
||||||
for row := p.peek(); row.Type == TABLE_ROW; row = p.peek() {
|
for row := p.peek(); row.Type == TABLEROW; row = p.peek() {
|
||||||
var cols []string
|
var cols []string
|
||||||
for _, r := range strings.Split(strings.Trim(row.Value, "|"), "|") {
|
for _, r := range strings.Split(strings.Trim(row.Value, "|"), "|") {
|
||||||
cols = append(cols, strings.TrimFunc(r, unicode.IsSpace))
|
cols = append(cols, strings.TrimFunc(r, unicode.IsSpace))
|
||||||
|
|
|
@ -24,25 +24,25 @@ var matchers = map[string]*regexp.Regexp{
|
||||||
// for now only english language is supported
|
// for now only english language is supported
|
||||||
var keywords = map[TokenType]string{
|
var keywords = map[TokenType]string{
|
||||||
// special
|
// special
|
||||||
ILLEGAL: "Illegal",
|
ILLEGAL: "Illegal",
|
||||||
EOF: "End of file",
|
EOF: "End of file",
|
||||||
NEW_LINE: "New line",
|
NEWLINE: "New line",
|
||||||
TAGS: "Tags",
|
TAGS: "Tags",
|
||||||
COMMENT: "Comment",
|
COMMENT: "Comment",
|
||||||
PYSTRING: "PyString",
|
PYSTRING: "PyString",
|
||||||
TABLE_ROW: "Table row",
|
TABLEROW: "Table row",
|
||||||
TEXT: "Text",
|
TEXT: "Text",
|
||||||
// general
|
// general
|
||||||
GIVEN: "Given",
|
GIVEN: "Given",
|
||||||
WHEN: "When",
|
WHEN: "When",
|
||||||
THEN: "Then",
|
THEN: "Then",
|
||||||
AND: "And",
|
AND: "And",
|
||||||
BUT: "But",
|
BUT: "But",
|
||||||
FEATURE: "Feature",
|
FEATURE: "Feature",
|
||||||
BACKGROUND: "Background",
|
BACKGROUND: "Background",
|
||||||
SCENARIO: "Scenario",
|
SCENARIO: "Scenario",
|
||||||
SCENARIO_OUTLINE: "Scenario Outline",
|
OUTLINE: "Scenario Outline",
|
||||||
EXAMPLES: "Examples",
|
EXAMPLES: "Examples",
|
||||||
}
|
}
|
||||||
|
|
||||||
type lexer struct {
|
type lexer struct {
|
||||||
|
@ -70,9 +70,9 @@ func (l *lexer) read() *Token {
|
||||||
// newline
|
// newline
|
||||||
if len(line) == 0 {
|
if len(line) == 0 {
|
||||||
return &Token{
|
return &Token{
|
||||||
Type: NEW_LINE,
|
Type: NEWLINE,
|
||||||
Line: l.lines,
|
Line: l.lines,
|
||||||
Keyword: keywords[NEW_LINE],
|
Keyword: keywords[NEWLINE],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// comment
|
// comment
|
||||||
|
@ -172,25 +172,25 @@ func (l *lexer) read() *Token {
|
||||||
// table row
|
// table row
|
||||||
if m := matchers["table_row"].FindStringSubmatch(line); len(m) > 0 {
|
if m := matchers["table_row"].FindStringSubmatch(line); len(m) > 0 {
|
||||||
return &Token{
|
return &Token{
|
||||||
Type: TABLE_ROW,
|
Type: TABLEROW,
|
||||||
Indent: len(m[1]),
|
Indent: len(m[1]),
|
||||||
Line: l.lines,
|
Line: l.lines,
|
||||||
Value: strings.TrimSpace(m[2]),
|
Value: strings.TrimSpace(m[2]),
|
||||||
Text: line,
|
Text: line,
|
||||||
Comment: strings.Trim(m[3], " #"),
|
Comment: strings.Trim(m[3], " #"),
|
||||||
Keyword: keywords[TABLE_ROW],
|
Keyword: keywords[TABLEROW],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// scenario outline
|
// scenario outline
|
||||||
if m := matchers["scenario_outline"].FindStringSubmatch(line); len(m) > 0 {
|
if m := matchers["scenario_outline"].FindStringSubmatch(line); len(m) > 0 {
|
||||||
return &Token{
|
return &Token{
|
||||||
Type: SCENARIO_OUTLINE,
|
Type: OUTLINE,
|
||||||
Indent: len(m[1]),
|
Indent: len(m[1]),
|
||||||
Line: l.lines,
|
Line: l.lines,
|
||||||
Value: strings.TrimSpace(m[2]),
|
Value: strings.TrimSpace(m[2]),
|
||||||
Text: line,
|
Text: line,
|
||||||
Comment: strings.Trim(m[3], " #"),
|
Comment: strings.Trim(m[3], " #"),
|
||||||
Keyword: keywords[SCENARIO_OUTLINE],
|
Keyword: keywords[OUTLINE],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// examples
|
// examples
|
||||||
|
|
|
@ -133,11 +133,11 @@ func Test_minimal_feature(t *testing.T) {
|
||||||
TEXT,
|
TEXT,
|
||||||
TEXT,
|
TEXT,
|
||||||
TEXT,
|
TEXT,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
|
|
||||||
BACKGROUND,
|
BACKGROUND,
|
||||||
GIVEN,
|
GIVEN,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
|
|
||||||
COMMENT,
|
COMMENT,
|
||||||
SCENARIO,
|
SCENARIO,
|
||||||
|
@ -171,9 +171,9 @@ func Test_table_row_reading(t *testing.T) {
|
||||||
expectedTypes := []TokenType{
|
expectedTypes := []TokenType{
|
||||||
BACKGROUND,
|
BACKGROUND,
|
||||||
GIVEN,
|
GIVEN,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
GIVEN,
|
GIVEN,
|
||||||
}
|
}
|
||||||
expectedIndents := []int{2, 4, 6, 6, 6, 4}
|
expectedIndents := []int{2, 4, 6, 6, 6, 4}
|
||||||
|
@ -200,18 +200,18 @@ func Test_lexing_of_scenario_outline(t *testing.T) {
|
||||||
tokens = append(tokens, tok.Type)
|
tokens = append(tokens, tok.Type)
|
||||||
}
|
}
|
||||||
expected := []TokenType{
|
expected := []TokenType{
|
||||||
SCENARIO_OUTLINE,
|
OUTLINE,
|
||||||
GIVEN,
|
GIVEN,
|
||||||
AND,
|
AND,
|
||||||
AND,
|
AND,
|
||||||
WHEN,
|
WHEN,
|
||||||
THEN,
|
THEN,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
|
|
||||||
EXAMPLES,
|
EXAMPLES,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
}
|
}
|
||||||
for i := 0; i < len(expected); i++ {
|
for i := 0; i < len(expected); i++ {
|
||||||
if expected[i] != tokens[i] {
|
if expected[i] != tokens[i] {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
func (a *parser) assertMatchesTypes(expected []TokenType, t *testing.T) {
|
func (a *parser) assertMatchesTypes(expected []TokenType, t *testing.T) {
|
||||||
key := -1
|
key := -1
|
||||||
for _, tok := range a.ast {
|
for _, tok := range a.ast {
|
||||||
key += 1
|
key++
|
||||||
if len(expected) <= key {
|
if len(expected) <= key {
|
||||||
t.Fatalf("there are more tokens in AST then expected, next is '%s'", tok.Type)
|
t.Fatalf("there are more tokens in AST then expected, next is '%s'", tok.Type)
|
||||||
}
|
}
|
||||||
|
@ -72,19 +72,19 @@ func Test_parse_feature_file(t *testing.T) {
|
||||||
TEXT,
|
TEXT,
|
||||||
TEXT,
|
TEXT,
|
||||||
TEXT,
|
TEXT,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
|
|
||||||
BACKGROUND,
|
BACKGROUND,
|
||||||
GIVEN,
|
GIVEN,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
|
|
||||||
SCENARIO,
|
SCENARIO,
|
||||||
GIVEN,
|
GIVEN,
|
||||||
AND,
|
AND,
|
||||||
WHEN,
|
WHEN,
|
||||||
THEN,
|
THEN,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
|
|
||||||
TAGS,
|
TAGS,
|
||||||
SCENARIO,
|
SCENARIO,
|
||||||
|
@ -92,23 +92,23 @@ func Test_parse_feature_file(t *testing.T) {
|
||||||
AND,
|
AND,
|
||||||
WHEN,
|
WHEN,
|
||||||
THEN,
|
THEN,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
|
|
||||||
TAGS,
|
TAGS,
|
||||||
SCENARIO,
|
SCENARIO,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
|
|
||||||
SCENARIO_OUTLINE,
|
OUTLINE,
|
||||||
GIVEN,
|
GIVEN,
|
||||||
AND,
|
AND,
|
||||||
AND,
|
AND,
|
||||||
WHEN,
|
WHEN,
|
||||||
THEN,
|
THEN,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
EXAMPLES,
|
EXAMPLES,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
}, t)
|
}, t)
|
||||||
|
|
||||||
ft.assertHasNumScenarios(4, t)
|
ft.assertHasNumScenarios(4, t)
|
||||||
|
|
|
@ -17,7 +17,7 @@ func (s *Scenario) assertOutlineStep(text string, t *testing.T) *Step {
|
||||||
return stp
|
return stp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.Fatal("expected scenario '%s' to have step: '%s', but it did not", s.Title, text)
|
t.Fatalf("expected scenario '%s' to have step: '%s', but it did not", s.Title, text)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ func (s *Scenario) assertStep(text string, t *testing.T) *Step {
|
||||||
return stp
|
return stp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.Fatal("expected scenario '%s' to have step: '%s', but it did not", s.Title, text)
|
t.Fatalf("expected scenario '%s' to have step: '%s', but it did not", s.Title, text)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,17 +61,17 @@ func Test_parse_scenario_outline(t *testing.T) {
|
||||||
s.assertTitle("ls supports kinds of options", t)
|
s.assertTitle("ls supports kinds of options", t)
|
||||||
|
|
||||||
p.assertMatchesTypes([]TokenType{
|
p.assertMatchesTypes([]TokenType{
|
||||||
SCENARIO_OUTLINE,
|
OUTLINE,
|
||||||
GIVEN,
|
GIVEN,
|
||||||
AND,
|
AND,
|
||||||
AND,
|
AND,
|
||||||
WHEN,
|
WHEN,
|
||||||
THEN,
|
THEN,
|
||||||
NEW_LINE,
|
NEWLINE,
|
||||||
EXAMPLES,
|
EXAMPLES,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
}, t)
|
}, t)
|
||||||
|
|
||||||
s.assertOutlineStep(`I am in a directory "test"`, t)
|
s.assertOutlineStep(`I am in a directory "test"`, t)
|
||||||
|
|
|
@ -146,7 +146,7 @@ func Test_parse_hash_table_given_step(t *testing.T) {
|
||||||
p.next() // step over to eof
|
p.next() // step over to eof
|
||||||
p.assertMatchesTypes([]TokenType{
|
p.assertMatchesTypes([]TokenType{
|
||||||
GIVEN,
|
GIVEN,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
EOF,
|
EOF,
|
||||||
}, t)
|
}, t)
|
||||||
}
|
}
|
||||||
|
@ -172,9 +172,9 @@ func Test_parse_table_given_step(t *testing.T) {
|
||||||
p.next() // step over to eof
|
p.next() // step over to eof
|
||||||
p.assertMatchesTypes([]TokenType{
|
p.assertMatchesTypes([]TokenType{
|
||||||
GIVEN,
|
GIVEN,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
TABLE_ROW,
|
TABLEROW,
|
||||||
EOF,
|
EOF,
|
||||||
}, t)
|
}, t)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,21 +5,23 @@ import (
|
||||||
"unicode"
|
"unicode"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TokenType defines a gherkin token type
|
||||||
type TokenType int
|
type TokenType int
|
||||||
|
|
||||||
|
// TokenType constants
|
||||||
const (
|
const (
|
||||||
ILLEGAL TokenType = iota
|
ILLEGAL TokenType = iota
|
||||||
COMMENT
|
COMMENT
|
||||||
NEW_LINE
|
NEWLINE
|
||||||
EOF
|
EOF
|
||||||
TEXT
|
TEXT
|
||||||
TAGS
|
TAGS
|
||||||
TABLE_ROW
|
TABLEROW
|
||||||
PYSTRING
|
PYSTRING
|
||||||
FEATURE
|
FEATURE
|
||||||
BACKGROUND
|
BACKGROUND
|
||||||
SCENARIO
|
SCENARIO
|
||||||
SCENARIO_OUTLINE
|
OUTLINE
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
GIVEN
|
GIVEN
|
||||||
WHEN
|
WHEN
|
||||||
|
|
19
suite.go
19
suite.go
|
@ -58,6 +58,7 @@ type StepDef struct {
|
||||||
// executions are catching panic error since it may
|
// executions are catching panic error since it may
|
||||||
// be a context specific error.
|
// be a context specific error.
|
||||||
type Suite interface {
|
type Suite interface {
|
||||||
|
Run()
|
||||||
Step(expr Regexp, h StepHandler)
|
Step(expr Regexp, h StepHandler)
|
||||||
// suite events
|
// suite events
|
||||||
BeforeSuite(f func())
|
BeforeSuite(f func())
|
||||||
|
@ -84,10 +85,9 @@ type suite struct {
|
||||||
afterSuiteHandlers []func()
|
afterSuiteHandlers []func()
|
||||||
}
|
}
|
||||||
|
|
||||||
// New initializes a suite which supports the Suite
|
// New initializes a Suite. The instance is passed around
|
||||||
// interface. The instance is passed around to all
|
// to all context initialization functions from *_test.go files
|
||||||
// context initialization functions from *_test.go files
|
func New() Suite {
|
||||||
func New() *suite {
|
|
||||||
return &suite{}
|
return &suite{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,18 +378,19 @@ func (s *suite) runScenario(scenario *gherkin.Scenario) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *suite) printStepDefinitions() {
|
func (s *suite) printStepDefinitions() {
|
||||||
var longest int
|
var longest int
|
||||||
for _, def := range st.stepHandlers {
|
for _, def := range s.stepHandlers {
|
||||||
if longest < len(def.Expr.String()) {
|
if longest < len(def.Expr.String()) {
|
||||||
longest = len(def.Expr.String())
|
longest = len(def.Expr.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, def := range st.stepHandlers {
|
for _, def := range s.stepHandlers {
|
||||||
location := runtime.FuncForPC(reflect.ValueOf(def.Handler).Pointer()).Name()
|
location := runtime.FuncForPC(reflect.ValueOf(def.Handler).Pointer()).Name()
|
||||||
fmt.Println(cl(def.Expr.String(), yellow)+s(longest-len(def.Expr.String())), cl("# "+location, black))
|
spaces := strings.Repeat(" ", longest-len(def.Expr.String()))
|
||||||
|
fmt.Println(cl(def.Expr.String(), yellow)+spaces, cl("# "+location, black))
|
||||||
}
|
}
|
||||||
if len(st.stepHandlers) == 0 {
|
if len(s.stepHandlers) == 0 {
|
||||||
fmt.Println("there were no contexts registered, could not find any step definition..")
|
fmt.Println("there were no contexts registered, could not find any step definition..")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ func (s *suiteContext) HandleBeforeScenario(*gherkin.Scenario) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *suiteContext) followingStepsShouldHave(args ...*Arg) error {
|
func (s *suiteContext) followingStepsShouldHave(args ...*Arg) error {
|
||||||
var expected []string = args[1].PyString().Lines
|
var expected = args[1].PyString().Lines
|
||||||
var actual, unmatched []string
|
var actual, unmatched []string
|
||||||
var matched []int
|
var matched []int
|
||||||
|
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче