From 522dee8d3c69762ad25ca8626122b257f9ff5a64 Mon Sep 17 00:00:00 2001
From: Andy Li
Date: Tue, 31 Dec 2024 13:14:37 +0000
Subject: [PATCH] Tweak test cases for quoted strings with no whitespace
between them
---
internal/stage_q1.go | 4 ++--
internal/stage_q2.go | 4 ++--
internal/test_helpers/fixtures/quoting/pass | 8 ++++----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/internal/stage_q1.go b/internal/stage_q1.go
index 3ba029d6..758917a0 100644
--- a/internal/stage_q1.go
+++ b/internal/stage_q1.go
@@ -44,13 +44,13 @@ func testQ1(stageHarness *test_case_harness.TestCaseHarness) error {
inputs := []string{
fmt.Sprintf(`echo '%s %s'`, L[0], L[1]),
fmt.Sprintf(`echo %s %s`, L[1], L[4]),
- fmt.Sprintf(`echo '%s %s'`, L[2], L[3]),
+ fmt.Sprintf(`echo '%s %s' '%s''%s'`, L[2], L[3], L[4], L[0]),
fmt.Sprintf(`cat '%s' '%s' '%s'`, filePaths[0], filePaths[1], filePaths[2]),
}
expectedOutputs := []string{
fmt.Sprintf("%s %s", L[0], L[1]),
fmt.Sprintf("%s %s", L[1], L[4]),
- fmt.Sprintf("%s %s", L[2], L[3]),
+ fmt.Sprintf("%s %s %s%s", L[2], L[3], L[4], L[0]),
fileContents[0] + fileContents[1] + strings.TrimRight(fileContents[2], "\n"),
}
testCaseContents := newTestCaseContents(inputs, expectedOutputs)
diff --git a/internal/stage_q2.go b/internal/stage_q2.go
index a1db8b72..8ffa49aa 100644
--- a/internal/stage_q2.go
+++ b/internal/stage_q2.go
@@ -43,13 +43,13 @@ func testQ2(stageHarness *test_case_harness.TestCaseHarness) error {
L := random.RandomElementsFromArray(LARGE_WORDS, 5)
inputs := []string{
fmt.Sprintf(`echo "%s %s"`, L[0], L[1]),
- fmt.Sprintf(`echo "%s %s" "%s"`, L[1], L[2], L[3]),
+ fmt.Sprintf(`echo "%s %s" "%s""%s"`, L[1], L[2], L[3], L[0]),
fmt.Sprintf(`echo "%s" "%s's" "%s"`, L[3], L[4], L[1]),
fmt.Sprintf(`cat "%s" "%s" "%s"`, filePaths[0], filePaths[1], filePaths[2]),
}
expectedOutputs := []string{
fmt.Sprintf("%s %s", L[0], L[1]),
- fmt.Sprintf("%s %s %s", L[1], L[2], L[3]),
+ fmt.Sprintf("%s %s %s%s", L[1], L[2], L[3], L[0]),
fmt.Sprintf(`%s %s's %s`, L[3], L[4], L[1]),
fileContents[0] + fileContents[1] + strings.TrimRight(fileContents[2], "\n"),
}
diff --git a/internal/test_helpers/fixtures/quoting/pass b/internal/test_helpers/fixtures/quoting/pass
index fd6ba7be..70785561 100644
--- a/internal/test_helpers/fixtures/quoting/pass
+++ b/internal/test_helpers/fixtures/quoting/pass
@@ -8,8 +8,8 @@ Debug = true
[33m[your-program] [0m$ echo world script
[33m[your-program] [0mworld script
[33m[stage-6] [0m[92m✓ Received expected response[0m
-[33m[your-program] [0m$ echo 'shell example'
-[33m[your-program] [0mshell example
+[33m[your-program] [0m$ echo 'shell example' 'script''test'
+[33m[your-program] [0mshell example scripttest
[33m[stage-6] [0m[92m✓ Received expected response[0m
[33m[stage-6] [0m[94mWriting file "/tmp/foo/f 30" with content "grape banana."[0m
[33m[stage-6] [0m[94mWriting file "/tmp/foo/f 67" with content "strawberry apple."[0m
@@ -25,8 +25,8 @@ Debug = true
[33m[your-program] [0m$ echo "world shell"
[33m[your-program] [0mworld shell
[33m[stage-5] [0m[92m✓ Received expected response[0m
-[33m[your-program] [0m$ echo "shell script" "hello"
-[33m[your-program] [0mshell script hello
+[33m[your-program] [0m$ echo "shell script" "hello""world"
+[33m[your-program] [0mshell script helloworld
[33m[stage-5] [0m[92m✓ Received expected response[0m
[33m[your-program] [0m$ echo "hello" "test's" "shell"
[33m[your-program] [0mhello test's shell