godog/fmt.go
gedi df26aa1c1c support scenario outline with example table
* 042235c expose StepDef which is needed to formatters
* e9474dc fix outline scenario formatting
* f02c6ce fix comment position calculation for outlines
* 5d7f128 remove step status type, use standard error
2015-06-22 17:23:10 +03:00

58 строки
1,2 КиБ
Go

package godog
import (
"fmt"
"github.com/DATA-DOG/godog/gherkin"
)
// Formatter is an interface for feature runner
// output summary presentation
type Formatter interface {
Node(interface{})
Failed(*gherkin.Step, *StepDef, error)
Passed(*gherkin.Step, *StepDef)
Skipped(*gherkin.Step)
Undefined(*gherkin.Step)
Summary()
}
// failed represents a failed step data structure
// with all necessary references
type failed struct {
step *gherkin.Step
def *StepDef
err error
}
func (f failed) line() string {
var tok *gherkin.Token
var ft *gherkin.Feature
if f.step.Scenario != nil {
tok = f.step.Scenario.Token
ft = f.step.Scenario.Feature
} else {
tok = f.step.Background.Token
ft = f.step.Background.Feature
}
return fmt.Sprintf("%s:%d", ft.Path, tok.Line)
}
// passed represents a successful step data structure
// with all necessary references
type passed struct {
step *gherkin.Step
def *StepDef
}
// skipped represents a skipped step data structure
// with all necessary references
type skipped struct {
step *gherkin.Step
}
// undefined represents a pending step data structure
// with all necessary references
type undefined struct {
step *gherkin.Step
}