From 82f26dfd5389faa945f4c83aca993fdc9b360529 Mon Sep 17 00:00:00 2001 From: Nhat Date: Tue, 21 Nov 2023 09:02:38 +0100 Subject: [PATCH] Bump dependencies (#23) --- .github/workflows/lint.yaml | 2 +- .github/workflows/test.yaml | 2 +- features/bootstrap/godog_test.go | 2 +- go.mod | 2 +- go.sum | 3 ++- godog.go | 43 +++++++++++++++++++------------- 6 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 9c34ae7..02e3c05 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -7,7 +7,7 @@ on: pull_request: env: - GO_VERSION: "1.19.x" + GO_VERSION: "1.21.x" jobs: lint: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2b771bc..ff5da44 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest ] - go-version: [ 1.17.x, 1.18.x, 1.19.x, 1.20.x ] + go-version: [ 1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x ] runs-on: ${{ matrix.os }} steps: - name: Install Go diff --git a/features/bootstrap/godog_test.go b/features/bootstrap/godog_test.go index 22d1ce6..bf0f496 100644 --- a/features/bootstrap/godog_test.go +++ b/features/bootstrap/godog_test.go @@ -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) }) } diff --git a/go.mod b/go.mod index df6bba5..5656f71 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 645d42d..9786f96 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/godog.go b/godog.go index e6835e5..bf1a265 100644 --- a/godog.go +++ b/godog.go @@ -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 {