From 73e8cf6bddc62f79b7d3591c0e8e92f7a7ec9f8a Mon Sep 17 00:00:00 2001 From: libmartinito Date: Thu, 7 Mar 2024 20:47:46 +0800 Subject: [PATCH 1/2] chore: update tester-utils and golang.org/x/sys dependencies to latest versions --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 639ab91..7afa0fe 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/codecrafters-io/grep-tester go 1.20 -require github.com/codecrafters-io/tester-utils v0.2.10 +require github.com/codecrafters-io/tester-utils v0.2.15 require ( github.com/davecgh/go-spew v1.1.1 // indirect @@ -12,7 +12,7 @@ require ( github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/testify v1.8.4 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.18.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 4aca25b..b29734b 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ github.com/codecrafters-io/tester-utils v0.2.1 h1:+bdZLJhFMWcf+/E3C4NlGsIvxvsyBW github.com/codecrafters-io/tester-utils v0.2.1/go.mod h1:BeSLyqBpFxUwIm41QlnuRG7ZsabBXWE2Ga3LMFUXAPM= github.com/codecrafters-io/tester-utils v0.2.10 h1:Xpu6wzgpRpiZPFNGWMRcJXwAZZ0Yb5Mv6IDOR319f+s= github.com/codecrafters-io/tester-utils v0.2.10/go.mod h1:BeSLyqBpFxUwIm41QlnuRG7ZsabBXWE2Ga3LMFUXAPM= +github.com/codecrafters-io/tester-utils v0.2.15 h1:d6lbr1nVkZ4+G55E47bG3bf1lWiMLOUZy5EiHwX2SsE= +github.com/codecrafters-io/tester-utils v0.2.15/go.mod h1:BeSLyqBpFxUwIm41QlnuRG7ZsabBXWE2Ga3LMFUXAPM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= @@ -27,6 +29,8 @@ golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= From ccff98250f5accd482bcbbf905f6e796771ee617 Mon Sep 17 00:00:00 2001 From: libmartinito Date: Thu, 7 Mar 2024 20:49:21 +0800 Subject: [PATCH 2/2] refactor: update import paths and struct names for tester-utils package --- internal/stage_init.go | 4 ++-- internal/tester_definition.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/stage_init.go b/internal/stage_init.go index 99c2983..0a447dd 100644 --- a/internal/stage_init.go +++ b/internal/stage_init.go @@ -3,11 +3,11 @@ package internal import ( "fmt" - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) // Example from the grep course -func testInit(stageHarness *tester_utils.StageHarness) error { +func testInit(stageHarness *test_case_harness.TestCaseHarness) error { // should exit with 0: echo "dog" | grep -E "d" stageHarness.Logger.Infof("$ echo \"%s\" | ./script.sh -E \"%s\"", "dog", "d") diff --git a/internal/tester_definition.go b/internal/tester_definition.go index 864b452..b3f0527 100644 --- a/internal/tester_definition.go +++ b/internal/tester_definition.go @@ -1,16 +1,16 @@ package internal import ( - testerutils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/tester_definition" ) -var testerDefinition = testerutils.TesterDefinition{ - AntiCheatTestCases: []testerutils.TestCase{}, +var testerDefinition = tester_definition.TesterDefinition{ + AntiCheatTestCases: []tester_definition.TestCase{}, ExecutableFileName: "script.sh", - TestCases: []testerutils.TestCase{ + TestCases: []tester_definition.TestCase{ { - Slug: "init", - TestFunc: testInit, + Slug: "init", + TestFunc: testInit, }, }, }