diff options
author | maxfl <gmaxfl@gmail.com> | 2012-07-08 09:19:11 +0800 |
---|---|---|
committer | maxfl <gmaxfl@gmail.com> | 2012-07-08 09:19:11 +0800 |
commit | 5f05756e657d85026026d95d4ada0b6677861900 (patch) | |
tree | 569404b2d2287b9d67122de6f6e415e61f5df10c /tests | |
parent | c0e996acf8226e44da995d0e91dc26c4903e4427 (diff) |
Add variable expand ranges
echo $PATH[-1..1] #now works
Add tests for ranges
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test8.err | 0 | ||||
-rw-r--r-- | tests/test8.in | 21 | ||||
-rw-r--r-- | tests/test8.out | 9 | ||||
-rw-r--r-- | tests/test8.status | 1 | ||||
-rw-r--r-- | tests/top.out | 1 |
5 files changed, 32 insertions, 0 deletions
diff --git a/tests/test8.err b/tests/test8.err new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/test8.err diff --git a/tests/test8.in b/tests/test8.in new file mode 100644 index 00000000..e03d9d05 --- /dev/null +++ b/tests/test8.in @@ -0,0 +1,21 @@ +# Test index ranges + +# Test variable expand +set test (seq 10) +echo $test[1..10] # normal range +echo $test[10..1] # inverted range +echo $test[2..5 8..6] # several ranges +echo $test[-1..-2] # range with negative limits +echo $test[-1..1] # range with mixed limits + +# Test variable set +set test1 $test +set test1[-1..1] $test # reverse variable +echo $echo $test1 +set test1[2..4 -2..-4] $test1[4..2 -4..-2] +echo $test1 + +# Test command substitution +echo (seq 5)[-1..1] +echo (seq 10)[3..5 -2..2] + diff --git a/tests/test8.out b/tests/test8.out new file mode 100644 index 00000000..e118e572 --- /dev/null +++ b/tests/test8.out @@ -0,0 +1,9 @@ +1 2 3 4 5 6 7 8 9 10 +10 9 8 7 6 5 4 3 2 1 +2 3 4 5 8 7 6 +10 9 +10 9 8 7 6 5 4 3 2 1 +10 9 8 7 6 5 4 3 2 1 +10 7 8 9 6 5 2 3 4 1 +5 4 3 2 1 +3 4 5 9 8 7 6 5 4 3 2 diff --git a/tests/test8.status b/tests/test8.status new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/test8.status @@ -0,0 +1 @@ +0 diff --git a/tests/top.out b/tests/top.out index 5614a661..0c7b1103 100644 --- a/tests/top.out +++ b/tests/top.out @@ -6,3 +6,4 @@ File test4.in tested ok File test5.in tested ok File test6.in tested ok File test7.in tested ok +File test8.in tested ok |