-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The most important change here is that we add the ↵ test type, which expects a CR or LF ahead of its text to match. Ideally we'd assert this every time, but there's a variety of extraneous stuff shells like to print that can interfere with this. I've also tweaked the timing a bit, trying to find a balance between having the suite run quickly, while accommodating slower machines and other sources of inconsistency. I'm sure there will still be more tweaks. Fixes #10.
- Loading branch information
Showing
38 changed files
with
164 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
→ /bin/echo foo bar⏎ | ||
← foo bar | ||
→ tr a-z n-za-m⏎foo bar baz⏎^D | ||
← sbb one onm | ||
↵ foo bar | ||
→ tr a-z n-za-m⏎ | ||
→ foo bar baz⏎ | ||
↵ sbb one onm | ||
→ ^D | ||
→ ./helpers/echo-rot13 foo bar⏎ | ||
← sbb one | ||
↵ sbb one | ||
→ ./helpers/echo-exit ./helpers/successful-exit-status⏎ | ||
← 0 | ||
↵ 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# harness puts helpers/ in our path | ||
→ echo-exit ./helpers/successful-exit-status⏎ | ||
← 0 | ||
↵ 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
→ /bin/pwd⏎ | ||
≠ /tmp | ||
≠ /tmp\n | ||
→ cd /tmp⏎ | ||
→ cd ..⏎ | ||
→ /bin/pwd⏎ | ||
← / | ||
↵ /\n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# POSIX calls these sequential lists | ||
→ echo -n foo; echo -n bar; echo baz⏎ | ||
← foobarbaz | ||
↵ foobarbaz | ||
→ cd /tmp; pwd⏎ | ||
← /tmp | ||
↵ /tmp | ||
→ false; echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
# POSIX calls these AND Lists and OR Lists | ||
→ true && echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb | ||
→ false && echo-rot13 foo⏎ | ||
≠ sbb | ||
→ true && false && echo-rot13 foo⏎ | ||
≠ sbb | ||
→ false || echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb | ||
→ true || false || echo-rot13 foo⏎ | ||
≠ sbb | ||
→ false || true && echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb | ||
# we wait a bit here because some shells have an expensive | ||
# command_not_found_handler hook; e.g. Fedora checks a package | ||
# database. | ||
→ nonexistent-command || echo-rot13 zim⏎ | ||
← mvz | ||
⌛ | ||
↵ mvz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
→ pwd⏎ | ||
≠ /tmp | ||
≠ /tmp\n | ||
→ (cd /tmp; pwd)⏎ | ||
← /tmp | ||
↵ /tmp\n | ||
→ pwd⏎ | ||
≠ /tmp | ||
≠ /tmp\n | ||
→ (exit 1) && echo-rot13 foo⏎ | ||
≠ sbb | ||
≠ sbb\n | ||
→ (exit 0 && exit 1) && echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb\n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
→ ! false && echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb | ||
→ ! true && echo-rot13 foo⏎ | ||
≠ sbb | ||
→ ! true || echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
→ echo foo\⏎bar\⏎baz⏎ | ||
← foobarbaz | ||
← foobarbaz\n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
→ true &&⏎false ||⏎echo-rot13 foo ||⏎echo-rot13 bar⏎ | ||
← sbb | ||
→ true &&⏎ | ||
→ false ||⏎ | ||
→ echo-rot13 foo ||⏎ | ||
→ echo-rot13 bar⏎ | ||
↵ sbb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
→ echo foo | grep -c foo⏎ | ||
← 1 | ||
↵ 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
# we're started in a temp directory | ||
→ echo zim > foo && cat foo | tr n-za-m a-z⏎ | ||
← mvz | ||
↵ mvz | ||
→ cat foo⏎ | ||
← zim | ||
↵ zim | ||
→ echo a > foo ; echo b > foo ; cat foo⏎ | ||
← b | ||
↵ b | ||
# NB echo -n isn't portable... | ||
→ echo -n a > foo ; echo b >> foo ; cat foo⏎ | ||
← ab | ||
↵ ab | ||
→ cat < /non-existent-file || echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb | ||
→ cat /non-existent-file 2>foo || grep -c . <foo⏎ | ||
← 1 | ||
↵ 1 | ||
→ echo quux > foo && cat < foo⏎ | ||
← quux | ||
↵ quux | ||
→ echo quux >foo && echo -n blah <>foo && cat <foo⏎ | ||
← blahquux | ||
↵ blahquux | ||
→ echo bar >foo && cat <>foo⏎ | ||
← bar | ||
↵ bar | ||
→ echo mitten >foo && echo -n k 1<>foo && cat foo⏎ | ||
← kitten | ||
↵ kitten |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# NB stdin/out/err when connected to a terminal is usually rw | ||
→ fd-perms 0 </dev/null⏎ | ||
← r | ||
↵ r | ||
→ fd-perms 0 <>/dev/null⏎ | ||
← rw | ||
↵ rw | ||
# it's tricky to test fd 1 without losing the output. we could have | ||
# an exit status instead, with tools called is-writable and | ||
# is-readable, but meh. | ||
→ fd-perms 3 3>/dev/null⏎ | ||
← w | ||
↵ w | ||
# An Arrow in Heart | ||
→ fd-perms 3 3</dev/null⏎ | ||
← r | ||
↵ r | ||
→ fd-perms 3 3<>/dev/null⏎ | ||
← rw | ||
↵ rw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# This will hang in the case of a very common bug: you forget to close | ||
# the other ends of the pipe. | ||
→ cat </etc/passwd | cat | cat | cat >/dev/null | echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
→ list-fds⏎ | ||
← 0\n1\n2 | ||
↵ 0\n1\n2 | ||
# probably want to check a few other cases of this | ||
→ list-fds 0<&- 2<&-⏎ | ||
← 1 | ||
↵ 1 | ||
# is this order specified by POSIX? seems like you could get 0,1 here | ||
→ list-fds 0<&- 2<&- 3</dev/null⏎ | ||
← 1\n3 | ||
↵ 1\n3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
→ echo foo > bar && cat $(echo bar)⏎ | ||
← foo | ||
→ echo-rot13 foo > bar && cat $(echo bar)⏎ | ||
↵ sbb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Would prefer to test this but mksh doesn't agree | ||
#→ echo zim | ! tr z b | grep -qc bim || echo foo⏎ | ||
#≠ foo | ||
# mksh does not agree with this interpretation | ||
→ echo zim | ! tr z b | grep -qc bim || echo foo⏎ | ||
≠ foo | ||
→ ! echo zim | tr z b | grep -qc bim || echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
→ echo foo | cd /tmp | pwd⏎ | ||
≠ /tmp | ||
≠ /tmp\n | ||
→ echo foo | cd /tmp | echo-rot13 bar⏎ | ||
← one | ||
↵ one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# not part of posix shell | ||
→ cat <(echo foo) | ||
← foo | ||
⏎ foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
# this would be nicer if we already had $@... | ||
→ echo-signal INT⏎ | ||
← ready | ||
→ ^C⏎ | ||
↵ ready | ||
→ ^C | ||
⌛ | ||
← INT | ||
→ echo-signal TSTP⏎ | ||
← ready | ||
→ ^Z⏎ | ||
↵ ready | ||
→ ^Z | ||
⌛ | ||
← TSTP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
→ echo-signal CONT⏎ | ||
← ready | ||
↵ ready | ||
→ ^Z | ||
⌛ | ||
→ echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb | ||
→ fg⏎ | ||
← CONT | ||
→ echo-signal INT &⏎ | ||
← ready | ||
→ echo-rot13 foo⏎ | ||
← sbb | ||
↵ sbb | ||
→ fg⏎ | ||
→ ^C⏎ | ||
⌛ | ||
→ ^C | ||
← INT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
→ echo-signal INT & sleep 1; echo-rot13 foo⏎ | ||
→ echo-signal INT & sleep 0.5; echo-rot13 foo⏎ | ||
← ready | ||
⌛ | ||
← sbb | ||
→ fg⏎ | ||
→ ^C⏎ | ||
⌛ | ||
→ ^C | ||
← INT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
→ tr a-z n-za-m </dev/tty &⏎ | ||
→ fg⏎ | ||
→ foo⏎ | ||
← sbb | ||
↵ sbb | ||
→ ^D | ||
→ stty tostop⏎ | ||
→ echo foo &⏎ | ||
≠ foo | ||
→ fg⏎ | ||
← foo | ||
↵ foo |
Oops, something went wrong.