From 9d5889b322e139087c932e9a815048b12f09f850 Mon Sep 17 00:00:00 2001 From: Ryan Gang Date: Mon, 29 Apr 2024 16:43:35 +0530 Subject: [PATCH 1/2] chores[deps]: tester-utils 0.2.20 upgrade --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 96d5fad..b59e043 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.18 +require github.com/codecrafters-io/tester-utils v0.2.20 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.18.0 // indirect + golang.org/x/sys v0.19.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 c620d0d..970e5b3 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,8 @@ github.com/codecrafters-io/tester-utils v0.2.17 h1:rO04TuOME773cZE729kIVOiXpZSq5 github.com/codecrafters-io/tester-utils v0.2.17/go.mod h1:BeSLyqBpFxUwIm41QlnuRG7ZsabBXWE2Ga3LMFUXAPM= github.com/codecrafters-io/tester-utils v0.2.18 h1:fjIWERlzR1700Mogr8+30H3bYyLY+36KMU8ojloo3/0= github.com/codecrafters-io/tester-utils v0.2.18/go.mod h1:BeSLyqBpFxUwIm41QlnuRG7ZsabBXWE2Ga3LMFUXAPM= +github.com/codecrafters-io/tester-utils v0.2.20 h1:t/IFFXOrSgRIoq6x4kUnRdjuai7EcwWH42Za25hvneA= +github.com/codecrafters-io/tester-utils v0.2.20/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= @@ -37,6 +39,8 @@ 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= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.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 8e0c047a115701bd98ffb7b4596f8fdf79ce7de4 Mon Sep 17 00:00:00 2001 From: Ryan Gang Date: Mon, 29 Apr 2024 17:02:36 +0530 Subject: [PATCH 2/2] test: update fixtures --- .../test_helpers/fixtures/alternation/success | 184 ++++---- .../fixtures/backreferences_multiple/success | 324 +++++++------- .../fixtures/backreferences_nested/success | 402 +++++++++--------- .../fixtures/backreferences_single/success | 246 +++++------ .../combining_character_classes/success | 80 ++-- .../fixtures/end_of_string_anchor/success | 104 ++--- .../fixtures/match_alphanumeric/success | 28 +- .../test_helpers/fixtures/match_digit/success | 16 +- .../negative_character_groups/success | 56 +-- .../fixtures/one_or_more_quantifier/success | 122 +++--- .../positive_character_groups/success | 44 +- .../fixtures/start_of_string_anchor/success | 92 ++-- .../test_helpers/fixtures/wildcard/success | 162 +++---- .../fixtures/zero_or_one_quantifier/success | 144 +++---- 14 files changed, 1002 insertions(+), 1002 deletions(-) diff --git a/internal/test_helpers/fixtures/alternation/success b/internal/test_helpers/fixtures/alternation/success index f262c86..6b192a8 100644 --- a/internal/test_helpers/fixtures/alternation/success +++ b/internal/test_helpers/fixtures/alternation/success @@ -1,42 +1,64 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. +[stage-12] Running tests for Stage #12: alternation +[stage-12] $ echo "a cat" | ./your_grep.sh -E "a (cat|dog)" +[your_program] a cat +[stage-12] ✓ Received exit code 0. +[stage-12] $ echo "a dog" | ./your_grep.sh -E "a (cat|dog)" +[your_program] a dog +[stage-12] ✓ Received exit code 0. +[stage-12] $ echo "a cow" | ./your_grep.sh -E "a (cat|dog)" +[stage-12] ✓ Received exit code 1. +[stage-12] Test passed. -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. +[stage-11] Running tests for Stage #11: wildcard +[stage-11] $ echo "cat" | ./your_grep.sh -E "c.t" +[your_program] cat +[stage-11] ✓ Received exit code 0. +[stage-11] $ echo "cot" | ./your_grep.sh -E "c.t" +[your_program] cot +[stage-11] ✓ Received exit code 0. +[stage-11] $ echo "car" | ./your_grep.sh -E "c.t" +[stage-11] ✓ Received exit code 1. +[stage-11] Test passed. -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. +[stage-10] Running tests for Stage #10: zero_or_one_quantifier +[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" +[your_program] cat +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" +[your_program] act +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] Test passed. -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. +[stage-9] Running tests for Stage #9: one_or_more_quantifier +[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" +[your_program] caaats +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" +[your_program] cat +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" +[stage-9] ✓ Received exit code 1. +[stage-9] Test passed. -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. +[stage-8] Running tests for Stage #8: end_of_string_anchor +[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" +[your_program] cat +[stage-8] ✓ Received exit code 0. +[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" +[stage-8] ✓ Received exit code 1. +[stage-8] Test passed. + +[stage-7] Running tests for Stage #7: start_of_string_anchor +[stage-7] $ echo "log" | ./your_grep.sh -E "^log" +[your_program] log +[stage-7] ✓ Received exit code 0. +[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" +[stage-7] ✓ Received exit code 1. +[stage-7] Test passed. [stage-6] Running tests for Stage #6: combining_character_classes [stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" @@ -59,64 +81,42 @@ [stage-6] ✓ Received exit code 1. [stage-6] Test passed. -[stage-7] Running tests for Stage #7: start_of_string_anchor -[stage-7] $ echo "log" | ./your_grep.sh -E "^log" -[your_program] log -[stage-7] ✓ Received exit code 0. -[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" -[stage-7] ✓ Received exit code 1. -[stage-7] Test passed. - -[stage-8] Running tests for Stage #8: end_of_string_anchor -[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" -[your_program] cat -[stage-8] ✓ Received exit code 0. -[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" -[stage-8] ✓ Received exit code 1. -[stage-8] Test passed. +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. -[stage-9] Running tests for Stage #9: one_or_more_quantifier -[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" -[your_program] caaats -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" -[your_program] cat -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" -[stage-9] ✓ Received exit code 1. -[stage-9] Test passed. +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. -[stage-10] Running tests for Stage #10: zero_or_one_quantifier -[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" -[your_program] cat -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" -[your_program] act -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] Test passed. +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. -[stage-11] Running tests for Stage #11: wildcard -[stage-11] $ echo "cat" | ./your_grep.sh -E "c.t" -[your_program] cat -[stage-11] ✓ Received exit code 0. -[stage-11] $ echo "cot" | ./your_grep.sh -E "c.t" -[your_program] cot -[stage-11] ✓ Received exit code 0. -[stage-11] $ echo "car" | ./your_grep.sh -E "c.t" -[stage-11] ✓ Received exit code 1. -[stage-11] Test passed. +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. -[stage-12] Running tests for Stage #12: alternation -[stage-12] $ echo "a cat" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a cat -[stage-12] ✓ Received exit code 0. -[stage-12] $ echo "a dog" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a dog -[stage-12] ✓ Received exit code 0. -[stage-12] $ echo "a cow" | ./your_grep.sh -E "a (cat|dog)" -[stage-12] ✓ Received exit code 1. -[stage-12] Test passed. +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/backreferences_multiple/success b/internal/test_helpers/fixtures/backreferences_multiple/success index 0d90d2d..e6e4aeb 100644 --- a/internal/test_helpers/fixtures/backreferences_multiple/success +++ b/internal/test_helpers/fixtures/backreferences_multiple/success @@ -1,125 +1,43 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. - -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. - -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. - -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. - -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. - -[stage-6] Running tests for Stage #6: combining_character_classes -[stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" -[your_program] sally has 3 apples -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 1 orange" | ./your_grep.sh -E "\d apple" -[stage-6] ✓ Received exit code 1. -[stage-6] $ echo "sally has 124 apples" | ./your_grep.sh -E "\d\d\d apples" -[your_program] sally has 124 apples -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 12 apples" | ./your_grep.sh -E "\d\\d\\d apples" -[stage-6] ✓ Received exit code 1. -[stage-6] $ echo "sally has 3 dogs" | ./your_grep.sh -E "\d \w\w\ws" -[your_program] sally has 3 dogs -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 4 dogs" | ./your_grep.sh -E "\d \w\w\ws" -[your_program] sally has 4 dogs -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 1 dog" | ./your_grep.sh -E "\d \w\w\ws" -[stage-6] ✓ Received exit code 1. -[stage-6] Test passed. - -[stage-7] Running tests for Stage #7: start_of_string_anchor -[stage-7] $ echo "log" | ./your_grep.sh -E "^log" -[your_program] log -[stage-7] ✓ Received exit code 0. -[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" -[stage-7] ✓ Received exit code 1. -[stage-7] Test passed. - -[stage-8] Running tests for Stage #8: end_of_string_anchor -[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" -[your_program] cat -[stage-8] ✓ Received exit code 0. -[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" -[stage-8] ✓ Received exit code 1. -[stage-8] Test passed. - -[stage-9] Running tests for Stage #9: one_or_more_quantifier -[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" -[your_program] caaats -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" -[your_program] cat -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" -[stage-9] ✓ Received exit code 1. -[stage-9] Test passed. - -[stage-10] Running tests for Stage #10: zero_or_one_quantifier -[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" -[your_program] cat -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" -[your_program] act -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] Test passed. - -[stage-11] Running tests for Stage #11: wildcard -[stage-11] $ echo "cat" | ./your_grep.sh -E "c.t" -[your_program] cat -[stage-11] ✓ Received exit code 0. -[stage-11] $ echo "cot" | ./your_grep.sh -E "c.t" -[your_program] cot -[stage-11] ✓ Received exit code 0. -[stage-11] $ echo "car" | ./your_grep.sh -E "c.t" -[stage-11] ✓ Received exit code 1. -[stage-11] Test passed. - -[stage-12] Running tests for Stage #12: alternation -[stage-12] $ echo "a cat" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a cat -[stage-12] ✓ Received exit code 0. -[stage-12] $ echo "a dog" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a dog -[stage-12] ✓ Received exit code 0. -[stage-12] $ echo "a cow" | ./your_grep.sh -E "a (cat|dog)" -[stage-12] ✓ Received exit code 1. -[stage-12] Test passed. +[stage-14] Running tests for Stage #14: backreferences-multiple +[stage-14] $ echo "3 red squares and 3 red circles" | ./your_grep.sh -E "(\d+) (\w+) squares and \1 \2 circles" +[your_program] 3 red squares and 3 red circles +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "3 red squares and 4 red circles" | ./your_grep.sh -E "(\d+) (\w+) squares and \1 \2 circles" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "grep 101 is doing grep 101 times" | ./your_grep.sh -E "(\w\w\w\w) (\d\d\d) is doing \1 \2 times" +[your_program] grep 101 is doing grep 101 times +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "$?! 101 is doing $?! 101 times" | ./your_grep.sh -E "(\w\w\w) (\d\d\d) is doing \1 \2 times" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "grep yes is doing grep yes times" | ./your_grep.sh -E "(\w\w\w\w) (\d\d\d) is doing \1 \2 times" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "abc-def is abc-def, not efg" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" +[your_program] abc-def is abc-def, not efg +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "efg-hij is efg-hij, not efg" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "abc-def is abc-def, not xyz" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "apple pie, apple and pie" | ./your_grep.sh -E "^(\w+) (\w+), \1 and \2$" +[your_program] apple pie, apple and pie +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "pineapple pie, pineapple and pie" | ./your_grep.sh -E "^(apple) (\w+), \1 and \2$" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "apple pie, apple and pies" | ./your_grep.sh -E "^(\w+) (pie), \1 and \2$" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "howwdy hey there, howwdy hey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" +[your_program] howwdy hey there, howwdy hey +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "hody hey there, howwdy hey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "howwdy heeey there, howwdy heeey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "cat and fish, cat with fish" | ./your_grep.sh -E "(c.t|d.g) and (f..h|b..d), \1 with \2" +[your_program] cat and fish, cat with fish +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "bat and fish, cat with fish" | ./your_grep.sh -E "(c.t|d.g) and (f..h|b..d), \1 with \2" +[stage-14] ✓ Received exit code 1. +[stage-14] Test passed. [stage-13] Running tests for Stage #13: backreferences-single [stage-13] $ echo "cat and cat" | ./your_grep.sh -E "(cat) and \1" @@ -162,43 +80,125 @@ [stage-13] ✓ Received exit code 1. [stage-13] Test passed. -[stage-14] Running tests for Stage #14: backreferences-multiple -[stage-14] $ echo "3 red squares and 3 red circles" | ./your_grep.sh -E "(\d+) (\w+) squares and \1 \2 circles" -[your_program] 3 red squares and 3 red circles -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "3 red squares and 4 red circles" | ./your_grep.sh -E "(\d+) (\w+) squares and \1 \2 circles" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "grep 101 is doing grep 101 times" | ./your_grep.sh -E "(\w\w\w\w) (\d\d\d) is doing \1 \2 times" -[your_program] grep 101 is doing grep 101 times -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "$?! 101 is doing $?! 101 times" | ./your_grep.sh -E "(\w\w\w) (\d\d\d) is doing \1 \2 times" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "grep yes is doing grep yes times" | ./your_grep.sh -E "(\w\w\w\w) (\d\d\d) is doing \1 \2 times" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "abc-def is abc-def, not efg" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" -[your_program] abc-def is abc-def, not efg -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "efg-hij is efg-hij, not efg" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "abc-def is abc-def, not xyz" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "apple pie, apple and pie" | ./your_grep.sh -E "^(\w+) (\w+), \1 and \2$" -[your_program] apple pie, apple and pie -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "pineapple pie, pineapple and pie" | ./your_grep.sh -E "^(apple) (\w+), \1 and \2$" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "apple pie, apple and pies" | ./your_grep.sh -E "^(\w+) (pie), \1 and \2$" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "howwdy hey there, howwdy hey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" -[your_program] howwdy hey there, howwdy hey -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "hody hey there, howwdy hey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "howwdy heeey there, howwdy heeey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "cat and fish, cat with fish" | ./your_grep.sh -E "(c.t|d.g) and (f..h|b..d), \1 with \2" -[your_program] cat and fish, cat with fish -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "bat and fish, cat with fish" | ./your_grep.sh -E "(c.t|d.g) and (f..h|b..d), \1 with \2" -[stage-14] ✓ Received exit code 1. -[stage-14] Test passed. +[stage-12] Running tests for Stage #12: alternation +[stage-12] $ echo "a cat" | ./your_grep.sh -E "a (cat|dog)" +[your_program] a cat +[stage-12] ✓ Received exit code 0. +[stage-12] $ echo "a dog" | ./your_grep.sh -E "a (cat|dog)" +[your_program] a dog +[stage-12] ✓ Received exit code 0. +[stage-12] $ echo "a cow" | ./your_grep.sh -E "a (cat|dog)" +[stage-12] ✓ Received exit code 1. +[stage-12] Test passed. + +[stage-11] Running tests for Stage #11: wildcard +[stage-11] $ echo "cat" | ./your_grep.sh -E "c.t" +[your_program] cat +[stage-11] ✓ Received exit code 0. +[stage-11] $ echo "cot" | ./your_grep.sh -E "c.t" +[your_program] cot +[stage-11] ✓ Received exit code 0. +[stage-11] $ echo "car" | ./your_grep.sh -E "c.t" +[stage-11] ✓ Received exit code 1. +[stage-11] Test passed. + +[stage-10] Running tests for Stage #10: zero_or_one_quantifier +[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" +[your_program] cat +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" +[your_program] act +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] Test passed. + +[stage-9] Running tests for Stage #9: one_or_more_quantifier +[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" +[your_program] caaats +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" +[your_program] cat +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" +[stage-9] ✓ Received exit code 1. +[stage-9] Test passed. + +[stage-8] Running tests for Stage #8: end_of_string_anchor +[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" +[your_program] cat +[stage-8] ✓ Received exit code 0. +[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" +[stage-8] ✓ Received exit code 1. +[stage-8] Test passed. + +[stage-7] Running tests for Stage #7: start_of_string_anchor +[stage-7] $ echo "log" | ./your_grep.sh -E "^log" +[your_program] log +[stage-7] ✓ Received exit code 0. +[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" +[stage-7] ✓ Received exit code 1. +[stage-7] Test passed. + +[stage-6] Running tests for Stage #6: combining_character_classes +[stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" +[your_program] sally has 3 apples +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 1 orange" | ./your_grep.sh -E "\d apple" +[stage-6] ✓ Received exit code 1. +[stage-6] $ echo "sally has 124 apples" | ./your_grep.sh -E "\d\d\d apples" +[your_program] sally has 124 apples +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 12 apples" | ./your_grep.sh -E "\d\\d\\d apples" +[stage-6] ✓ Received exit code 1. +[stage-6] $ echo "sally has 3 dogs" | ./your_grep.sh -E "\d \w\w\ws" +[your_program] sally has 3 dogs +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 4 dogs" | ./your_grep.sh -E "\d \w\w\ws" +[your_program] sally has 4 dogs +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 1 dog" | ./your_grep.sh -E "\d \w\w\ws" +[stage-6] ✓ Received exit code 1. +[stage-6] Test passed. + +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. + +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. + +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. + +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. + +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/backreferences_nested/success b/internal/test_helpers/fixtures/backreferences_nested/success index 6e8274c..8c7c2f0 100644 --- a/internal/test_helpers/fixtures/backreferences_nested/success +++ b/internal/test_helpers/fixtures/backreferences_nested/success @@ -1,125 +1,84 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. - -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. - -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. - -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. - -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. - -[stage-6] Running tests for Stage #6: combining_character_classes -[stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" -[your_program] sally has 3 apples -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 1 orange" | ./your_grep.sh -E "\d apple" -[stage-6] ✓ Received exit code 1. -[stage-6] $ echo "sally has 124 apples" | ./your_grep.sh -E "\d\d\d apples" -[your_program] sally has 124 apples -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 12 apples" | ./your_grep.sh -E "\d\\d\\d apples" -[stage-6] ✓ Received exit code 1. -[stage-6] $ echo "sally has 3 dogs" | ./your_grep.sh -E "\d \w\w\ws" -[your_program] sally has 3 dogs -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 4 dogs" | ./your_grep.sh -E "\d \w\w\ws" -[your_program] sally has 4 dogs -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 1 dog" | ./your_grep.sh -E "\d \w\w\ws" -[stage-6] ✓ Received exit code 1. -[stage-6] Test passed. - -[stage-7] Running tests for Stage #7: start_of_string_anchor -[stage-7] $ echo "log" | ./your_grep.sh -E "^log" -[your_program] log -[stage-7] ✓ Received exit code 0. -[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" -[stage-7] ✓ Received exit code 1. -[stage-7] Test passed. - -[stage-8] Running tests for Stage #8: end_of_string_anchor -[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" -[your_program] cat -[stage-8] ✓ Received exit code 0. -[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" -[stage-8] ✓ Received exit code 1. -[stage-8] Test passed. - -[stage-9] Running tests for Stage #9: one_or_more_quantifier -[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" -[your_program] caaats -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" -[your_program] cat -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" -[stage-9] ✓ Received exit code 1. -[stage-9] Test passed. - -[stage-10] Running tests for Stage #10: zero_or_one_quantifier -[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" -[your_program] cat -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" -[your_program] act -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] Test passed. - -[stage-11] Running tests for Stage #11: wildcard -[stage-11] $ echo "cat" | ./your_grep.sh -E "c.t" -[your_program] cat -[stage-11] ✓ Received exit code 0. -[stage-11] $ echo "cot" | ./your_grep.sh -E "c.t" -[your_program] cot -[stage-11] ✓ Received exit code 0. -[stage-11] $ echo "car" | ./your_grep.sh -E "c.t" -[stage-11] ✓ Received exit code 1. -[stage-11] Test passed. +[stage-15] Running tests for Stage #15: backreferences-nested +[stage-15] $ echo "'cat and cat' is the same as 'cat and cat'" | ./your_grep.sh -E "('(cat) and \2') is the same as \1" +[your_program] 'cat and cat' is the same as 'cat and cat' +[stage-15] ✓ Received exit code 0. +[stage-15] $ echo "'cat and cat' is the same as 'cat and dog'" | ./your_grep.sh -E "('(cat) and \2') is the same as \1" +[stage-15] ✓ Received exit code 1. +[stage-15] $ echo "grep 101 is doing grep 101 times, and again grep 101 times" | ./your_grep.sh -E "((\w\w\w\w) (\d\d\d)) is doing \2 \3 times, and again \1 times" +[your_program] grep 101 is doing grep 101 times, and again grep 101 times +[stage-15] ✓ Received exit code 0. +[stage-15] $ echo "$?! 101 is doing $?! 101 times, and again $?! 101 times" | ./your_grep.sh -E "((\w\w\w) (\d\d\d)) is doing \2 \3 times, and again \1 times" +[stage-15] ✓ Received exit code 1. +[stage-15] $ echo "grep yes is doing grep yes times, and again grep yes times" | ./your_grep.sh -E "((\w\w\w\w) (\d\d\d)) is doing \2 \3 times, and again \1 times" +[stage-15] ✓ Received exit code 1. +[stage-15] $ echo "abc-def is abc-def, not efg, abc, or def" | ./your_grep.sh -E "(([abc]+)-([def]+)) is \1, not ([^xyz]+), \2, or \3" +[your_program] abc-def is abc-def, not efg, abc, or def +[stage-15] ✓ Received exit code 0. +[stage-15] $ echo "efg-hij is efg-hij, not klm, efg, or hij" | ./your_grep.sh -E "(([abc]+)-([def]+)) is \1, not ([^xyz]+), \2, or \3" +[stage-15] ✓ Received exit code 1. +[stage-15] $ echo "abc-def is abc-def, not xyz, abc, or def" | ./your_grep.sh -E "(([abc]+)-([def]+)) is \1, not ([^xyz]+), \2, or \3" +[stage-15] ✓ Received exit code 1. +[stage-15] $ echo "apple pie is made of apple and pie. love apple pie" | ./your_grep.sh -E "^((\w+) (\w+)) is made of \2 and \3. love \1$" +[your_program] apple pie is made of apple and pie. love apple pie +[stage-15] ✓ Received exit code 0. +[stage-15] $ echo "pineapple pie is made of apple and pie. love apple pie" | ./your_grep.sh -E "^((apple) (\w+)) is made of \2 and \3. love \1$" +[stage-15] ✓ Received exit code 1. +[stage-15] $ echo "apple pie is made of apple and pie. love apple pies" | ./your_grep.sh -E "^((\w+) (pie)) is made of \2 and \3. love \1$" +[stage-15] ✓ Received exit code 1. +[stage-15] $ echo "'howwdy hey there' is made up of 'howwdy' and 'hey'. howwdy hey there" | ./your_grep.sh -E "'((how+dy) (he?y) there)' is made up of '\2' and '\3'. \1" +[your_program] 'howwdy hey there' is made up of 'howwdy' and 'hey'. howwdy hey there +[stage-15] ✓ Received exit code 0. +[stage-15] $ echo "'hody hey there' is made up of 'hody' and 'hey'. hody hey there" | ./your_grep.sh -E "'((how+dy) (he?y) there)' is made up of '\2' and '\3'. \1" +[stage-15] ✓ Received exit code 1. +[stage-15] $ echo "'howwdy heeey there' is made up of 'howwdy' and 'heeey'. howwdy heeey there" | ./your_grep.sh -E "'((how+dy) (he?y) there)' is made up of '\2' and '\3'. \1" +[stage-15] ✓ Received exit code 1. +[stage-15] $ echo "cat and fish, cat with fish, cat and fish" | ./your_grep.sh -E "((c.t|d.g) and (f..h|b..d)), \2 with \3, \1" +[your_program] cat and fish, cat with fish, cat and fish +[stage-15] ✓ Received exit code 0. +[stage-15] $ echo "bat and fish, bat with fish, bat and fish" | ./your_grep.sh -E "((c.t|d.g) and (f..h|b..d)), \2 with \3, \1" +[stage-15] ✓ Received exit code 1. +[stage-15] Test passed. -[stage-12] Running tests for Stage #12: alternation -[stage-12] $ echo "a cat" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a cat -[stage-12] ✓ Received exit code 0. -[stage-12] $ echo "a dog" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a dog -[stage-12] ✓ Received exit code 0. -[stage-12] $ echo "a cow" | ./your_grep.sh -E "a (cat|dog)" -[stage-12] ✓ Received exit code 1. -[stage-12] Test passed. +[stage-14] Running tests for Stage #14: backreferences-multiple +[stage-14] $ echo "3 red squares and 3 red circles" | ./your_grep.sh -E "(\d+) (\w+) squares and \1 \2 circles" +[your_program] 3 red squares and 3 red circles +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "3 red squares and 4 red circles" | ./your_grep.sh -E "(\d+) (\w+) squares and \1 \2 circles" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "grep 101 is doing grep 101 times" | ./your_grep.sh -E "(\w\w\w\w) (\d\d\d) is doing \1 \2 times" +[your_program] grep 101 is doing grep 101 times +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "$?! 101 is doing $?! 101 times" | ./your_grep.sh -E "(\w\w\w) (\d\d\d) is doing \1 \2 times" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "grep yes is doing grep yes times" | ./your_grep.sh -E "(\w\w\w\w) (\d\d\d) is doing \1 \2 times" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "abc-def is abc-def, not efg" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" +[your_program] abc-def is abc-def, not efg +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "efg-hij is efg-hij, not efg" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "abc-def is abc-def, not xyz" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "apple pie, apple and pie" | ./your_grep.sh -E "^(\w+) (\w+), \1 and \2$" +[your_program] apple pie, apple and pie +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "pineapple pie, pineapple and pie" | ./your_grep.sh -E "^(apple) (\w+), \1 and \2$" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "apple pie, apple and pies" | ./your_grep.sh -E "^(\w+) (pie), \1 and \2$" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "howwdy hey there, howwdy hey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" +[your_program] howwdy hey there, howwdy hey +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "hody hey there, howwdy hey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "howwdy heeey there, howwdy heeey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" +[stage-14] ✓ Received exit code 1. +[stage-14] $ echo "cat and fish, cat with fish" | ./your_grep.sh -E "(c.t|d.g) and (f..h|b..d), \1 with \2" +[your_program] cat and fish, cat with fish +[stage-14] ✓ Received exit code 0. +[stage-14] $ echo "bat and fish, cat with fish" | ./your_grep.sh -E "(c.t|d.g) and (f..h|b..d), \1 with \2" +[stage-14] ✓ Received exit code 1. +[stage-14] Test passed. [stage-13] Running tests for Stage #13: backreferences-single [stage-13] $ echo "cat and cat" | ./your_grep.sh -E "(cat) and \1" @@ -162,84 +121,125 @@ [stage-13] ✓ Received exit code 1. [stage-13] Test passed. -[stage-14] Running tests for Stage #14: backreferences-multiple -[stage-14] $ echo "3 red squares and 3 red circles" | ./your_grep.sh -E "(\d+) (\w+) squares and \1 \2 circles" -[your_program] 3 red squares and 3 red circles -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "3 red squares and 4 red circles" | ./your_grep.sh -E "(\d+) (\w+) squares and \1 \2 circles" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "grep 101 is doing grep 101 times" | ./your_grep.sh -E "(\w\w\w\w) (\d\d\d) is doing \1 \2 times" -[your_program] grep 101 is doing grep 101 times -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "$?! 101 is doing $?! 101 times" | ./your_grep.sh -E "(\w\w\w) (\d\d\d) is doing \1 \2 times" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "grep yes is doing grep yes times" | ./your_grep.sh -E "(\w\w\w\w) (\d\d\d) is doing \1 \2 times" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "abc-def is abc-def, not efg" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" -[your_program] abc-def is abc-def, not efg -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "efg-hij is efg-hij, not efg" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "abc-def is abc-def, not xyz" | ./your_grep.sh -E "([abc]+)-([def]+) is \1-\2, not [^xyz]+" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "apple pie, apple and pie" | ./your_grep.sh -E "^(\w+) (\w+), \1 and \2$" -[your_program] apple pie, apple and pie -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "pineapple pie, pineapple and pie" | ./your_grep.sh -E "^(apple) (\w+), \1 and \2$" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "apple pie, apple and pies" | ./your_grep.sh -E "^(\w+) (pie), \1 and \2$" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "howwdy hey there, howwdy hey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" -[your_program] howwdy hey there, howwdy hey -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "hody hey there, howwdy hey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "howwdy heeey there, howwdy heeey" | ./your_grep.sh -E "(how+dy) (he?y) there, \1 \2" -[stage-14] ✓ Received exit code 1. -[stage-14] $ echo "cat and fish, cat with fish" | ./your_grep.sh -E "(c.t|d.g) and (f..h|b..d), \1 with \2" -[your_program] cat and fish, cat with fish -[stage-14] ✓ Received exit code 0. -[stage-14] $ echo "bat and fish, cat with fish" | ./your_grep.sh -E "(c.t|d.g) and (f..h|b..d), \1 with \2" -[stage-14] ✓ Received exit code 1. -[stage-14] Test passed. +[stage-12] Running tests for Stage #12: alternation +[stage-12] $ echo "a cat" | ./your_grep.sh -E "a (cat|dog)" +[your_program] a cat +[stage-12] ✓ Received exit code 0. +[stage-12] $ echo "a dog" | ./your_grep.sh -E "a (cat|dog)" +[your_program] a dog +[stage-12] ✓ Received exit code 0. +[stage-12] $ echo "a cow" | ./your_grep.sh -E "a (cat|dog)" +[stage-12] ✓ Received exit code 1. +[stage-12] Test passed. -[stage-15] Running tests for Stage #15: backreferences-nested -[stage-15] $ echo "'cat and cat' is the same as 'cat and cat'" | ./your_grep.sh -E "('(cat) and \2') is the same as \1" -[your_program] 'cat and cat' is the same as 'cat and cat' -[stage-15] ✓ Received exit code 0. -[stage-15] $ echo "'cat and cat' is the same as 'cat and dog'" | ./your_grep.sh -E "('(cat) and \2') is the same as \1" -[stage-15] ✓ Received exit code 1. -[stage-15] $ echo "grep 101 is doing grep 101 times, and again grep 101 times" | ./your_grep.sh -E "((\w\w\w\w) (\d\d\d)) is doing \2 \3 times, and again \1 times" -[your_program] grep 101 is doing grep 101 times, and again grep 101 times -[stage-15] ✓ Received exit code 0. -[stage-15] $ echo "$?! 101 is doing $?! 101 times, and again $?! 101 times" | ./your_grep.sh -E "((\w\w\w) (\d\d\d)) is doing \2 \3 times, and again \1 times" -[stage-15] ✓ Received exit code 1. -[stage-15] $ echo "grep yes is doing grep yes times, and again grep yes times" | ./your_grep.sh -E "((\w\w\w\w) (\d\d\d)) is doing \2 \3 times, and again \1 times" -[stage-15] ✓ Received exit code 1. -[stage-15] $ echo "abc-def is abc-def, not efg, abc, or def" | ./your_grep.sh -E "(([abc]+)-([def]+)) is \1, not ([^xyz]+), \2, or \3" -[your_program] abc-def is abc-def, not efg, abc, or def -[stage-15] ✓ Received exit code 0. -[stage-15] $ echo "efg-hij is efg-hij, not klm, efg, or hij" | ./your_grep.sh -E "(([abc]+)-([def]+)) is \1, not ([^xyz]+), \2, or \3" -[stage-15] ✓ Received exit code 1. -[stage-15] $ echo "abc-def is abc-def, not xyz, abc, or def" | ./your_grep.sh -E "(([abc]+)-([def]+)) is \1, not ([^xyz]+), \2, or \3" -[stage-15] ✓ Received exit code 1. -[stage-15] $ echo "apple pie is made of apple and pie. love apple pie" | ./your_grep.sh -E "^((\w+) (\w+)) is made of \2 and \3. love \1$" -[your_program] apple pie is made of apple and pie. love apple pie -[stage-15] ✓ Received exit code 0. -[stage-15] $ echo "pineapple pie is made of apple and pie. love apple pie" | ./your_grep.sh -E "^((apple) (\w+)) is made of \2 and \3. love \1$" -[stage-15] ✓ Received exit code 1. -[stage-15] $ echo "apple pie is made of apple and pie. love apple pies" | ./your_grep.sh -E "^((\w+) (pie)) is made of \2 and \3. love \1$" -[stage-15] ✓ Received exit code 1. -[stage-15] $ echo "'howwdy hey there' is made up of 'howwdy' and 'hey'. howwdy hey there" | ./your_grep.sh -E "'((how+dy) (he?y) there)' is made up of '\2' and '\3'. \1" -[your_program] 'howwdy hey there' is made up of 'howwdy' and 'hey'. howwdy hey there -[stage-15] ✓ Received exit code 0. -[stage-15] $ echo "'hody hey there' is made up of 'hody' and 'hey'. hody hey there" | ./your_grep.sh -E "'((how+dy) (he?y) there)' is made up of '\2' and '\3'. \1" -[stage-15] ✓ Received exit code 1. -[stage-15] $ echo "'howwdy heeey there' is made up of 'howwdy' and 'heeey'. howwdy heeey there" | ./your_grep.sh -E "'((how+dy) (he?y) there)' is made up of '\2' and '\3'. \1" -[stage-15] ✓ Received exit code 1. -[stage-15] $ echo "cat and fish, cat with fish, cat and fish" | ./your_grep.sh -E "((c.t|d.g) and (f..h|b..d)), \2 with \3, \1" -[your_program] cat and fish, cat with fish, cat and fish -[stage-15] ✓ Received exit code 0. -[stage-15] $ echo "bat and fish, bat with fish, bat and fish" | ./your_grep.sh -E "((c.t|d.g) and (f..h|b..d)), \2 with \3, \1" -[stage-15] ✓ Received exit code 1. -[stage-15] Test passed. +[stage-11] Running tests for Stage #11: wildcard +[stage-11] $ echo "cat" | ./your_grep.sh -E "c.t" +[your_program] cat +[stage-11] ✓ Received exit code 0. +[stage-11] $ echo "cot" | ./your_grep.sh -E "c.t" +[your_program] cot +[stage-11] ✓ Received exit code 0. +[stage-11] $ echo "car" | ./your_grep.sh -E "c.t" +[stage-11] ✓ Received exit code 1. +[stage-11] Test passed. + +[stage-10] Running tests for Stage #10: zero_or_one_quantifier +[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" +[your_program] cat +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" +[your_program] act +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] Test passed. + +[stage-9] Running tests for Stage #9: one_or_more_quantifier +[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" +[your_program] caaats +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" +[your_program] cat +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" +[stage-9] ✓ Received exit code 1. +[stage-9] Test passed. + +[stage-8] Running tests for Stage #8: end_of_string_anchor +[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" +[your_program] cat +[stage-8] ✓ Received exit code 0. +[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" +[stage-8] ✓ Received exit code 1. +[stage-8] Test passed. + +[stage-7] Running tests for Stage #7: start_of_string_anchor +[stage-7] $ echo "log" | ./your_grep.sh -E "^log" +[your_program] log +[stage-7] ✓ Received exit code 0. +[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" +[stage-7] ✓ Received exit code 1. +[stage-7] Test passed. + +[stage-6] Running tests for Stage #6: combining_character_classes +[stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" +[your_program] sally has 3 apples +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 1 orange" | ./your_grep.sh -E "\d apple" +[stage-6] ✓ Received exit code 1. +[stage-6] $ echo "sally has 124 apples" | ./your_grep.sh -E "\d\d\d apples" +[your_program] sally has 124 apples +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 12 apples" | ./your_grep.sh -E "\d\\d\\d apples" +[stage-6] ✓ Received exit code 1. +[stage-6] $ echo "sally has 3 dogs" | ./your_grep.sh -E "\d \w\w\ws" +[your_program] sally has 3 dogs +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 4 dogs" | ./your_grep.sh -E "\d \w\w\ws" +[your_program] sally has 4 dogs +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 1 dog" | ./your_grep.sh -E "\d \w\w\ws" +[stage-6] ✓ Received exit code 1. +[stage-6] Test passed. + +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. + +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. + +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. + +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. + +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/backreferences_single/success b/internal/test_helpers/fixtures/backreferences_single/success index 6007ed0..6ca28b8 100644 --- a/internal/test_helpers/fixtures/backreferences_single/success +++ b/internal/test_helpers/fixtures/backreferences_single/success @@ -1,126 +1,3 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. - -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. - -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. - -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. - -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. - -[stage-6] Running tests for Stage #6: combining_character_classes -[stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" -[your_program] sally has 3 apples -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 1 orange" | ./your_grep.sh -E "\d apple" -[stage-6] ✓ Received exit code 1. -[stage-6] $ echo "sally has 124 apples" | ./your_grep.sh -E "\d\d\d apples" -[your_program] sally has 124 apples -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 12 apples" | ./your_grep.sh -E "\d\\d\\d apples" -[stage-6] ✓ Received exit code 1. -[stage-6] $ echo "sally has 3 dogs" | ./your_grep.sh -E "\d \w\w\ws" -[your_program] sally has 3 dogs -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 4 dogs" | ./your_grep.sh -E "\d \w\w\ws" -[your_program] sally has 4 dogs -[stage-6] ✓ Received exit code 0. -[stage-6] $ echo "sally has 1 dog" | ./your_grep.sh -E "\d \w\w\ws" -[stage-6] ✓ Received exit code 1. -[stage-6] Test passed. - -[stage-7] Running tests for Stage #7: start_of_string_anchor -[stage-7] $ echo "log" | ./your_grep.sh -E "^log" -[your_program] log -[stage-7] ✓ Received exit code 0. -[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" -[stage-7] ✓ Received exit code 1. -[stage-7] Test passed. - -[stage-8] Running tests for Stage #8: end_of_string_anchor -[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" -[your_program] cat -[stage-8] ✓ Received exit code 0. -[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" -[stage-8] ✓ Received exit code 1. -[stage-8] Test passed. - -[stage-9] Running tests for Stage #9: one_or_more_quantifier -[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" -[your_program] caaats -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" -[your_program] cat -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" -[stage-9] ✓ Received exit code 1. -[stage-9] Test passed. - -[stage-10] Running tests for Stage #10: zero_or_one_quantifier -[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" -[your_program] cat -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" -[your_program] act -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] Test passed. - -[stage-11] Running tests for Stage #11: wildcard -[stage-11] $ echo "cat" | ./your_grep.sh -E "c.t" -[your_program] cat -[stage-11] ✓ Received exit code 0. -[stage-11] $ echo "cot" | ./your_grep.sh -E "c.t" -[your_program] cot -[stage-11] ✓ Received exit code 0. -[stage-11] $ echo "car" | ./your_grep.sh -E "c.t" -[stage-11] ✓ Received exit code 1. -[stage-11] Test passed. - -[stage-12] Running tests for Stage #12: alternation -[stage-12] $ echo "a cat" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a cat -[stage-12] ✓ Received exit code 0. -[stage-12] $ echo "a dog" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a dog -[stage-12] ✓ Received exit code 0. -[stage-12] $ echo "a cow" | ./your_grep.sh -E "a (cat|dog)" -[stage-12] ✓ Received exit code 1. -[stage-12] Test passed. - [stage-13] Running tests for Stage #13: backreferences-single [stage-13] $ echo "cat and cat" | ./your_grep.sh -E "(cat) and \1" [your_program] cat and cat @@ -161,3 +38,126 @@ [stage-13] $ echo "bugz here and bugs there" | ./your_grep.sh -E "(b..s|c..e) here and \1 there" [stage-13] ✓ Received exit code 1. [stage-13] Test passed. + +[stage-12] Running tests for Stage #12: alternation +[stage-12] $ echo "a cat" | ./your_grep.sh -E "a (cat|dog)" +[your_program] a cat +[stage-12] ✓ Received exit code 0. +[stage-12] $ echo "a dog" | ./your_grep.sh -E "a (cat|dog)" +[your_program] a dog +[stage-12] ✓ Received exit code 0. +[stage-12] $ echo "a cow" | ./your_grep.sh -E "a (cat|dog)" +[stage-12] ✓ Received exit code 1. +[stage-12] Test passed. + +[stage-11] Running tests for Stage #11: wildcard +[stage-11] $ echo "cat" | ./your_grep.sh -E "c.t" +[your_program] cat +[stage-11] ✓ Received exit code 0. +[stage-11] $ echo "cot" | ./your_grep.sh -E "c.t" +[your_program] cot +[stage-11] ✓ Received exit code 0. +[stage-11] $ echo "car" | ./your_grep.sh -E "c.t" +[stage-11] ✓ Received exit code 1. +[stage-11] Test passed. + +[stage-10] Running tests for Stage #10: zero_or_one_quantifier +[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" +[your_program] cat +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" +[your_program] act +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] Test passed. + +[stage-9] Running tests for Stage #9: one_or_more_quantifier +[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" +[your_program] caaats +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" +[your_program] cat +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" +[stage-9] ✓ Received exit code 1. +[stage-9] Test passed. + +[stage-8] Running tests for Stage #8: end_of_string_anchor +[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" +[your_program] cat +[stage-8] ✓ Received exit code 0. +[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" +[stage-8] ✓ Received exit code 1. +[stage-8] Test passed. + +[stage-7] Running tests for Stage #7: start_of_string_anchor +[stage-7] $ echo "log" | ./your_grep.sh -E "^log" +[your_program] log +[stage-7] ✓ Received exit code 0. +[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" +[stage-7] ✓ Received exit code 1. +[stage-7] Test passed. + +[stage-6] Running tests for Stage #6: combining_character_classes +[stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" +[your_program] sally has 3 apples +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 1 orange" | ./your_grep.sh -E "\d apple" +[stage-6] ✓ Received exit code 1. +[stage-6] $ echo "sally has 124 apples" | ./your_grep.sh -E "\d\d\d apples" +[your_program] sally has 124 apples +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 12 apples" | ./your_grep.sh -E "\d\\d\\d apples" +[stage-6] ✓ Received exit code 1. +[stage-6] $ echo "sally has 3 dogs" | ./your_grep.sh -E "\d \w\w\ws" +[your_program] sally has 3 dogs +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 4 dogs" | ./your_grep.sh -E "\d \w\w\ws" +[your_program] sally has 4 dogs +[stage-6] ✓ Received exit code 0. +[stage-6] $ echo "sally has 1 dog" | ./your_grep.sh -E "\d \w\w\ws" +[stage-6] ✓ Received exit code 1. +[stage-6] Test passed. + +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. + +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. + +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. + +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. + +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/combining_character_classes/success b/internal/test_helpers/fixtures/combining_character_classes/success index d3081c2..cbd83fa 100644 --- a/internal/test_helpers/fixtures/combining_character_classes/success +++ b/internal/test_helpers/fixtures/combining_character_classes/success @@ -1,43 +1,3 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. - -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. - -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. - -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. - -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. - [stage-6] Running tests for Stage #6: combining_character_classes [stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" [your_program] sally has 3 apples @@ -58,3 +18,43 @@ [stage-6] $ echo "sally has 1 dog" | ./your_grep.sh -E "\d \w\w\ws" [stage-6] ✓ Received exit code 1. [stage-6] Test passed. + +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. + +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. + +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. + +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. + +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/end_of_string_anchor/success b/internal/test_helpers/fixtures/end_of_string_anchor/success index 70a14d2..b478142 100644 --- a/internal/test_helpers/fixtures/end_of_string_anchor/success +++ b/internal/test_helpers/fixtures/end_of_string_anchor/success @@ -1,42 +1,18 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. - -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. - -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. - -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. +[stage-8] Running tests for Stage #8: end_of_string_anchor +[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" +[your_program] cat +[stage-8] ✓ Received exit code 0. +[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" +[stage-8] ✓ Received exit code 1. +[stage-8] Test passed. -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. +[stage-7] Running tests for Stage #7: start_of_string_anchor +[stage-7] $ echo "log" | ./your_grep.sh -E "^log" +[your_program] log +[stage-7] ✓ Received exit code 0. +[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" +[stage-7] ✓ Received exit code 1. +[stage-7] Test passed. [stage-6] Running tests for Stage #6: combining_character_classes [stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" @@ -59,18 +35,42 @@ [stage-6] ✓ Received exit code 1. [stage-6] Test passed. -[stage-7] Running tests for Stage #7: start_of_string_anchor -[stage-7] $ echo "log" | ./your_grep.sh -E "^log" -[your_program] log -[stage-7] ✓ Received exit code 0. -[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" -[stage-7] ✓ Received exit code 1. -[stage-7] Test passed. +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. -[stage-8] Running tests for Stage #8: end_of_string_anchor -[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" -[your_program] cat -[stage-8] ✓ Received exit code 0. -[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" -[stage-8] ✓ Received exit code 1. -[stage-8] Test passed. +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. + +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. + +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. + +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/match_alphanumeric/success b/internal/test_helpers/fixtures/match_alphanumeric/success index 3f2309c..e259db8 100644 --- a/internal/test_helpers/fixtures/match_alphanumeric/success +++ b/internal/test_helpers/fixtures/match_alphanumeric/success @@ -1,10 +1,10 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. [stage-2] Running tests for Stage #2: match_digit [stage-2] $ echo "123" | ./your_grep.sh -E "\d" @@ -14,10 +14,10 @@ [stage-2] ✓ Received exit code 1. [stage-2] Test passed. -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/match_digit/success b/internal/test_helpers/fixtures/match_digit/success index 3bf2ae0..e419bc9 100644 --- a/internal/test_helpers/fixtures/match_digit/success +++ b/internal/test_helpers/fixtures/match_digit/success @@ -1,11 +1,3 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. - [stage-2] Running tests for Stage #2: match_digit [stage-2] $ echo "123" | ./your_grep.sh -E "\d" [your_program] 123 @@ -13,3 +5,11 @@ [stage-2] $ echo "apple" | ./your_grep.sh -E "\d" [stage-2] ✓ Received exit code 1. [stage-2] Test passed. + +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/negative_character_groups/success b/internal/test_helpers/fixtures/negative_character_groups/success index 15f36c1..79015d6 100644 --- a/internal/test_helpers/fixtures/negative_character_groups/success +++ b/internal/test_helpers/fixtures/negative_character_groups/success @@ -1,18 +1,18 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. [stage-3] Running tests for Stage #3: match_alphanumeric [stage-3] $ echo "word" | ./your_grep.sh -E "\w" @@ -22,18 +22,18 @@ [stage-3] ✓ Received exit code 1. [stage-3] Test passed. -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/one_or_more_quantifier/success b/internal/test_helpers/fixtures/one_or_more_quantifier/success index 6a6be5c..9d142e1 100644 --- a/internal/test_helpers/fixtures/one_or_more_quantifier/success +++ b/internal/test_helpers/fixtures/one_or_more_quantifier/success @@ -1,42 +1,29 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. - -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. - -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. +[stage-9] Running tests for Stage #9: one_or_more_quantifier +[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" +[your_program] caaats +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" +[your_program] cat +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" +[stage-9] ✓ Received exit code 1. +[stage-9] Test passed. -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. +[stage-8] Running tests for Stage #8: end_of_string_anchor +[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" +[your_program] cat +[stage-8] ✓ Received exit code 0. +[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" +[stage-8] ✓ Received exit code 1. +[stage-8] Test passed. -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. +[stage-7] Running tests for Stage #7: start_of_string_anchor +[stage-7] $ echo "log" | ./your_grep.sh -E "^log" +[your_program] log +[stage-7] ✓ Received exit code 0. +[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" +[stage-7] ✓ Received exit code 1. +[stage-7] Test passed. [stage-6] Running tests for Stage #6: combining_character_classes [stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" @@ -59,29 +46,42 @@ [stage-6] ✓ Received exit code 1. [stage-6] Test passed. -[stage-7] Running tests for Stage #7: start_of_string_anchor -[stage-7] $ echo "log" | ./your_grep.sh -E "^log" -[your_program] log -[stage-7] ✓ Received exit code 0. -[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" -[stage-7] ✓ Received exit code 1. -[stage-7] Test passed. +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. -[stage-8] Running tests for Stage #8: end_of_string_anchor -[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" -[your_program] cat -[stage-8] ✓ Received exit code 0. -[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" -[stage-8] ✓ Received exit code 1. -[stage-8] Test passed. +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. -[stage-9] Running tests for Stage #9: one_or_more_quantifier -[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" -[your_program] caaats -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" -[your_program] cat -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" -[stage-9] ✓ Received exit code 1. -[stage-9] Test passed. +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. + +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. + +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/positive_character_groups/success b/internal/test_helpers/fixtures/positive_character_groups/success index d387fb7..853993a 100644 --- a/internal/test_helpers/fixtures/positive_character_groups/success +++ b/internal/test_helpers/fixtures/positive_character_groups/success @@ -1,18 +1,10 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. - -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. [stage-3] Running tests for Stage #3: match_alphanumeric [stage-3] $ echo "word" | ./your_grep.sh -E "\w" @@ -22,10 +14,18 @@ [stage-3] ✓ Received exit code 1. [stage-3] Test passed. -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. + +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/start_of_string_anchor/success b/internal/test_helpers/fixtures/start_of_string_anchor/success index 8401ba3..21a72fb 100644 --- a/internal/test_helpers/fixtures/start_of_string_anchor/success +++ b/internal/test_helpers/fixtures/start_of_string_anchor/success @@ -1,42 +1,10 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. - -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. - -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. - -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. - -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. +[stage-7] Running tests for Stage #7: start_of_string_anchor +[stage-7] $ echo "log" | ./your_grep.sh -E "^log" +[your_program] log +[stage-7] ✓ Received exit code 0. +[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" +[stage-7] ✓ Received exit code 1. +[stage-7] Test passed. [stage-6] Running tests for Stage #6: combining_character_classes [stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" @@ -59,10 +27,42 @@ [stage-6] ✓ Received exit code 1. [stage-6] Test passed. -[stage-7] Running tests for Stage #7: start_of_string_anchor -[stage-7] $ echo "log" | ./your_grep.sh -E "^log" -[your_program] log -[stage-7] ✓ Received exit code 0. -[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" -[stage-7] ✓ Received exit code 1. -[stage-7] Test passed. +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. + +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. + +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. + +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. + +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/wildcard/success b/internal/test_helpers/fixtures/wildcard/success index 04fc38f..da151bf 100644 --- a/internal/test_helpers/fixtures/wildcard/success +++ b/internal/test_helpers/fixtures/wildcard/success @@ -1,42 +1,53 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. +[stage-11] Running tests for Stage #11: wildcard +[stage-11] $ echo "cat" | ./your_grep.sh -E "c.t" +[your_program] cat +[stage-11] ✓ Received exit code 0. +[stage-11] $ echo "cot" | ./your_grep.sh -E "c.t" +[your_program] cot +[stage-11] ✓ Received exit code 0. +[stage-11] $ echo "car" | ./your_grep.sh -E "c.t" +[stage-11] ✓ Received exit code 1. +[stage-11] Test passed. -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. +[stage-10] Running tests for Stage #10: zero_or_one_quantifier +[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" +[your_program] cat +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" +[your_program] act +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] Test passed. -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. +[stage-9] Running tests for Stage #9: one_or_more_quantifier +[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" +[your_program] caaats +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" +[your_program] cat +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" +[stage-9] ✓ Received exit code 1. +[stage-9] Test passed. -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. +[stage-8] Running tests for Stage #8: end_of_string_anchor +[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" +[your_program] cat +[stage-8] ✓ Received exit code 0. +[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" +[stage-8] ✓ Received exit code 1. +[stage-8] Test passed. -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. +[stage-7] Running tests for Stage #7: start_of_string_anchor +[stage-7] $ echo "log" | ./your_grep.sh -E "^log" +[your_program] log +[stage-7] ✓ Received exit code 0. +[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" +[stage-7] ✓ Received exit code 1. +[stage-7] Test passed. [stage-6] Running tests for Stage #6: combining_character_classes [stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" @@ -59,53 +70,42 @@ [stage-6] ✓ Received exit code 1. [stage-6] Test passed. -[stage-7] Running tests for Stage #7: start_of_string_anchor -[stage-7] $ echo "log" | ./your_grep.sh -E "^log" -[your_program] log -[stage-7] ✓ Received exit code 0. -[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" -[stage-7] ✓ Received exit code 1. -[stage-7] Test passed. +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. -[stage-8] Running tests for Stage #8: end_of_string_anchor -[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" -[your_program] cat -[stage-8] ✓ Received exit code 0. -[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" -[stage-8] ✓ Received exit code 1. -[stage-8] Test passed. +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. -[stage-9] Running tests for Stage #9: one_or_more_quantifier -[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" -[your_program] caaats -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" -[your_program] cat -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" -[stage-9] ✓ Received exit code 1. -[stage-9] Test passed. +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. -[stage-10] Running tests for Stage #10: zero_or_one_quantifier -[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" -[your_program] cat -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" -[your_program] act -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] Test passed. +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. -[stage-11] Running tests for Stage #11: wildcard -[stage-11] $ echo "cat" | ./your_grep.sh -E "c.t" -[your_program] cat -[stage-11] ✓ Received exit code 0. -[stage-11] $ echo "cot" | ./your_grep.sh -E "c.t" -[your_program] cot -[stage-11] ✓ Received exit code 0. -[stage-11] $ echo "car" | ./your_grep.sh -E "c.t" -[stage-11] ✓ Received exit code 1. -[stage-11] Test passed. +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/zero_or_one_quantifier/success b/internal/test_helpers/fixtures/zero_or_one_quantifier/success index 889f492..4ad58df 100644 --- a/internal/test_helpers/fixtures/zero_or_one_quantifier/success +++ b/internal/test_helpers/fixtures/zero_or_one_quantifier/success @@ -1,42 +1,42 @@ -[stage-1] Running tests for Stage #1: init -[stage-1] $ echo "dog" | ./your_grep.sh -E "d" -[your_program] dog -[stage-1] ✓ Received exit code 0. -[stage-1] $ echo "dog" | ./your_grep.sh -E "f" -[stage-1] ✓ Received exit code 1. -[stage-1] Test passed. - -[stage-2] Running tests for Stage #2: match_digit -[stage-2] $ echo "123" | ./your_grep.sh -E "\d" -[your_program] 123 -[stage-2] ✓ Received exit code 0. -[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" -[stage-2] ✓ Received exit code 1. -[stage-2] Test passed. +[stage-10] Running tests for Stage #10: zero_or_one_quantifier +[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" +[your_program] cat +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" +[your_program] act +[stage-10] ✓ Received exit code 0. +[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" +[stage-10] ✓ Received exit code 1. +[stage-10] Test passed. -[stage-3] Running tests for Stage #3: match_alphanumeric -[stage-3] $ echo "word" | ./your_grep.sh -E "\w" -[your_program] word -[stage-3] ✓ Received exit code 0. -[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" -[stage-3] ✓ Received exit code 1. -[stage-3] Test passed. +[stage-9] Running tests for Stage #9: one_or_more_quantifier +[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" +[your_program] caaats +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" +[your_program] cat +[stage-9] ✓ Received exit code 0. +[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" +[stage-9] ✓ Received exit code 1. +[stage-9] Test passed. -[stage-4] Running tests for Stage #4: positive_character_groups -[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" -[your_program] a -[stage-4] ✓ Received exit code 0. -[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" -[stage-4] ✓ Received exit code 1. -[stage-4] Test passed. +[stage-8] Running tests for Stage #8: end_of_string_anchor +[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" +[your_program] cat +[stage-8] ✓ Received exit code 0. +[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" +[stage-8] ✓ Received exit code 1. +[stage-8] Test passed. -[stage-5] Running tests for Stage #5: negative_character_groups -[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" -[your_program] apple -[stage-5] ✓ Received exit code 0. -[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" -[stage-5] ✓ Received exit code 1. -[stage-5] Test passed. +[stage-7] Running tests for Stage #7: start_of_string_anchor +[stage-7] $ echo "log" | ./your_grep.sh -E "^log" +[your_program] log +[stage-7] ✓ Received exit code 0. +[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" +[stage-7] ✓ Received exit code 1. +[stage-7] Test passed. [stage-6] Running tests for Stage #6: combining_character_classes [stage-6] $ echo "sally has 3 apples" | ./your_grep.sh -E "\d apple" @@ -59,42 +59,42 @@ [stage-6] ✓ Received exit code 1. [stage-6] Test passed. -[stage-7] Running tests for Stage #7: start_of_string_anchor -[stage-7] $ echo "log" | ./your_grep.sh -E "^log" -[your_program] log -[stage-7] ✓ Received exit code 0. -[stage-7] $ echo "slog" | ./your_grep.sh -E "^log" -[stage-7] ✓ Received exit code 1. -[stage-7] Test passed. +[stage-5] Running tests for Stage #5: negative_character_groups +[stage-5] $ echo "apple" | ./your_grep.sh -E "[^xyz]" +[your_program] apple +[stage-5] ✓ Received exit code 0. +[stage-5] $ echo "banana" | ./your_grep.sh -E "[^anb]" +[stage-5] ✓ Received exit code 1. +[stage-5] Test passed. -[stage-8] Running tests for Stage #8: end_of_string_anchor -[stage-8] $ echo "cat" | ./your_grep.sh -E "cat$" -[your_program] cat -[stage-8] ✓ Received exit code 0. -[stage-8] $ echo "cats" | ./your_grep.sh -E "cat$" -[stage-8] ✓ Received exit code 1. -[stage-8] Test passed. +[stage-4] Running tests for Stage #4: positive_character_groups +[stage-4] $ echo "a" | ./your_grep.sh -E "[abcd]" +[your_program] a +[stage-4] ✓ Received exit code 0. +[stage-4] $ echo "efgh" | ./your_grep.sh -E "[abcd]" +[stage-4] ✓ Received exit code 1. +[stage-4] Test passed. -[stage-9] Running tests for Stage #9: one_or_more_quantifier -[stage-9] $ echo "caaats" | ./your_grep.sh -E "ca+t" -[your_program] caaats -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "cat" | ./your_grep.sh -E "ca+t" -[your_program] cat -[stage-9] ✓ Received exit code 0. -[stage-9] $ echo "act" | ./your_grep.sh -E "ca+t" -[stage-9] ✓ Received exit code 1. -[stage-9] Test passed. +[stage-3] Running tests for Stage #3: match_alphanumeric +[stage-3] $ echo "word" | ./your_grep.sh -E "\w" +[your_program] word +[stage-3] ✓ Received exit code 0. +[stage-3] $ echo "$!?" | ./your_grep.sh -E "\w" +[stage-3] ✓ Received exit code 1. +[stage-3] Test passed. -[stage-10] Running tests for Stage #10: zero_or_one_quantifier -[stage-10] $ echo "cat" | ./your_grep.sh -E "ca?t" -[your_program] cat -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "act" | ./your_grep.sh -E "ca?t" -[your_program] act -[stage-10] ✓ Received exit code 0. -[stage-10] $ echo "dog" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] $ echo "cag" | ./your_grep.sh -E "ca?t" -[stage-10] ✓ Received exit code 1. -[stage-10] Test passed. +[stage-2] Running tests for Stage #2: match_digit +[stage-2] $ echo "123" | ./your_grep.sh -E "\d" +[your_program] 123 +[stage-2] ✓ Received exit code 0. +[stage-2] $ echo "apple" | ./your_grep.sh -E "\d" +[stage-2] ✓ Received exit code 1. +[stage-2] Test passed. + +[stage-1] Running tests for Stage #1: init +[stage-1] $ echo "dog" | ./your_grep.sh -E "d" +[your_program] dog +[stage-1] ✓ Received exit code 0. +[stage-1] $ echo "dog" | ./your_grep.sh -E "f" +[stage-1] ✓ Received exit code 1. +[stage-1] Test passed.