From 10911b74c10f8ebcb8f2bc68cb27b62c11a5fffb Mon Sep 17 00:00:00 2001 From: Andy Li <1450947+andy1li@users.noreply.github.com> Date: Tue, 12 Nov 2024 12:53:14 +0800 Subject: [PATCH] Add a test case to #zm7 --- internal/stage_alternation.go | 4 ++-- internal/test_helpers/fixtures/alternation/success | 4 ++-- .../test_helpers/fixtures/backreferences_multiple/success | 4 ++-- internal/test_helpers/fixtures/backreferences_nested/success | 4 ++-- internal/test_helpers/fixtures/backreferences_single/success | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/stage_alternation.go b/internal/stage_alternation.go index ddbfbfc..ab74d77 100644 --- a/internal/stage_alternation.go +++ b/internal/stage_alternation.go @@ -12,8 +12,8 @@ func testAlternation(stageHarness *test_case_harness.TestCaseHarness) error { ExpectedExitCode: 0, }, { - Pattern: "a (cat|dog)", - Input: "a dog", + Pattern: "a (cat|dog) and (cat|dog)s", + Input: "a dog and cats", ExpectedExitCode: 0, }, { diff --git a/internal/test_helpers/fixtures/alternation/success b/internal/test_helpers/fixtures/alternation/success index 2411576..83e4176 100644 --- a/internal/test_helpers/fixtures/alternation/success +++ b/internal/test_helpers/fixtures/alternation/success @@ -2,8 +2,8 @@ [stage-12] $ echo -n "a cat" | ./your_grep.sh -E "a (cat|dog)" [your_program] a cat [stage-12] ✓ Received exit code 0. -[stage-12] $ echo -n "a dog" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a dog +[stage-12] $ echo -n "a dog and cats" | ./your_grep.sh -E "a (cat|dog) and (cat|dog)s" +[your_program] a dog and cats [stage-12] ✓ Received exit code 0. [stage-12] $ echo -n "a cow" | ./your_grep.sh -E "a (cat|dog)" [stage-12] ✓ Received exit code 1. diff --git a/internal/test_helpers/fixtures/backreferences_multiple/success b/internal/test_helpers/fixtures/backreferences_multiple/success index a4f0129..a8adb50 100644 --- a/internal/test_helpers/fixtures/backreferences_multiple/success +++ b/internal/test_helpers/fixtures/backreferences_multiple/success @@ -84,8 +84,8 @@ [stage-12] $ echo -n "a cat" | ./your_grep.sh -E "a (cat|dog)" [your_program] a cat [stage-12] ✓ Received exit code 0. -[stage-12] $ echo -n "a dog" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a dog +[stage-12] $ echo -n "a dog and cats" | ./your_grep.sh -E "a (cat|dog) and (cat|dog)s" +[your_program] a dog and cats [stage-12] ✓ Received exit code 0. [stage-12] $ echo -n "a cow" | ./your_grep.sh -E "a (cat|dog)" [stage-12] ✓ Received exit code 1. diff --git a/internal/test_helpers/fixtures/backreferences_nested/success b/internal/test_helpers/fixtures/backreferences_nested/success index 274eab6..e200a59 100644 --- a/internal/test_helpers/fixtures/backreferences_nested/success +++ b/internal/test_helpers/fixtures/backreferences_nested/success @@ -125,8 +125,8 @@ [stage-12] $ echo -n "a cat" | ./your_grep.sh -E "a (cat|dog)" [your_program] a cat [stage-12] ✓ Received exit code 0. -[stage-12] $ echo -n "a dog" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a dog +[stage-12] $ echo -n "a dog and cats" | ./your_grep.sh -E "a (cat|dog) and (cat|dog)s" +[your_program] a dog and cats [stage-12] ✓ Received exit code 0. [stage-12] $ echo -n "a cow" | ./your_grep.sh -E "a (cat|dog)" [stage-12] ✓ Received exit code 1. diff --git a/internal/test_helpers/fixtures/backreferences_single/success b/internal/test_helpers/fixtures/backreferences_single/success index 9f15e21..405f07d 100644 --- a/internal/test_helpers/fixtures/backreferences_single/success +++ b/internal/test_helpers/fixtures/backreferences_single/success @@ -43,8 +43,8 @@ [stage-12] $ echo -n "a cat" | ./your_grep.sh -E "a (cat|dog)" [your_program] a cat [stage-12] ✓ Received exit code 0. -[stage-12] $ echo -n "a dog" | ./your_grep.sh -E "a (cat|dog)" -[your_program] a dog +[stage-12] $ echo -n "a dog and cats" | ./your_grep.sh -E "a (cat|dog) and (cat|dog)s" +[your_program] a dog and cats [stage-12] ✓ Received exit code 0. [stage-12] $ echo -n "a cow" | ./your_grep.sh -E "a (cat|dog)" [stage-12] ✓ Received exit code 1.