aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test3.in
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2005-09-20 23:31:55 +1000
committerGravatar axel <axel@liljencrantz.se>2005-09-20 23:31:55 +1000
commit7ddecde54372c25fcf526e2d24807c5dac9800aa (patch)
tree1bff6e0ccd096836adb74529d53a6debcf45375b /tests/test3.in
parent149594f974350bb364a76c73b91b1d5ffddaa1fa (diff)
Add subdirectories
darcs-hash:20050920133155-ac50b-9a14c6c664dd03afbe8e15e7c7998fcfb5c3c750.gz
Diffstat (limited to 'tests/test3.in')
-rw-r--r--tests/test3.in113
1 files changed, 113 insertions, 0 deletions
diff --git a/tests/test3.in b/tests/test3.in
new file mode 100644
index 00000000..3fccaa03
--- /dev/null
+++ b/tests/test3.in
@@ -0,0 +1,113 @@
+# Environment variable tests
+
+#Test if variables can be properly set
+
+set smurf blue
+
+if test $smurf = blue
+ echo Test 1 pass
+else
+ echo Test 1 fail
+end
+
+# Test if variables can be erased
+
+set -e smurf
+
+if test $smurf
+ echo Test 2 fail
+else
+ echo Test 2 pass
+end
+
+# Test if local variables go out of scope
+
+if true
+ set t3 bar
+end
+
+if test $t3
+ echo Test 3 fail
+else
+ echo Test 3 pass
+end
+
+# Test if globals can be set in block scope
+
+if true
+ set -g baz qux
+end
+
+if test $baz = qux
+ echo Test 4 pass
+else
+ echo Test 4 fail
+end
+
+
+#Test that scope is preserved when setting a new value
+
+set t5 a
+
+if true
+ set t5 b
+end
+
+if test $t5 = b
+ echo Test 5 pass
+else
+ echo Test 5 fail
+end
+
+# Test that scope is preserved in double blocks
+
+for i in 1
+ set t6 $i
+ for j in a
+ if test $t6$j = 1a
+ echo Test 6 pass
+ else
+ echo Test 6 fail
+ end
+ end
+end
+
+
+# Test if variables in for loop blocks do not go out of scope on new laps
+
+set res fail
+
+for i in 1 2
+ set t7
+ if test $i = 1
+ set t7 b
+ else
+ if test $t7 = b
+ set res pass
+ end
+ end
+end
+
+echo Test 7 $res
+
+# Test if variables are properly exported
+
+if true
+ set -x t8 foo
+ if test (fish -c "echo $t8") = foo
+ echo Test 8 pass
+ else
+ echo Test 8 fail
+ end
+end
+
+# Test if exported variables go out of scope
+
+if test (fish -c "echo $t8") = foo
+ echo Test 9 fail
+else
+ echo Test 9 pass
+end
+
+
+