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 92ecbdc..d3284ae 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ github.com/codecrafters-io/tester-utils v0.2.0 h1:LHGrqE5wVaOoJ7aSa5vS93W3ToR7/t github.com/codecrafters-io/tester-utils v0.2.0/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= diff --git a/internal/stage_alternation.go b/internal/stage_alternation.go index a93483d..ddbfbfc 100644 --- a/internal/stage_alternation.go +++ b/internal/stage_alternation.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testAlternation(stageHarness *tester_utils.StageHarness) error { +func testAlternation(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: "a (cat|dog)", diff --git a/internal/stage_backreferences_multiple.go b/internal/stage_backreferences_multiple.go index 9bb3803..bae856a 100644 --- a/internal/stage_backreferences_multiple.go +++ b/internal/stage_backreferences_multiple.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testBackreferencesMultiple(stageHarness *tester_utils.StageHarness) error { +func testBackreferencesMultiple(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ // Base case { diff --git a/internal/stage_backreferences_nested.go b/internal/stage_backreferences_nested.go index 9f2356e..ba69305 100644 --- a/internal/stage_backreferences_nested.go +++ b/internal/stage_backreferences_nested.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testBackreferencesNested(stageHarness *tester_utils.StageHarness) error { +func testBackreferencesNested(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ // Base case { diff --git a/internal/stage_backreferences_single.go b/internal/stage_backreferences_single.go index 32e19c2..fcd9e29 100644 --- a/internal/stage_backreferences_single.go +++ b/internal/stage_backreferences_single.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testBackreferencesSingle(stageHarness *tester_utils.StageHarness) error { +func testBackreferencesSingle(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ // Base case { diff --git a/internal/stage_combining_character_classes.go b/internal/stage_combining_character_classes.go index 7a52ab8..7db7c7f 100644 --- a/internal/stage_combining_character_classes.go +++ b/internal/stage_combining_character_classes.go @@ -1,8 +1,8 @@ package internal -import tester_utils "github.com/codecrafters-io/tester-utils" +import "github.com/codecrafters-io/tester-utils/test_case_harness" -func testCombiningCharacterClasses(stageHarness *tester_utils.StageHarness) error { +func testCombiningCharacterClasses(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: `\d apple`, diff --git a/internal/stage_end_of_string_anchor.go b/internal/stage_end_of_string_anchor.go index c422609..47f9def 100644 --- a/internal/stage_end_of_string_anchor.go +++ b/internal/stage_end_of_string_anchor.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testEndOfStringAnchor(stageHarness *tester_utils.StageHarness) error { +func testEndOfStringAnchor(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: "cat$", diff --git a/internal/stage_init.go b/internal/stage_init.go index 5475488..5f0461e 100644 --- a/internal/stage_init.go +++ b/internal/stage_init.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testInit(stageHarness *tester_utils.StageHarness) error { +func testInit(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: "d", diff --git a/internal/stage_match_alphanumeric.go b/internal/stage_match_alphanumeric.go index 62db241..ea138f2 100644 --- a/internal/stage_match_alphanumeric.go +++ b/internal/stage_match_alphanumeric.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testMatchAlphanumeric(stageHarness *tester_utils.StageHarness) error { +func testMatchAlphanumeric(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: `\w`, diff --git a/internal/stage_match_digit.go b/internal/stage_match_digit.go index a531e74..1d825d8 100644 --- a/internal/stage_match_digit.go +++ b/internal/stage_match_digit.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testMatchDigit(stageHarness *tester_utils.StageHarness) error { +func testMatchDigit(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: `\d`, diff --git a/internal/stage_negative_character_groups.go b/internal/stage_negative_character_groups.go index 264f530..403da10 100644 --- a/internal/stage_negative_character_groups.go +++ b/internal/stage_negative_character_groups.go @@ -1,8 +1,8 @@ package internal -import tester_utils "github.com/codecrafters-io/tester-utils" +import "github.com/codecrafters-io/tester-utils/test_case_harness" -func testNegativeCharacterGroups(stageHarness *tester_utils.StageHarness) error { +func testNegativeCharacterGroups(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: "[^xyz]", diff --git a/internal/stage_one_or_more_quantifier.go b/internal/stage_one_or_more_quantifier.go index 8c7e05c..d7dcb81 100644 --- a/internal/stage_one_or_more_quantifier.go +++ b/internal/stage_one_or_more_quantifier.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testOneOrMoreQuantifier(stageHarness *tester_utils.StageHarness) error { +func testOneOrMoreQuantifier(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: "ca+t", diff --git a/internal/stage_positive_character_groups.go b/internal/stage_positive_character_groups.go index efdb164..3d87273 100644 --- a/internal/stage_positive_character_groups.go +++ b/internal/stage_positive_character_groups.go @@ -1,8 +1,8 @@ package internal -import tester_utils "github.com/codecrafters-io/tester-utils" +import "github.com/codecrafters-io/tester-utils/test_case_harness" -func testPositiveCharacterGroups(stageHarness *tester_utils.StageHarness) error { +func testPositiveCharacterGroups(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: "[abcd]", diff --git a/internal/stage_start_of_string_anchor.go b/internal/stage_start_of_string_anchor.go index db814f1..ec9c43e 100644 --- a/internal/stage_start_of_string_anchor.go +++ b/internal/stage_start_of_string_anchor.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testStartOfStringAnchor(stageHarness *tester_utils.StageHarness) error { +func testStartOfStringAnchor(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: "^log", diff --git a/internal/stage_wildcard.go b/internal/stage_wildcard.go index 999bcf0..d97ae46 100644 --- a/internal/stage_wildcard.go +++ b/internal/stage_wildcard.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testWildcard(stageHarness *tester_utils.StageHarness) error { +func testWildcard(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: "c.t", diff --git a/internal/stage_zero_or_one_quantifier.go b/internal/stage_zero_or_one_quantifier.go index 77e1536..448f3a2 100644 --- a/internal/stage_zero_or_one_quantifier.go +++ b/internal/stage_zero_or_one_quantifier.go @@ -1,10 +1,10 @@ package internal import ( - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) -func testZeroOrOneQuantifier(stageHarness *tester_utils.StageHarness) error { +func testZeroOrOneQuantifier(stageHarness *test_case_harness.TestCaseHarness) error { testCases := []TestCase{ { Pattern: "ca?t", diff --git a/internal/test_case.go b/internal/test_case.go index 4e82f0a..910d4a6 100644 --- a/internal/test_case.go +++ b/internal/test_case.go @@ -2,7 +2,7 @@ package internal import ( "fmt" - tester_utils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/test_case_harness" ) type TestCase struct { @@ -11,7 +11,7 @@ type TestCase struct { ExpectedExitCode int } -func RunTestCases(testCases []TestCase, stageHarness *tester_utils.StageHarness) error { +func RunTestCases(testCases []TestCase, stageHarness *test_case_harness.TestCaseHarness) error { logger := stageHarness.Logger executable := stageHarness.Executable diff --git a/internal/tester_definition.go b/internal/tester_definition.go index 14cafd4..8490f83 100644 --- a/internal/tester_definition.go +++ b/internal/tester_definition.go @@ -1,14 +1,14 @@ package internal import ( - testerutils "github.com/codecrafters-io/tester-utils" + "github.com/codecrafters-io/tester-utils/tester_definition" "time" ) -var testerDefinition = testerutils.TesterDefinition{ - AntiCheatTestCases: []testerutils.TestCase{}, +var testerDefinition = tester_definition.TesterDefinition{ + AntiCheatTestCases: []tester_definition.TestCase{}, ExecutableFileName: "your_grep.sh", - TestCases: []testerutils.TestCase{ + TestCases: []tester_definition.TestCase{ { Slug: "init", TestFunc: testInit,