fish-shell/tests/test1.in

76 lines
948 B
Text
Raw Normal View History

#
2010-11-23 15:05:21 +00:00
#Test aliases, loops, conditionals and some basic elements
#
for i in 1 2 #Comment on same line as command
2010-09-18 02:18:26 +00:00
#Comment inside loop
for j in a b
#Double loop
echo $i$j
end;
end
# Simple alias tests
2010-09-18 02:18:26 +00:00
function foo
echo >foo.txt $argv
end
foo hello
cat foo.txt |read foo
if test $foo = hello;
echo Test 2 pass
else
echo Test 2 fail
end
2010-09-18 02:18:26 +00:00
function foo
printf 'Test %s' $1; echo ' pass'
end
2010-09-18 02:18:26 +00:00
foo 3
for i in Test for continue break and switch builtins problems;
switch $i
case Test
2010-09-18 02:18:26 +00:00
printf "%s " $i
case "f??"
printf "%s " 3
case "c*"
echo pass
case break
continue
echo fail
case and
break
echo fail
case "*"
echo fail
end
end
2010-11-23 15:05:21 +00:00
set -l sta
if eval true
if eval false
set sta fail
else
set sta pass
end
else
set sta fail
end
echo Test 4 $sta
2010-11-23 16:35:56 +00:00
function test_builtin_status
return 1
end
test_builtin_status
if [ $status -eq 1 ]
set sta pass
else
set sta fail
end
echo Test 5 $sta