Skip to content

Commit

Permalink
Bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
nhatthm committed Nov 21, 2023
1 parent 90f045e commit 9ec9d91
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion features/bootstrap/godog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestIntegration(t *testing.T) {
c := clocksteps.New()

RunSuite(t, "..", func(_ *testing.T, ctx *godog.ScenarioContext) {
c.RegisterContext(ctx)
c.RegisterSteps(ctx)
registerClock(c, ctx)
})
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-memdb v1.3.4 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
Expand Down
43 changes: 25 additions & 18 deletions godog.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,37 @@ import (
)

// RegisterContext registers clock to godog tests.
func (c *Clock) RegisterContext(ctx *godog.ScenarioContext) {
ctx.After(func(context.Context, *godog.Scenario, error) (context.Context, error) {
//
// Deprecated: use RegisterSteps instead.
func (c *Clock) RegisterContext(s *godog.ScenarioContext) {
c.RegisterSteps(s)
}

// RegisterSteps registers clock to godog tests.
func (c *Clock) RegisterSteps(s *godog.ScenarioContext) {
s.After(func(context.Context, *godog.Scenario, error) (context.Context, error) {
// Unfreeze the clock.
c.Unfreeze()

return nil, nil
})

ctx.Step(`(?:the )?clock is at "([^"]*)"`, c.set)
ctx.Step(`(?:the )?clock is set to "([^"]*)"`, c.set)
ctx.Step(`sets? (?:the )?clock to "([^"]*)"`, c.set)
ctx.Step(`now is "([^"]*)"`, c.set)

ctx.Step(`adds? ([^\s]*) to (?:the )?clock`, c.add)
ctx.Step(`adds? ([0-9]+) days? to (?:the )?clock`, c.addDay)
ctx.Step(`adds? ([0-9]+) months? to (?:the )?clock`, c.addMonth)
ctx.Step(`adds? ([0-9]+) years? to (?:the )?clock`, c.addYear)
ctx.Step(`adds? ([0-9]+) months?,? ([0-9]+) days? to (?:the )?clock`, c.addMonthDay)
ctx.Step(`adds? ([0-9]+) years?,? ([0-9]+) days? to (?:the )?clock`, c.addYearDay)
ctx.Step(`adds? ([0-9]+) years?,? ([0-9]+) months? to (?:the )?clock`, c.addYearMonth)
ctx.Step(`adds? ([0-9]+) years?,? ([0-9]+) months?,? ([0-9]+) days? to (?:the )?clock`, c.addDate)

ctx.Step(`\s*freeze (?:the )?clock`, c.freeze)
ctx.Step(`(?:(?:release)|(?:unset)|(?:reset)) (?:the )?clock$`, c.unfreeze)
s.Step(`(?:the )?clock is at "([^"]*)"`, c.set)
s.Step(`(?:the )?clock is set to "([^"]*)"`, c.set)
s.Step(`sets? (?:the )?clock to "([^"]*)"`, c.set)
s.Step(`now is "([^"]*)"`, c.set)

s.Step(`adds? ([^\s]*) to (?:the )?clock`, c.add)
s.Step(`adds? ([0-9]+) days? to (?:the )?clock`, c.addDay)
s.Step(`adds? ([0-9]+) months? to (?:the )?clock`, c.addMonth)
s.Step(`adds? ([0-9]+) years? to (?:the )?clock`, c.addYear)
s.Step(`adds? ([0-9]+) months?,? ([0-9]+) days? to (?:the )?clock`, c.addMonthDay)
s.Step(`adds? ([0-9]+) years?,? ([0-9]+) days? to (?:the )?clock`, c.addYearDay)
s.Step(`adds? ([0-9]+) years?,? ([0-9]+) months? to (?:the )?clock`, c.addYearMonth)
s.Step(`adds? ([0-9]+) years?,? ([0-9]+) months?,? ([0-9]+) days? to (?:the )?clock`, c.addDate)

s.Step(`\s*freeze (?:the )?clock`, c.freeze)
s.Step(`(?:(?:release)|(?:unset)|(?:reset)) (?:the )?clock$`, c.unfreeze)
}

func (c *Clock) set(t string) error {
Expand Down

0 comments on commit 9ec9d91

Please sign in to comment.