mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 00:41:15 -03:00
Add subdirectories
darcs-hash:20050920133155-ac50b-9a14c6c664dd03afbe8e15e7c7998fcfb5c3c750.gz
This commit is contained in:
35
tests/test4.in
Normal file
35
tests/test4.in
Normal file
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user