mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 03:01:15 -03:00
Implement tests for fish_indent
This commit is contained in:
0
tests/indent.err
Normal file
0
tests/indent.err
Normal file
78
tests/indent.in
Normal file
78
tests/indent.in
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
echo Test1
|
||||||
|
echo -n '
|
||||||
|
begin
|
||||||
|
echo hi
|
||||||
|
|
||||||
|
|
||||||
|
end | cat | cat | begin ; echo hi ; end | begin ; begin ; echo hi ; end ; end arg
|
||||||
|
' | ../fish_prettify
|
||||||
|
|
||||||
|
echo \nTest2
|
||||||
|
echo -n '
|
||||||
|
switch aloha
|
||||||
|
|
||||||
|
case alpha
|
||||||
|
echo sup
|
||||||
|
|
||||||
|
case beta gamma
|
||||||
|
echo hi
|
||||||
|
|
||||||
|
end
|
||||||
|
' | ../fish_prettify
|
||||||
|
|
||||||
|
echo \nTest3
|
||||||
|
echo -n '
|
||||||
|
function hello_world
|
||||||
|
|
||||||
|
'begin'
|
||||||
|
echo hi
|
||||||
|
end | cat
|
||||||
|
|
||||||
|
echo sup; echo sup
|
||||||
|
echo hello;
|
||||||
|
|
||||||
|
echo hello
|
||||||
|
end
|
||||||
|
' | ../fish_prettify
|
||||||
|
|
||||||
|
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' | ../fish_prettify
|
||||||
|
|
||||||
|
echo \nTest5
|
||||||
|
echo -n '
|
||||||
|
if true
|
||||||
|
else if false
|
||||||
|
echo alpha
|
||||||
|
switch beta
|
||||||
|
case gamma
|
||||||
|
echo delta
|
||||||
|
end
|
||||||
|
end
|
||||||
|
' | ../fish_prettify -i
|
||||||
|
|
||||||
|
echo \nTest6
|
||||||
|
# Test errors
|
||||||
|
echo -n '
|
||||||
|
begin
|
||||||
|
echo hi
|
||||||
|
else
|
||||||
|
echo bye
|
||||||
|
end; echo alpha "
|
||||||
|
' | ../fish_prettify
|
||||||
80
tests/indent.out
Normal file
80
tests/indent.out
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
Test1
|
||||||
|
|
||||||
|
begin
|
||||||
|
echo hi
|
||||||
|
|
||||||
|
|
||||||
|
end | cat | cat | begin
|
||||||
|
echo hi
|
||||||
|
end | begin
|
||||||
|
begin
|
||||||
|
echo hi
|
||||||
|
end
|
||||||
|
end arg
|
||||||
|
|
||||||
|
Test2
|
||||||
|
|
||||||
|
switch aloha
|
||||||
|
|
||||||
|
case alpha
|
||||||
|
echo sup
|
||||||
|
|
||||||
|
case beta gamma
|
||||||
|
echo hi
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
Test3
|
||||||
|
|
||||||
|
function hello_world
|
||||||
|
|
||||||
|
begin
|
||||||
|
echo hi
|
||||||
|
end | cat
|
||||||
|
|
||||||
|
echo sup
|
||||||
|
echo sup
|
||||||
|
echo hello
|
||||||
|
|
||||||
|
|
||||||
|
echo hello
|
||||||
|
end
|
||||||
|
|
||||||
|
Test4
|
||||||
|
|
||||||
|
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
|
||||||
|
Test5
|
||||||
|
|
||||||
|
if true
|
||||||
|
else if false
|
||||||
|
echo alpha
|
||||||
|
switch beta
|
||||||
|
case gamma
|
||||||
|
echo delta
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Test6
|
||||||
|
|
||||||
|
begin
|
||||||
|
echo hi
|
||||||
|
else
|
||||||
|
echo bye
|
||||||
|
end
|
||||||
|
echo alpha "
|
||||||
1
tests/indent.status
Normal file
1
tests/indent.status
Normal file
@@ -0,0 +1 @@
|
|||||||
|
0
|
||||||
Reference in New Issue
Block a user