Skip to content

Commit

Permalink
Merge pull request #322 from cucumber/removed-deprecated-things
Browse files Browse the repository at this point in the history
Removed deprecated code
  • Loading branch information
lonnblad authored Jun 29, 2020
2 parents c7d7393 + dbd8cdf commit 183de20
Show file tree
Hide file tree
Showing 25 changed files with 309 additions and 1,295 deletions.
11 changes: 0 additions & 11 deletions fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ type Formatter interface {
Summary()
}

// ConcurrentFormatter is an interface for a Concurrent
// version of the Formatter interface.
//
// Deprecated: The formatters need to handle concurrency
// instead of being copied and synchronized for each thread.
type ConcurrentFormatter interface {
Formatter
Copy(ConcurrentFormatter)
Sync(ConcurrentFormatter)
}

type storageFormatter interface {
setStorage(*storage)
}
Expand Down
19 changes: 2 additions & 17 deletions fmt_output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ func listFmtOutputTestsFeatureFiles() (featureFiles []string, err error) {
}

func fmtOutputTest(fmtName, testName, featureFilePath string) func(*testing.T) {
fmtOutputSuiteInitializer := func(s *godog.Suite) {
s.Step(`^(?:a )?failing step`, failingStepDef)
s.Step(`^(?:a )?pending step$`, pendingStepDef)
s.Step(`^(?:a )?passing step$`, passingStepDef)
s.Step(`^odd (\d+) and even (\d+) number$`, oddEvenStepDef)
}

fmtOutputScenarioInitializer := func(ctx *godog.ScenarioContext) {
ctx.Step(`^(?:a )?failing step`, failingStepDef)
ctx.Step(`^(?:a )?pending step$`, pendingStepDef)
Expand All @@ -93,22 +86,14 @@ func fmtOutputTest(fmtName, testName, featureFilePath string) func(*testing.T) {
Output: out,
}

godog.RunWithOptions(fmtName, fmtOutputSuiteInitializer, opts)

expected := string(expectedOutput)
actual := buf.String()
assert.Equalf(t, expected, actual, "path: %s", expectOutputPath)

buf.Reset()

godog.TestSuite{
Name: fmtName,
ScenarioInitializer: fmtOutputScenarioInitializer,
Options: &opts,
}.Run()

expected = string(expectedOutput)
actual = buf.String()
expected := string(expectedOutput)
actual := buf.String()
assert.Equalf(t, expected, actual, "path: %s", expectOutputPath)
}
}
Expand Down
62 changes: 31 additions & 31 deletions fmt_progress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Feature: basic
Then two
`

func TestProgressFormatterWhenStepPanics(t *testing.T) {
func Test_ProgressFormatterWhenStepPanics(t *testing.T) {
const path = "any.feature"

gd, err := gherkin.ParseGherkinDocument(strings.NewReader(basicGherkinFeature), (&messages.Incrementing{}).NewId)
Expand All @@ -36,9 +36,9 @@ func TestProgressFormatterWhenStepPanics(t *testing.T) {
r := runner{
fmt: progressFunc("progress", w),
features: []*feature{&ft},
initializer: func(s *Suite) {
s.Step(`^one$`, func() error { return nil })
s.Step(`^two$`, func() error { panic("omg") })
scenarioInitializer: func(ctx *ScenarioContext) {
ctx.Step(`^one$`, func() error { return nil })
ctx.Step(`^two$`, func() error { panic("omg") })
},
}

Expand All @@ -48,14 +48,14 @@ func TestProgressFormatterWhenStepPanics(t *testing.T) {
r.storage.mustInsertPickle(pickle)
}

failed := r.concurrent(1, func() Formatter { return progressFunc("progress", w) })
failed := r.concurrent(1)
require.True(t, failed)

actual := buf.String()
assert.Contains(t, actual, "godog/fmt_progress_test.go:41")
}

func TestProgressFormatterWithPanicInMultistep(t *testing.T) {
func Test_ProgressFormatterWithPanicInMultistep(t *testing.T) {
const path = "any.feature"

gd, err := gherkin.ParseGherkinDocument(strings.NewReader(basicGherkinFeature), (&messages.Incrementing{}).NewId)
Expand All @@ -70,12 +70,12 @@ func TestProgressFormatterWithPanicInMultistep(t *testing.T) {
r := runner{
fmt: progressFunc("progress", w),
features: []*feature{&ft},
initializer: func(s *Suite) {
s.Step(`^sub1$`, func() error { return nil })
s.Step(`^sub-sub$`, func() error { return nil })
s.Step(`^sub2$`, func() []string { return []string{"sub-sub", "sub1", "one"} })
s.Step(`^one$`, func() error { return nil })
s.Step(`^two$`, func() []string { return []string{"sub1", "sub2"} })
scenarioInitializer: func(ctx *ScenarioContext) {
ctx.Step(`^sub1$`, func() error { return nil })
ctx.Step(`^sub-sub$`, func() error { return nil })
ctx.Step(`^sub2$`, func() []string { return []string{"sub-sub", "sub1", "one"} })
ctx.Step(`^one$`, func() error { return nil })
ctx.Step(`^two$`, func() []string { return []string{"sub1", "sub2"} })
},
}

Expand All @@ -85,11 +85,11 @@ func TestProgressFormatterWithPanicInMultistep(t *testing.T) {
r.storage.mustInsertPickle(pickle)
}

failed := r.concurrent(1, func() Formatter { return progressFunc("progress", w) })
failed := r.concurrent(1)
require.True(t, failed)
}

func TestProgressFormatterMultistepTemplates(t *testing.T) {
func Test_ProgressFormatterMultistepTemplates(t *testing.T) {
const path = "any.feature"

gd, err := gherkin.ParseGherkinDocument(strings.NewReader(basicGherkinFeature), (&messages.Incrementing{}).NewId)
Expand All @@ -104,11 +104,11 @@ func TestProgressFormatterMultistepTemplates(t *testing.T) {
r := runner{
fmt: progressFunc("progress", w),
features: []*feature{&ft},
initializer: func(s *Suite) {
s.Step(`^sub-sub$`, func() error { return nil })
s.Step(`^substep$`, func() Steps { return Steps{"sub-sub", `unavailable "John" cost 5`, "one", "three"} })
s.Step(`^one$`, func() error { return nil })
s.Step(`^(t)wo$`, func(s string) Steps { return Steps{"undef", "substep"} })
scenarioInitializer: func(ctx *ScenarioContext) {
ctx.Step(`^sub-sub$`, func() error { return nil })
ctx.Step(`^substep$`, func() Steps { return Steps{"sub-sub", `unavailable "John" cost 5`, "one", "three"} })
ctx.Step(`^one$`, func() error { return nil })
ctx.Step(`^(t)wo$`, func(s string) Steps { return Steps{"undef", "substep"} })
},
}

Expand All @@ -118,7 +118,7 @@ func TestProgressFormatterMultistepTemplates(t *testing.T) {
r.storage.mustInsertPickle(pickle)
}

failed := r.concurrent(1, func() Formatter { return progressFunc("progress", w) })
failed := r.concurrent(1)
require.False(t, failed)

expected := `.U 2
Expand Down Expand Up @@ -154,7 +154,7 @@ func FeatureContext(s *godog.Suite) {
assert.Equal(t, expected, actual)
}

func TestProgressFormatterWhenMultiStepHasArgument(t *testing.T) {
func Test_ProgressFormatterWhenMultiStepHasArgument(t *testing.T) {
const path = "any.feature"

var featureSource = `
Expand All @@ -180,9 +180,9 @@ Feature: basic
r := runner{
fmt: progressFunc("progress", w),
features: []*feature{&ft},
initializer: func(s *Suite) {
s.Step(`^one$`, func() error { return nil })
s.Step(`^two:$`, func(doc *messages.PickleStepArgument_PickleDocString) Steps { return Steps{"one"} })
scenarioInitializer: func(ctx *ScenarioContext) {
ctx.Step(`^one$`, func() error { return nil })
ctx.Step(`^two:$`, func(doc *messages.PickleStepArgument_PickleDocString) Steps { return Steps{"one"} })
},
}

Expand All @@ -192,11 +192,11 @@ Feature: basic
r.storage.mustInsertPickle(pickle)
}

failed := r.concurrent(1, func() Formatter { return progressFunc("progress", w) })
failed := r.concurrent(1)
require.False(t, failed)
}

func TestProgressFormatterWhenMultiStepHasStepWithArgument(t *testing.T) {
func Test_ProgressFormatterWhenMultiStepHasStepWithArgument(t *testing.T) {
const path = "any.feature"

var featureSource = `
Expand All @@ -223,10 +223,10 @@ Feature: basic
r := runner{
fmt: progressFunc("progress", w),
features: []*feature{&ft},
initializer: func(s *Suite) {
s.Step(`^one$`, func() error { return nil })
s.Step(`^two$`, func() Steps { return Steps{subStep} })
s.Step(`^three:$`, func(doc *messages.PickleStepArgument_PickleDocString) error { return nil })
scenarioInitializer: func(ctx *ScenarioContext) {
ctx.Step(`^one$`, func() error { return nil })
ctx.Step(`^two$`, func() Steps { return Steps{subStep} })
ctx.Step(`^three:$`, func(doc *messages.PickleStepArgument_PickleDocString) error { return nil })
},
}

Expand All @@ -236,7 +236,7 @@ Feature: basic
r.storage.mustInsertPickle(pickle)
}

failed := r.concurrent(1, func() Formatter { return progressFunc("progress", w) })
failed := r.concurrent(1)
require.True(t, failed)

expected := `.F 2
Expand Down
30 changes: 15 additions & 15 deletions formatter-tests/cucumber/scenario_outline
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"name": "passing step",
"line": 13,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -60,7 +60,7 @@
"name": "passing step",
"line": 13,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -72,7 +72,7 @@
"name": "odd 1 and even 2 number",
"line": 13,
"match": {
"location": "fmt_output_test.go:118"
"location": "fmt_output_test.go:103"
},
"result": {
"status": "passed",
Expand Down Expand Up @@ -112,7 +112,7 @@
"name": "passing step",
"line": 14,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -124,7 +124,7 @@
"name": "passing step",
"line": 14,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -136,7 +136,7 @@
"name": "odd 2 and even 0 number",
"line": 14,
"match": {
"location": "fmt_output_test.go:118"
"location": "fmt_output_test.go:103"
},
"result": {
"status": "failed",
Expand Down Expand Up @@ -177,7 +177,7 @@
"name": "passing step",
"line": 15,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -189,7 +189,7 @@
"name": "passing step",
"line": 15,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -201,7 +201,7 @@
"name": "odd 3 and even 11 number",
"line": 15,
"match": {
"location": "fmt_output_test.go:118"
"location": "fmt_output_test.go:103"
},
"result": {
"status": "failed",
Expand Down Expand Up @@ -242,7 +242,7 @@
"name": "passing step",
"line": 20,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -254,7 +254,7 @@
"name": "passing step",
"line": 20,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -266,7 +266,7 @@
"name": "odd 1 and even 14 number",
"line": 20,
"match": {
"location": "fmt_output_test.go:118"
"location": "fmt_output_test.go:103"
},
"result": {
"status": "passed",
Expand Down Expand Up @@ -306,7 +306,7 @@
"name": "passing step",
"line": 21,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -318,7 +318,7 @@
"name": "passing step",
"line": 21,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -330,7 +330,7 @@
"name": "odd 3 and even 9 number",
"line": 21,
"match": {
"location": "fmt_output_test.go:118"
"location": "fmt_output_test.go:103"
},
"result": {
"status": "failed",
Expand Down
8 changes: 4 additions & 4 deletions formatter-tests/cucumber/scenario_with_background
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"name": "passing step",
"line": 4,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -32,7 +32,7 @@
"name": "passing step",
"line": 5,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -44,7 +44,7 @@
"name": "passing step",
"line": 8,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand All @@ -56,7 +56,7 @@
"name": "passing step",
"line": 9,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand Down
2 changes: 1 addition & 1 deletion formatter-tests/cucumber/single_scenario_with_passing_step
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"name": "a passing step",
"line": 7,
"match": {
"location": "fmt_output_test.go:116"
"location": "fmt_output_test.go:101"
},
"result": {
"status": "passed",
Expand Down
Loading

0 comments on commit 183de20

Please sign in to comment.