aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test4.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/test4.in
parent149594f974350bb364a76c73b91b1d5ffddaa1fa (diff)
Add subdirectories
darcs-hash:20050920133155-ac50b-9a14c6c664dd03afbe8e15e7c7998fcfb5c3c750.gz
Diffstat (limited to 'tests/test4.in')
-rw-r--r--tests/test4.in35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test4.in b/tests/test4.in
new file mode 100644
index 00000000..75c2c7ec
--- /dev/null
+++ b/tests/test4.in
@@ -0,0 +1,35 @@
+#Test scoping rules for functions
+
+set -e smurf
+
+function setter
+set smurf green
+end
+
+function unsetter
+set -e smurf
+end
+
+function call1
+set smurf blue; setter; if test $smurf = blue; echo Test 1 pass; else; echo Test 1 fail; end
+end
+
+function call2
+set smurf blue; unsetter; if test $smurf = blue; echo Test 2 pass; else; echo Test 2 fail; end
+end
+
+call1
+call2
+
+function call3
+setter; if test $smurf = green; echo Test 3 pass; else; echo Test 3 fail; end
+end
+
+function call4
+unsetter; if test !$smurf; echo Test 4 pass; else; echo Test 4 fail; end
+end
+
+set -g smurf yellow
+call3
+call4
+