Skip to content

Commit f0b0d3a

Browse files
committed
Update test cases to modify regex patterns for animal counting and adjust expected exit codes
1 parent 364abe4 commit f0b0d3a

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

internal/stage_alternation.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ func testAlternation(stageHarness *test_case_harness.TestCaseHarness) error {
1717
ExpectedExitCode: 1,
1818
},
1919
{
20-
Pattern: "^([Ww]ill(, | |'s )?)+$",
21-
Input: "Will, will Will will Will Will's will",
20+
Pattern: "^I see (\\d (cat|dog|cow)s?(, | and )?)+$",
21+
Input: "I see 1 cat, 2 dogs and 3 cows",
2222
ExpectedExitCode: 0,
2323
},
2424
{
25-
Pattern: "^I see (\\d (cat|dog|cow)s?(, | and )?)+$",
25+
Pattern: "^I see (\\d (cat|dog|cow)(, | and )?)+$",
2626
Input: "I see 1 cat, 2 dogs and 3 cows",
27-
ExpectedExitCode: 0,
27+
ExpectedExitCode: 1,
2828
},
2929
}
3030

internal/test_helpers/fixtures/alternation/success

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
[stage-12] ✓ Received exit code 0.
55
[stage-12] $ echo -n "a cow" | ./your_grep.sh -E "a (cat|dog)"
66
[stage-12] ✓ Received exit code 1.
7-
[stage-12] $ echo -n "Will, will Will will Will Will's will" | ./your_grep.sh -E "^([Ww]ill(, | |'s )?)+$"
8-
[your_program] Will, will Will will Will Will's will
9-
[stage-12] ✓ Received exit code 0.
107
[stage-12] $ echo -n "I see 1 cat, 2 dogs and 3 cows" | ./your_grep.sh -E "^I see (\d (cat|dog|cow)s?(, | and )?)+$"
118
[your_program] I see 1 cat, 2 dogs and 3 cows
129
[stage-12] ✓ Received exit code 0.
10+
[stage-12] $ echo -n "I see 1 cat, 2 dogs and 3 cows" | ./your_grep.sh -E "^I see (\d (cat|dog|cow)(, | and )?)+$"
11+
[stage-12] ✓ Received exit code 1.
1312
[stage-12] Test passed.
1413

1514
[stage-11] Running tests for Stage #11: zb3

internal/test_helpers/fixtures/backreferences_multiple/success

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@
8686
[stage-12] ✓ Received exit code 0.
8787
[stage-12] $ echo -n "a cow" | ./your_grep.sh -E "a (cat|dog)"
8888
[stage-12] ✓ Received exit code 1.
89-
[stage-12] $ echo -n "Will, will Will will Will Will's will" | ./your_grep.sh -E "^([Ww]ill(, | |'s )?)+$"
90-
[your_program] Will, will Will will Will Will's will
91-
[stage-12] ✓ Received exit code 0.
9289
[stage-12] $ echo -n "I see 1 cat, 2 dogs and 3 cows" | ./your_grep.sh -E "^I see (\d (cat|dog|cow)s?(, | and )?)+$"
9390
[your_program] I see 1 cat, 2 dogs and 3 cows
9491
[stage-12] ✓ Received exit code 0.
92+
[stage-12] $ echo -n "I see 1 cat, 2 dogs and 3 cows" | ./your_grep.sh -E "^I see (\d (cat|dog|cow)(, | and )?)+$"
93+
[stage-12] ✓ Received exit code 1.
9594
[stage-12] Test passed.
9695

9796
[stage-11] Running tests for Stage #11: zb3

internal/test_helpers/fixtures/backreferences_nested/success

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,11 @@
127127
[stage-12] ✓ Received exit code 0.
128128
[stage-12] $ echo -n "a cow" | ./your_grep.sh -E "a (cat|dog)"
129129
[stage-12] ✓ Received exit code 1.
130-
[stage-12] $ echo -n "Will, will Will will Will Will's will" | ./your_grep.sh -E "^([Ww]ill(, | |'s )?)+$"
131-
[your_program] Will, will Will will Will Will's will
132-
[stage-12] ✓ Received exit code 0.
133130
[stage-12] $ echo -n "I see 1 cat, 2 dogs and 3 cows" | ./your_grep.sh -E "^I see (\d (cat|dog|cow)s?(, | and )?)+$"
134131
[your_program] I see 1 cat, 2 dogs and 3 cows
135132
[stage-12] ✓ Received exit code 0.
133+
[stage-12] $ echo -n "I see 1 cat, 2 dogs and 3 cows" | ./your_grep.sh -E "^I see (\d (cat|dog|cow)(, | and )?)+$"
134+
[stage-12] ✓ Received exit code 1.
136135
[stage-12] Test passed.
137136

138137
[stage-11] Running tests for Stage #11: zb3

internal/test_helpers/fixtures/backreferences_single/success

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@
4545
[stage-12] ✓ Received exit code 0.
4646
[stage-12] $ echo -n "a cow" | ./your_grep.sh -E "a (cat|dog)"
4747
[stage-12] ✓ Received exit code 1.
48-
[stage-12] $ echo -n "Will, will Will will Will Will's will" | ./your_grep.sh -E "^([Ww]ill(, | |'s )?)+$"
49-
[your_program] Will, will Will will Will Will's will
50-
[stage-12] ✓ Received exit code 0.
5148
[stage-12] $ echo -n "I see 1 cat, 2 dogs and 3 cows" | ./your_grep.sh -E "^I see (\d (cat|dog|cow)s?(, | and )?)+$"
5249
[your_program] I see 1 cat, 2 dogs and 3 cows
5350
[stage-12] ✓ Received exit code 0.
51+
[stage-12] $ echo -n "I see 1 cat, 2 dogs and 3 cows" | ./your_grep.sh -E "^I see (\d (cat|dog|cow)(, | and )?)+$"
52+
[stage-12] ✓ Received exit code 1.
5453
[stage-12] Test passed.
5554

5655
[stage-11] Running tests for Stage #11: zb3

0 commit comments

Comments
 (0)