diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2014-08-21 21:36:39 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2014-08-21 21:36:39 -0700 |
commit | 033373f078db74b26dc458252734099482dc8a1a (patch) | |
tree | e0bce4834f17059cc83942eb4e3b0c036e6c2855 /tests | |
parent | d63db59adeb84251c3ab5fe1b13981e44571bf31 (diff) | |
parent | 16e50c258a5d5cecc76e1f2dc29a62be88a1ac2f (diff) |
Merge branch 'make_type_better' of github.com:kballard/fish-shell into kballard-make_type_better
Diffstat (limited to 'tests')
-rw-r--r-- | tests/read.err | 0 | ||||
-rw-r--r-- | tests/read.in | 72 | ||||
-rw-r--r-- | tests/read.out | 27 | ||||
-rw-r--r-- | tests/read.status | 1 | ||||
-rw-r--r-- | tests/test7.in | 4 | ||||
-rw-r--r-- | tests/top.out | 1 |
6 files changed, 103 insertions, 2 deletions
diff --git a/tests/read.err b/tests/read.err new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/read.err diff --git a/tests/read.in b/tests/read.in new file mode 100644 index 00000000..53f9873b --- /dev/null +++ b/tests/read.in @@ -0,0 +1,72 @@ +# +# Test read builtin and IFS +# + +count (echo one\ntwo) +set -l IFS \t +count (echo one\ntwo) +set -l IFS +count (echo one\ntwo) +set -le IFS + +function print_vars --no-scope-shadowing + set -l space + set -l IFS \n # ensure our command substitution works right + for var in $argv + echo -n $space (count $$var) \'$$var\' + set space '' + end + echo +end + +echo +echo 'hello there' | read -l one two +print_vars one two +echo 'hello there' | read -l one +print_vars one +echo '' | read -l one +print_vars one +echo '' | read -l one two +print_vars one two +echo 'test' | read -l one two three +print_vars one two three + +echo +set -l IFS +echo 'hello' | read -l one +print_vars one +echo 'hello' | read -l one two +print_vars one two +echo 'hello' | read -l one two three +print_vars one two three +echo '' | read -l one +print_vars one +echo 't' | read -l one two +print_vars one two +echo 't' | read -l one two three +print_vars one two three +echo ' t' | read -l one two +print_vars one two +set -le IFS + +echo +echo 'hello there' | read -la ary +print_vars ary +echo 'hello' | read -la ary +print_vars ary +echo 'this is a bunch of words' | read -la ary +print_vars ary +echo ' one two three' | read -la ary +print_vars ary +echo '' | read -la ary +print_vars ary + +echo +set -l IFS +echo 'hello' | read -la ary +print_vars ary +echo 'h' | read -la ary +print_vars ary +echo '' | read -la ary +print_vars ary +set -le IFS diff --git a/tests/read.out b/tests/read.out new file mode 100644 index 00000000..6d90fc0e --- /dev/null +++ b/tests/read.out @@ -0,0 +1,27 @@ +2 +2 +1 + +1 'hello' 1 'there' +1 'hello there' +1 '' +1 '' 1 '' +1 'test' 1 '' 1 '' + +1 'hello' +1 'h' 1 'ello' +1 'h' 1 'e' 1 'llo' +1 '' +1 't' 1 '' +1 't' 1 '' 1 '' +1 ' ' 1 't' + +2 'hello' 'there' +1 'hello' +6 'this' 'is' 'a' 'bunch' 'of' 'words' +3 'one' 'two' 'three' +0 + +5 'h' 'e' 'l' 'l' 'o' +1 'h' +0 diff --git a/tests/read.status b/tests/read.status new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/read.status @@ -0,0 +1 @@ +0 diff --git a/tests/test7.in b/tests/test7.in index a3ae8360..32298275 100644 --- a/tests/test7.in +++ b/tests/test7.in @@ -110,6 +110,6 @@ function fish_test_type_zzz true end # Should succeed -type fish_test_type_zzz >/dev/null ; echo $status +type -q fish_test_type_zzz ; echo $status # Should fail -type -f fish_test_type_zzz >/dev/null ; echo $status +type -q -f fish_test_type_zzz ; echo $status diff --git a/tests/top.out b/tests/top.out index 768526c6..f2873b15 100644 --- a/tests/top.out +++ b/tests/top.out @@ -1,5 +1,6 @@ Testing high level script functionality File printf.in tested ok +File read.in tested ok File test1.in tested ok File test2.in tested ok File test3.in tested ok |