@@ -125,7 +125,7 @@ func (ctx ScenarioContext) Before(h BeforeScenarioHook) {
125
125
// BeforeScenarioHook defines a hook before scenario.
126
126
type BeforeScenarioHook func (ctx context.Context , sc * Scenario ) (context.Context , error )
127
127
128
- // After registers an function or method
128
+ // After registers a function or method
129
129
// to be run after every scenario.
130
130
func (ctx ScenarioContext ) After (h AfterScenarioHook ) {
131
131
ctx .suite .afterScenarioHandlers = append (ctx .suite .afterScenarioHandlers , h )
@@ -135,8 +135,8 @@ func (ctx ScenarioContext) After(h AfterScenarioHook) {
135
135
type AfterScenarioHook func (ctx context.Context , sc * Scenario , err error ) (context.Context , error )
136
136
137
137
// StepContext exposes StepContext of a scenario.
138
- func (ctx * ScenarioContext ) StepContext () StepContext {
139
- return StepContext { suite : ctx . suite }
138
+ func (ctx ScenarioContext ) StepContext () StepContext {
139
+ return StepContext ( ctx )
140
140
}
141
141
142
142
// Before registers a function or method
@@ -168,11 +168,11 @@ type AfterStepHook func(ctx context.Context, st *Step, status StepResultStatus,
168
168
// to be run before every scenario.
169
169
//
170
170
// It is a good practice to restore the default state
171
- // before every scenario so it would be isolated from
171
+ // before every scenario, so it would be isolated from
172
172
// any kind of state.
173
173
//
174
174
// Deprecated: use Before.
175
- func (ctx * ScenarioContext ) BeforeScenario (fn func (sc * Scenario )) {
175
+ func (ctx ScenarioContext ) BeforeScenario (fn func (sc * Scenario )) {
176
176
ctx .Before (func (ctx context.Context , sc * Scenario ) (context.Context , error ) {
177
177
fn (sc )
178
178
@@ -184,7 +184,7 @@ func (ctx *ScenarioContext) BeforeScenario(fn func(sc *Scenario)) {
184
184
// to be run after every scenario.
185
185
//
186
186
// Deprecated: use After.
187
- func (ctx * ScenarioContext ) AfterScenario (fn func (sc * Scenario , err error )) {
187
+ func (ctx ScenarioContext ) AfterScenario (fn func (sc * Scenario , err error )) {
188
188
ctx .After (func (ctx context.Context , sc * Scenario , err error ) (context.Context , error ) {
189
189
fn (sc , err )
190
190
@@ -196,7 +196,7 @@ func (ctx *ScenarioContext) AfterScenario(fn func(sc *Scenario, err error)) {
196
196
// to be run before every step.
197
197
//
198
198
// Deprecated: use ScenarioContext.StepContext() and StepContext.Before.
199
- func (ctx * ScenarioContext ) BeforeStep (fn func (st * Step )) {
199
+ func (ctx ScenarioContext ) BeforeStep (fn func (st * Step )) {
200
200
ctx .StepContext ().Before (func (ctx context.Context , st * Step ) (context.Context , error ) {
201
201
fn (st )
202
202
@@ -215,7 +215,7 @@ func (ctx *ScenarioContext) BeforeStep(fn func(st *Step)) {
215
215
// browser, to take a screenshot after failure.
216
216
//
217
217
// Deprecated: use ScenarioContext.StepContext() and StepContext.After.
218
- func (ctx * ScenarioContext ) AfterStep (fn func (st * Step , err error )) {
218
+ func (ctx ScenarioContext ) AfterStep (fn func (st * Step , err error )) {
219
219
ctx .StepContext ().After (func (ctx context.Context , st * Step , status StepResultStatus , err error ) (context.Context , error ) {
220
220
fn (st , err )
221
221
@@ -250,35 +250,35 @@ func (ctx *ScenarioContext) AfterStep(fn func(st *Step, err error)) {
250
250
// If none of the *StepDefinition is matched, then
251
251
// ErrUndefined error will be returned when
252
252
// running steps.
253
- func (ctx * ScenarioContext ) Step (expr , stepFunc interface {}) {
253
+ func (ctx ScenarioContext ) Step (expr , stepFunc interface {}) {
254
254
ctx .stepWithKeyword (expr , stepFunc , formatters .None )
255
255
}
256
256
257
257
// Given functions identically to Step, but the *StepDefinition
258
258
// will only be matched if the step starts with "Given". "And"
259
259
// and "But" keywords copy the keyword of the last step for the
260
260
// purpose of matching.
261
- func (ctx * ScenarioContext ) Given (expr , stepFunc interface {}) {
261
+ func (ctx ScenarioContext ) Given (expr , stepFunc interface {}) {
262
262
ctx .stepWithKeyword (expr , stepFunc , formatters .Given )
263
263
}
264
264
265
265
// When functions identically to Step, but the *StepDefinition
266
266
// will only be matched if the step starts with "When". "And"
267
267
// and "But" keywords copy the keyword of the last step for the
268
268
// purpose of matching.
269
- func (ctx * ScenarioContext ) When (expr , stepFunc interface {}) {
269
+ func (ctx ScenarioContext ) When (expr , stepFunc interface {}) {
270
270
ctx .stepWithKeyword (expr , stepFunc , formatters .When )
271
271
}
272
272
273
273
// Then functions identically to Step, but the *StepDefinition
274
274
// will only be matched if the step starts with "Then". "And"
275
275
// and "But" keywords copy the keyword of the last step for the
276
276
// purpose of matching.
277
- func (ctx * ScenarioContext ) Then (expr , stepFunc interface {}) {
277
+ func (ctx ScenarioContext ) Then (expr , stepFunc interface {}) {
278
278
ctx .stepWithKeyword (expr , stepFunc , formatters .Then )
279
279
}
280
280
281
- func (ctx * ScenarioContext ) stepWithKeyword (expr interface {}, stepFunc interface {}, keyword formatters.Keyword ) {
281
+ func (ctx ScenarioContext ) stepWithKeyword (expr interface {}, stepFunc interface {}, keyword formatters.Keyword ) {
282
282
var regex * regexp.Regexp
283
283
284
284
switch t := expr .(type ) {
@@ -338,7 +338,7 @@ func (ctx *ScenarioContext) stepWithKeyword(expr interface{}, stepFunc interface
338
338
// If there are go test files, it first builds a test
339
339
// package with standard go test command.
340
340
//
341
- // Finally it generates godog suite executable which
341
+ // Finally, it generates godog suite executable which
342
342
// registers exported godog contexts from the test files
343
343
// of tested package.
344
344
//
0 commit comments