Skip to content

Commit

Permalink
test: add fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-gang committed Dec 20, 2024
1 parent 46c22fe commit 390a07e
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions internal/test_helpers/fixtures/redirection/pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
Debug = true

[stage-4] Running tests for Stage #4: r1
[stage-4] Running ./your_shell.sh
[stage-4] Writing file "/tmp/baz/apple" with content "apple"
[stage-4] Writing file "/tmp/baz/blueberry" with content "blueberry"
[stage-4] Writing file "/tmp/baz/grape" with content "grape"
[your-program] $ ls /tmp/baz > /tmp/foo/baz.md
[your-program] $ cat /tmp/foo/baz.md
[your-program] apple
[your-program] blueberry
[your-program] grape
[stage-4] ✓ Received redirected file content
[your-program] $ echo 'Hello James' 1> /tmp/foo/foo.md
[your-program] $ cat /tmp/foo/foo.md
[your-program] Hello James
[stage-4] ✓ Received redirected file content
[your-program] $ cat /tmp/baz/blueberry nonexistent 1> /tmp/foo/quz.md
[your-program] cat: nonexistent: No such file or directory
[stage-4] ✓ Received error message
[your-program] $ cat /tmp/foo/quz.md
[your-program] blueberry
[stage-4] ✓ Received redirected file content
[your-program] $
[stage-4] Test passed.

[stage-3] Running tests for Stage #3: r2
[stage-3] Running ./your_shell.sh
[stage-3] Writing file "/tmp/bar/pear" with content "pear"
[your-program] $ ls nonexistent 2> /tmp/quz/baz.md
[your-program] $ cat /tmp/quz/baz.md
[your-program] ls: cannot access 'nonexistent': No such file or directory
[stage-3] ✓ Received redirected error message
[your-program] $ echo 'Maria file cannot be found' 2> /tmp/quz/foo.md
[your-program] Maria file cannot be found
[stage-3] ✓ Received redirected error message
[stage-3] ✓ File: /tmp/quz/foo.md is empty
[your-program] $ cat /tmp/bar/pear nonexistent 2> /tmp/quz/quz.md
[your-program] pear
[stage-3] ✓ Received file content
[your-program] $ cat /tmp/quz/quz.md
[your-program] cat: nonexistent: No such file or directory
[stage-3] ✓ Received redirected error message
[your-program] $
[stage-3] Test passed.

[stage-2] Running tests for Stage #2: r3
[stage-2] Running ./your_shell.sh
[stage-2] Writing file "/tmp/baz/apple" with content "apple"
[stage-2] Writing file "/tmp/baz/banana" with content "banana"
[stage-2] Writing file "/tmp/baz/blueberry" with content "blueberry"
[your-program] $ ls /tmp/baz >> /tmp/bar/bar.md
[your-program] $ cat /tmp/bar/bar.md
[your-program] apple
[your-program] banana
[your-program] blueberry
[stage-2] ✓ Received redirected file content
[your-program] $ echo 'Hello Emily' 1>> /tmp/bar/baz.md
[your-program] $ echo 'Hello Maria' 1>> /tmp/bar/baz.md
[your-program] $ cat /tmp/bar/baz.md
[your-program] Hello Emily
[your-program] Hello Maria
[stage-2] ✓ Received redirected file content
[your-program] $ echo "List of files: " > /tmp/bar/qux.md
[your-program] $ ls /tmp/baz >> /tmp/bar/qux.md
[your-program] $ cat /tmp/bar/qux.md
[your-program] List of files:
[your-program] apple
[your-program] banana
[your-program] blueberry
[stage-2] ✓ Received redirected file content
[your-program] $
[stage-2] Test passed.

[stage-1] Running tests for Stage #1: r4
[stage-1] Running ./your_shell.sh
[stage-1] Writing file "/tmp/qux/pear" with content "pear"
[stage-1] Writing file "/tmp/qux/raspberry" with content "raspberry"
[stage-1] Writing file "/tmp/qux/strawberry" with content "strawberry"
[your-program] $ ls nonexistent >> /tmp/foo/baz.md
[your-program] ls: cannot access 'nonexistent': No such file or directory
[stage-1] ✓ Received error message
[stage-1] ✓ File: /tmp/foo/baz.md is empty
[your-program] $ ls nonexistent 2>> /tmp/foo/qux.md
[your-program] $ cat /tmp/foo/qux.md
[your-program] ls: cannot access 'nonexistent': No such file or directory
[stage-1] ✓ Received redirected file content
[your-program] $ echo "James says Error" 2>> /tmp/foo/quz.md
[your-program] James says Error
[stage-1] ✓ Received redirected file content
[your-program] $ cat nonexistent 2>> /tmp/foo/quz.md
[your-program] $ ls nonexistent 2>> /tmp/foo/quz.md
[your-program] $ cat /tmp/foo/quz.md
[your-program] cat: nonexistent: No such file or directory
[your-program] ls: cannot access 'nonexistent': No such file or directory
[stage-1] ✓ Received redirected file content
[your-program] $
[stage-1] Test passed.

0 comments on commit 390a07e

Please sign in to comment.