the | tee /dev/stderr trick doesn't work on linux

This commit is contained in:
Kurtis Rader 2017-08-03 15:02:57 -07:00
parent 17dff8c569
commit b4ce749c69
2 changed files with 20 additions and 16 deletions

View file

@ -1,42 +1,42 @@
echo '# Test basic add and list of __abbr1' | tee /dev/stderr logmsg Test basic add and list of __abbr1
abbr __abbr1 alpha beta gamma abbr __abbr1 alpha beta gamma
abbr | grep __abbr1 abbr | grep __abbr1
echo '# Erasing one that doesn\'t exist should do nothing' | tee /dev/stderr logmsg Erasing one that doesn\'t exist should do nothing
abbr --erase NOT_AN_ABBR abbr --erase NOT_AN_ABBR
abbr | grep __abbr1 abbr | grep __abbr1
echo '# Adding existing __abbr1 should be idempotent' | tee /dev/stderr logmsg Adding existing __abbr1 should be idempotent
abbr __abbr1 alpha beta gamma abbr __abbr1 alpha beta gamma
abbr | grep __abbr1 abbr | grep __abbr1
echo '# Replacing __abbr1 definition' | tee /dev/stderr logmsg Replacing __abbr1 definition
abbr __abbr1 delta abbr __abbr1 delta
abbr | grep __abbr1 abbr | grep __abbr1
echo '# __abbr1 -s and --show tests' | tee /dev/stderr logmsg __abbr1 -s and --show tests
abbr -s | grep __abbr1 abbr -s | grep __abbr1
abbr --show | grep __abbr1 abbr --show | grep __abbr1
echo '# Test erasing __abbr1' | tee /dev/stderr logmsg Test erasing __abbr1
abbr -e __abbr1 abbr -e __abbr1
abbr | grep __abbr1 abbr | grep __abbr1
echo '# Ensure we escape special characters on output' | tee /dev/stderr logmsg Ensure we escape special characters on output
abbr '~__abbr2' '$xyz' abbr '~__abbr2' '$xyz'
abbr | grep __abbr2 abbr | grep __abbr2
abbr -e '~__abbr2' abbr -e '~__abbr2'
echo '# Ensure we handle leading dashes in abbreviation names properly' | tee /dev/stderr logmsg Ensure we handle leading dashes in abbreviation names properly
abbr -- '--__abbr3' 'xyz' abbr -- '--__abbr3' 'xyz'
abbr | grep __abbr3 abbr | grep __abbr3
abbr -e -- '--__abbr3' abbr -e -- '--__abbr3'
echo '# Test that an abbr word containing spaces is rejected' | tee /dev/stderr logmsg Test that an abbr word containing spaces is rejected
abbr "a b c" "d e f" abbr "a b c" "d e f"
abbr | grep 'a b c' abbr | grep 'a b c'
echo '# Test renaming' | tee /dev/stderr logmsg Test renaming
abbr __abbr4 omega abbr __abbr4 omega
abbr | grep __abbr5 abbr | grep __abbr5
abbr -r __abbr4 __abbr5 abbr -r __abbr4 __abbr5
@ -44,28 +44,28 @@ abbr | grep __abbr5
abbr -e __abbr5 abbr -e __abbr5
abbr | grep __abbr4 abbr | grep __abbr4
echo '# Test renaming a nonexistent abbreviation' | tee /dev/stderr logmsg Test renaming a nonexistent abbreviation
abbr -r __abbr6 __abbr abbr -r __abbr6 __abbr
echo '# Test renaming to a abbreviation with spaces' | tee /dev/stderr logmsg Test renaming to a abbreviation with spaces
abbr __abbr4 omega abbr __abbr4 omega
abbr -r __abbr4 "g h i" abbr -r __abbr4 "g h i"
abbr -e __abbr4 abbr -e __abbr4
echo '# Test renaming without arguments' | tee /dev/stderr logmsg Test renaming without arguments
abbr __abbr7 omega abbr __abbr7 omega
abbr -r __abbr7 abbr -r __abbr7
echo '# Test renaming with too many arguments' | tee /dev/stderr logmsg Test renaming with too many arguments
abbr __abbr8 omega abbr __abbr8 omega
abbr -r __abbr8 __abbr9 __abbr10 abbr -r __abbr8 __abbr9 __abbr10
abbr | grep __abbr8 abbr | grep __abbr8
abbr | grep __abbr9 abbr | grep __abbr9
abbr | grep __abbr10 abbr | grep __abbr10
echo '# Test renaming to existing abbreviation' | tee /dev/stderr logmsg Test renaming to existing abbreviation
abbr __abbr11 omega11 abbr __abbr11 omega11
abbr __abbr12 omega12 abbr __abbr12 omega12
abbr -r __abbr11 __abbr12 abbr -r __abbr11 __abbr12
true # the last `abbr` command is expected to fail -- don't let that cause a test failure exit 0 # the last `abbr` command is expected to fail -- don't let that cause a test failure

View file

@ -0,0 +1,4 @@
function logmsg
echo "# $argv"
echo "# $argv" >&2
end