From 7891973c9cc82fbb84aa4a61ad0caf7c60d5fd60 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 15 Mar 2020 15:29:23 +0100 Subject: [PATCH] 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. --- tests/checks/indent.fish | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/checks/indent.fish diff --git a/tests/checks/indent.fish b/tests/checks/indent.fish new file mode 100644 index 000000000..73edc589c --- /dev/null +++ b/tests/checks/indent.fish @@ -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 \