aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test1.in
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test1.in')
-rw-r--r--tests/test1.in45
1 files changed, 44 insertions, 1 deletions
diff --git a/tests/test1.in b/tests/test1.in
index c180159c..a66bf598 100644
--- a/tests/test1.in
+++ b/tests/test1.in
@@ -15,7 +15,7 @@ echo x-{1}
echo x-{1,2}
echo foo-{1,2{3,4}}
-# Escpaed newlines
+# Escaped newlines
echo foo\ bar
echo foo\
bar
@@ -83,6 +83,11 @@ else
end
echo Test 4 $sta
+# Ensure eval doesn't unnecessarily mess with the exit status
+function empty_func ; end
+false ; eval empty_func ; echo $status
+true ; eval empty_func ; echo $status
+
function test_builtin_status
return 1
end
@@ -99,6 +104,12 @@ echo Test 5 $sta
echo Test redirections
begin ; echo output ; echo errput 1>&2 ; end 2>&1 | tee /tmp/tee_test.txt ; cat /tmp/tee_test.txt
+# Verify that we can pipe something other than stdout
+# The first line should be printed, since we output to stdout but pipe stderr to /dev/null
+# The second line should not be printed, since we output to stderr and pipe it to /dev/null
+begin ; echo is_stdout ; end 2>| cat > /dev/null
+begin ; echo is_stderr 1>&2 ; end 2>| cat > /dev/null
+
# echo tests
echo 'abc\ndef'
@@ -110,8 +121,40 @@ echo -e 'abc\121def'
echo -e 'abc\1212def'
echo -e 'abc\cdef' # won't output a newline!
echo ''
+echo -
+
+echo -ne '\376' | xxd -p
echo -e Catch your breath
echo -e 'abc\x21def'
echo -e 'abc\x211def'
+
+# Verify that pipes don’t conflict with fd redirections
+# This code is very similar to eval. We go over a bunch of fads
+# to make it likely that we will nominally conflict with a pipe
+# fish is supposed to detect this case and dup the pipe to something else
+echo "/bin/echo pipe 3 <&3 3<&-" | source 3<&0
+echo "/bin/echo pipe 4 <&4 4<&-" | source 4<&0
+echo "/bin/echo pipe 5 <&5 5<&-" | source 5<&0
+echo "/bin/echo pipe 6 <&6 6<&-" | source 6<&0
+echo "/bin/echo pipe 7 <&7 7<&-" | source 7<&0
+echo "/bin/echo pipe 8 <&8 8<&-" | source 8<&0
+echo "/bin/echo pipe 9 <&9 9<&-" | source 9<&0
+echo "/bin/echo pipe 10 <&10 10<&-" | source 10<&0
+echo "/bin/echo pipe 11 <&11 11<&-" | source 11<&0
+echo "/bin/echo pipe 12 <&12 12<&-" | source 12<&0
+
+
+# Make sure while loops don't run forever with no-exec (#1543)
+echo "Checking for infinite loops in no-execute"
+echo "while true; end" | ../fish --no-execute
+
+function always_fails
+ if true
+ return 1
+ end
+end
+
+always_fails ; echo $status
+