diff --git a/tests/checks/redirect.fish b/tests/checks/redirect.fish index 14bc3298c..546cd11b5 100644 --- a/tests/checks/redirect.fish +++ b/tests/checks/redirect.fish @@ -44,3 +44,47 @@ test -f $tmpdir/file.txt && echo "File exists" || echo "File does not exist" #CHECK: File exists rm -Rf $tmpdir + +# Verify that we can turn stderr into stdout and then pipe it +# Note that the order here has historically been unspecified - 'errput' could conceivably appear before 'output'. +begin ; echo output ; echo errput 1>&2 ; end 2>&1 | sort | tee ../test/temp/tee_test.txt ; cat ../test/temp/tee_test.txt +#CHECK: errput +#CHECK: output +#CHECK: errput +#CHECK: output + +# Test that trailing ^ doesn't trigger redirection, see #1873 +echo caret_no_redirect 12345^ +#CHECK: caret_no_redirect 12345^ + +# 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 +#CHECK: is_stdout + +# "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 +#CHECK: pipe 3 +#CHECK: pipe 4 +#CHECK: pipe 5 +#CHECK: pipe 6 +#CHECK: pipe 7 +#CHECK: pipe 8 +#CHECK: pipe 9 +#CHECK: pipe 10 +#CHECK: pipe 11 +#CHECK: pipe 12 diff --git a/tests/test1.err b/tests/test1.err index 0c81bfb90..849d1ddac 100644 --- a/tests/test1.err +++ b/tests/test1.err @@ -11,21 +11,9 @@ #################### # Testing builtin status -#################### -# Verify that we can turn stderr into stdout and then pipe it - -#################### -# Test that trailing ^ doesn't trigger redirection, see #1873 - -#################### -# Verify that we can pipe something other than stdout - #################### # echo tests -#################### -# Verify that pipes don't conflict with fd redirections - #################### # Comments allowed in between lines (#1987) diff --git a/tests/test1.in b/tests/test1.in index 8013c09f0..b0fc90626 100644 --- a/tests/test1.in +++ b/tests/test1.in @@ -92,19 +92,6 @@ else end echo Test 5 $sta -logmsg Verify that we can turn stderr into stdout and then pipe it -# Note that the order here has historically been unspecified - 'errput' could conceivably appear before 'output'. -begin ; echo output ; echo errput 1>&2 ; end 2>&1 | sort | tee ../test/temp/tee_test.txt ; cat ../test/temp/tee_test.txt - -logmsg "Test that trailing ^ doesn't trigger redirection, see #1873" -echo caret_no_redirect 12345^ - -logmsg 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 - #################### logmsg echo tests echo 'abc\ndef' @@ -123,21 +110,6 @@ echo -e Catch your breath echo -e 'abc\x21def' echo -e 'abc\x211def' -logmsg "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 - logmsg 'Comments allowed in between lines (#1987)' echo before comment \ # comment diff --git a/tests/test1.out b/tests/test1.out index ee2d0a047..32967f783 100644 --- a/tests/test1.out +++ b/tests/test1.out @@ -28,21 +28,6 @@ Test 4 pass # Testing builtin status Test 5 pass -#################### -# Verify that we can turn stderr into stdout and then pipe it -errput -output -errput -output - -#################### -# Test that trailing ^ doesn't trigger redirection, see #1873 -caret_no_redirect 12345^ - -#################### -# Verify that we can pipe something other than stdout -is_stdout - #################### # echo tests abc\ndef @@ -62,19 +47,6 @@ Catch your breath abc!def abc!1def -#################### -# Verify that pipes don't conflict with fd redirections -pipe 3 -pipe 4 -pipe 5 -pipe 6 -pipe 7 -pipe 8 -pipe 9 -pipe 10 -pipe 11 -pipe 12 - #################### # Comments allowed in between lines (#1987) before comment after comment