blob: ff3ef7788d1bcb1c663bf14e24c74868294ccdc3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#
#Test aliases, loops, conditionals and some basic elements
#
for i in 1 2 #Comment on same line as command
#Comment inside loop
for j in a b
#Double loop
echo $i$j
end;
end
# Simple alias tests
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
function foo
printf 'Test %s' $1; echo ' pass'
end
foo 3
for i in Test for continue break and switch builtins problems;
switch $i
case Test
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
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
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
|