From 59f0261dba993a5d632ce6e9963270a582d162e6 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Sat, 9 Apr 2016 18:56:13 -0700 Subject: enhance fish_indent to normalize keywords Fish keywords can be quoted and split across lines. Prior to this change `fish_indent` would retain such odd, obfuscated, formatting. This change results in all keywords being converted to their canonical form. This required fixing a bug: the keyword member of parse_node_t wasn't being populated. This hadn't been noticed prior to now because it wasn't used. Fixes #2921 --- tests/indent.in | 15 +++++++++++++++ tests/indent.out | 10 ++++++++++ 2 files changed, 25 insertions(+) (limited to 'tests') diff --git a/tests/indent.in b/tests/indent.in index a1143c67..2d98dd8e 100644 --- a/tests/indent.in +++ b/tests/indent.in @@ -89,3 +89,18 @@ echo \nTest redir formatting 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 diff --git a/tests/indent.out b/tests/indent.out index 6b38a72f..5a4d9dc0 100644 --- a/tests/indent.out +++ b/tests/indent.out @@ -95,3 +95,13 @@ end Test redir formatting echo >appended yes 2>&1 no >stdout maybe 2>&4 | cat 2>| cat + +Test normalization of keywords + +if true + echo yes +end + +while true + builtin yes +end -- cgit v1.2.3