aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Julian Aron Prenner <julian@linux4you.it>2014-01-15 15:27:06 +0100
committerGravatar Julian Aron Prenner <julian@linux4you.it>2014-01-15 15:27:06 +0100
commit213e9070446b60c9e6ad7140a6063cd957f241e4 (patch)
tree84020202d4daa8df2db3b2533e8963217bb46c49 /tests
parentc8d5131a42b8117987d2a278d69edb21a7cf9383 (diff)
parent370b47d23f3cfde3e385c2268adb95229f0f7ed7 (diff)
Merge remote-tracking branch 'upstream/master' into bind_mode
Conflicts: builtin.cpp reader.cpp share/functions/fish_default_key_bindings.fish
Diffstat (limited to 'tests')
-rw-r--r--tests/test1.in8
-rw-r--r--tests/test1.out1
-rw-r--r--tests/test7.in9
-rw-r--r--tests/test7.out1
-rw-r--r--tests/test9.in36
-rw-r--r--tests/test9.out6
6 files changed, 50 insertions, 11 deletions
diff --git a/tests/test1.in b/tests/test1.in
index c180159c..7f60a4da 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
@@ -99,6 +99,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'
diff --git a/tests/test1.out b/tests/test1.out
index c6ecbb30..b3460cdd 100644
--- a/tests/test1.out
+++ b/tests/test1.out
@@ -23,6 +23,7 @@ errput
output
errput
output
+is_stdout
abc\ndef
abc
def
diff --git a/tests/test7.in b/tests/test7.in
index 22f5d92c..a3ae8360 100644
--- a/tests/test7.in
+++ b/tests/test7.in
@@ -20,15 +20,6 @@ case one
echo $status
end
-# Test that non-case tokens inside `switch` don't blow away status
-# (why are these even allowed?)
-false
-switch one
-true
-case one
- echo $status
-end
-
#test contains -i
echo test contains -i
contains -i string a b c string d
diff --git a/tests/test7.out b/tests/test7.out
index fd3b8a70..bbe2ab1a 100644
--- a/tests/test7.out
+++ b/tests/test7.out
@@ -4,7 +4,6 @@
0
1
-1
test contains -i
4
nothing
diff --git a/tests/test9.in b/tests/test9.in
index a38fbc7c..e449a21d 100644
--- a/tests/test9.in
+++ b/tests/test9.in
@@ -35,3 +35,39 @@ emit test3 foo bar
# test empty argument
emit
+
+echo "Test break and continue"
+# This should output Ping once
+for i in a b c
+ if not contains $i c ; continue ; end
+ echo Ping
+end
+
+# This should output Pong not at all
+for i in a b c
+ if not contains $i c ; break ; end
+ echo Pong
+end
+
+# This should output Foop three times, and Boop not at all
+set i a a a
+while contains $i a
+ set -e i[-1]
+ echo Foop
+ continue
+ echo Boop
+end
+
+# This should output Doop once
+set i a a a
+while contains $i a
+ set -e i[-1]
+ echo Doop
+ break
+ echo Darp
+end
+
+# Test implicit cd. This should do nothing.
+./
+
+false
diff --git a/tests/test9.out b/tests/test9.out
index 8e19365c..cf9054f8 100644
--- a/tests/test9.out
+++ b/tests/test9.out
@@ -2,3 +2,9 @@ Testing that builtins can truncate files
abc
before:test1
received event test3 with args: foo bar
+Test break and continue
+Ping
+Foop
+Foop
+Foop
+Doop