fish-shell/tests/indent.in
Kurtis Rader 8b67a1b26f make testing on local servers hermetic
I noticed while fixing issue #2702 that the fish program being tested
was sourcing config.fish files outside of the current build. This also
happens when Travis CI runs the tests but isn't an issue there because
of how Travis is configured to execute the tests.

I also noticed that running `make test` was polluting my personal fish
history; which will become a bigger problem if and when the fishd universal
var file is moved from $XDG_CONFIG_HOME to $XDG_DATA_HOME.

This change makes it possible for an individual to run the tests on
their local machine secure in the knowledge that only the config.fish and
related files from their git repository will be used and doing so won't
pollute their personal fish history.

Resolves #469
2016-02-25 17:16:36 -08:00

85 lines
1.1 KiB
Text

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