aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/indent.in
blob: 2d98dd8eb79467064bf3c2c4ccf370371ece1509 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
echo Test1
echo -n '
begin
echo hi


end | cat | cat | begin ; echo hi ; end | begin ; begin ; echo hi ; end ; end arg
' | ../test/root/bin/fish_indent

echo \nTest2
echo -n '
switch aloha

   case alpha
      echo sup

   case beta gamma
      echo hi

end
' | ../test/root/bin/fish_indent

echo \nTest3
echo -n '
function hello_world

  'begin'
     echo hi
                     end | cat

   echo sup; echo sup
   echo hello;

   echo hello
                  end
' | ../test/root/bin/fish_indent

echo \nTest4
echo -n '
echo alpha         #comment1
#comment2

#comment3
for i in abc #comment1
   #comment2
  echo hi
end

switch foo #abc
   # bar
   case bar
       echo baz\
qqq
   case "*"
       echo sup
end' | ../test/root/bin/fish_indent

echo \nTest5
echo -n '
if true
else if false
    echo alpha
switch beta
   case gamma
       echo delta
end
end
' | ../test/root/bin/fish_indent -i

echo \nTest6
# Test errors
echo -n '
begin
echo hi
else
echo bye
end; echo alpha "
' | ../test/root/bin/fish_indent

echo \nTest7
# issue 1665
echo -n '
if begin ; false; end; echo hi ; end
while begin ; false; end; echo hi ; end
' | ../test/root/bin/fish_indent

echo \nTest redir formatting
# issue 2899
echo -n '
echo < stdin >>appended yes 2>&1 no > stdout maybe 2>&    4 | cat 2>| cat
' | ../test/root/bin/fish_indent

echo \nTest normalization of keywords
# issue 2921
echo -n '
i\
f true
    echo yes
en\
d

"whil\
e" true
    "builtin" yes
en"d"
' | ../test/root/bin/fish_indent