fish_indent: Add check

This isn't quite the old-style test, but it checks some of the line
continuation stuff.

Note that littlecheck ignores leading whitespace, so testing the
actual indentation requires some more effort.
This commit is contained in:
Fabian Homborg 2020-03-15 15:29:23 +01:00
parent cb16d9e741
commit 7891973c9c

64
tests/checks/indent.fish Normal file
View File

@ -0,0 +1,64 @@
# RUN: %fish -C 'set -g fish_indent %fish_indent' %s
# Test file for fish_indent
echo 'echo foo \\
| cat' | $fish_indent
#CHECK: echo foo \
#CHECK: | cat
echo 'echo foo | \\
cat' | $fish_indent
#CHECK: echo foo | cat
echo 'echo foo |
cat' | $fish_indent
#CHECK: echo foo |
#CHECK: cat
echo 'if true; \\
or false
echo something
end' | $fish_indent
#CHECK: if true; or false
#CHECK: echo something
#CHECK: end
echo '\\
echo wurst' | $fish_indent
#CHECK: echo wurst
echo 'echo foo \\
brot' | $fish_indent
#CHECK: echo foo \
#CHECK: brot
echo 'echo rabarber \\
banana' | $fish_indent
#CHECK: echo rabarber \
#CHECK: banana
echo 'for x in a \\
b \\
c
echo thing
end' | $fish_indent
#CHECK: for x in a \
#CHECK: b \
#CHECK: c
#CHECK: echo thing
#CHECK: end
echo 'echo foo |
echo banana' | $fish_indent
#CHECK: echo foo |
#CHECK: echo banana
echo 'echo foo \\
;' | $fish_indent
#CHECK: echo foo \
#CHECK:
echo 'echo foo \\
' | $fish_indent
#CHECK: echo foo \