Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CC-1568: Add test case of echo 'hello''world' for Quoting [Shell] #89

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/stage_q1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions internal/stage_q2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
Expand Down
8 changes: 4 additions & 4 deletions internal/test_helpers/fixtures/quoting/pass
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Debug = true
[your-program] $ echo world script
[your-program] world script
[stage-6] ✓ Received expected response
[your-program] $ echo 'shell example'
[your-program] shell example
[your-program] $ echo 'shell example' 'script''test'
[your-program] shell example scripttest
[stage-6] ✓ Received expected response
[stage-6] Writing file "/tmp/foo/f 30" with content "grape banana."
[stage-6] Writing file "/tmp/foo/f 67" with content "strawberry apple."
Expand All @@ -25,8 +25,8 @@ Debug = true
[your-program] $ echo "world shell"
[your-program] world shell
[stage-5] ✓ Received expected response
[your-program] $ echo "shell script" "hello"
[your-program] shell script hello
[your-program] $ echo "shell script" "hello""world"
[your-program] shell script helloworld
[stage-5] ✓ Received expected response
[your-program] $ echo "hello" "test's" "shell"
[your-program] hello test's shell
Expand Down
Loading