diff options
Diffstat (limited to 'tests/wordsplit.at')
-rw-r--r-- | tests/wordsplit.at | 122 |
1 files changed, 63 insertions, 59 deletions
diff --git a/tests/wordsplit.at b/tests/wordsplit.at index 1f2e80d..ebd168b 100644 --- a/tests/wordsplit.at +++ b/tests/wordsplit.at @@ -110,3 +110,3 @@ dnl Test worsplit-specific behavior dnl ------------------------------------------------------------ -TESTWSP([append],[wsp-append],[append], +TESTWSP([append],[wsp-append],[-append], [jeden dwa trzy @@ -135,3 +135,3 @@ TOTAL: 2 -TESTWSP([dooffs],[wsp-doofs ],[dooffs 3 jeden dwa trzy], +TESTWSP([dooffs],[wsp-doofs ],[-dooffs jeden dwa trzy], [cztery piec], @@ -216,3 +216,3 @@ TOTAL: 3 -TESTWSP([undefined variables 2],[],[keepundef], +TESTWSP([undefined variables 2],[],[-keepundef], [a $FOO test a${FOO}b], @@ -228,3 +228,3 @@ TOTAL: 4 -TESTWSP([warn about undefined variables],[],[warnundef], +TESTWSP([warn about undefined variables],[],[-warnundef], [$FOO], @@ -237,3 +237,3 @@ TOTAL: 0 -TESTWSP([bail out on undefined variables],[],[undef], +TESTWSP([bail out on undefined variables],[],[-undef], [$FOO], @@ -244,3 +244,3 @@ TESTWSP([bail out on undefined variables],[],[undef], -TESTWSP([disable variable expansion],[],[novar], +TESTWSP([disable variable expansion],[],[-novar], [$FOO], @@ -254,3 +254,3 @@ TOTAL: 1 TESTWSP([K/V environment],[wsp-env-kv wsp-env_kv], -[env_kv], +[-env_kv], [$FOO a$BAZ], @@ -264,3 +264,3 @@ TOTAL: 2 -TESTWSP([nosplit with variable expansion],[wsp-var-nosplit],[nosplit], +TESTWSP([nosplit with variable expansion],[wsp-var-nosplit],[-nosplit], [a $FOO test], @@ -273,3 +273,3 @@ TOTAL: 1 -TESTWSP([nosplit without variable expansion],[],[nosplit novar], +TESTWSP([nosplit without variable expansion],[],[-nosplit -novar], [a $FOO test], @@ -282,3 +282,3 @@ TOTAL: 1 -TESTWSP([nosplit: empty expansion],[],[nosplit trimnl], +TESTWSP([nosplit: empty expansion],[],[-nosplit -trimnl], [$FOO], @@ -291,11 +291,2 @@ TOTAL: 1 -TESTWSP([default value (defined)],[],[], -[${FOO:-bar}], -[NF: 1 -0: qux -TOTAL: 1 -], -[], -[FOO=qux]) - TESTWSP([default value],[],[], @@ -453,3 +444,3 @@ WSPGROUP() -TESTWSP([ignore quotes],[wsp-ignore-quotes ],[-quote], +TESTWSP([ignore quotes],[wsp-ignore-quotes ],[-noquote], ["a text"], @@ -464,3 +455,3 @@ WSPGROUP(wsp-delim) TESTWSP([custom delimiters (squeeze)],[], -[delim : -ws trimnl], +[-delim : -nows -trimnl], [semicolon: separated::list: of :words], @@ -476,3 +467,3 @@ TOTAL: 5 TESTWSP([custom delimiters (no squeeze)],[], -[delim : -ws -squeeze_delims trimnl], +[-delim : -nows -nosqueeze_delims -trimnl], [semicolon: separated::list: of :words], @@ -489,3 +480,3 @@ TOTAL: 6 TESTWSP([custom, with returned delimiters],[], -[delim : -ws trimnl return_delims], +[-delim : -nows -trimnl -return_delims], [semicolon: separated::list: of :words], @@ -505,3 +496,3 @@ TOTAL: 9 TESTWSP([custom, with returned & squeezed delimiters],[], -[delim : -ws trimnl return_delims -squeeze_delims], +[-delim : -nows -trimnl -return_delims -nosqueeze_delims], [semicolon: separated::list: of :words], @@ -523,3 +514,3 @@ WSPGROUP(wsp-sed) -TESTWSP([sed expressions],[],[sed], +TESTWSP([sed expressions],[],[-sed], [arg1 s/foo/bar/g;s/bar baz/quz quux/ arg2], @@ -534,3 +525,3 @@ WSPGROUP() -TESTWSP([C escapes on],[wcp-c-escape],[cescapes], +TESTWSP([C escapes on],[wcp-c-escape],[-cescapes], [a\ttab form\ffeed and new\nline], @@ -544,3 +535,3 @@ TOTAL: 4 -TESTWSP([C escapes off],[wcp-c-escape-off],[-cescapes], +TESTWSP([C escapes off],[wcp-c-escape-off],[-nocescapes], [a\ttab form\ffeed and new\nline], @@ -554,3 +545,3 @@ TOTAL: 4 -TESTWSP([ws elimination],[wsp-ws-elim],[delim ' ()' ws return_delims], +TESTWSP([ws elimination],[wsp-ws-elim],[-delim ' ()' -ws -return_delims], [( list items )], @@ -565,3 +556,3 @@ TOTAL: 4 TESTWSP([ws elimination + return delim],[wsp-ws-elim-ret], -[-default novar nocmd delim ":," return_delims ws dquote], +[-nodefault -novar -nocmd -delim ":," -return_delims -ws -dquote], ["foo" : "bar", "quux" : "baaz" ], @@ -578,3 +569,3 @@ TOTAL: 7 -TESTWSP([empty quotes],[wsp-empty-quotes],[delim : ws return_delims], +TESTWSP([empty quotes],[wsp-empty-quotes],[-delim : -ws -return_delims], [t=""], @@ -586,3 +577,3 @@ TOTAL: 1 TESTWSP([delimiter following empty quotes], -[],[delim : ws return_delims], +[],[-delim : -ws -return_delims], [t="":r], @@ -597,3 +588,3 @@ TESTWSP([suppress ws trimming within quotes], [], -[default delim , ws return_delims], +[-default -delim , -ws -return_delims], [nocomponent,nonewline, formatfield="In message %{text}, "], @@ -610,3 +601,3 @@ TESTWSP([unescape], [wsp-unescape wsp-unescape-simple], -[-default novar nocmd quote escape ':+:\\""'], +[-nodefault -novar -nocmd -quote -escape ':+:\\""'], [\Seen "quote \"" "bs \\"], @@ -621,3 +612,3 @@ TESTWSP([unescape: word/quote], [wsp-unescape wsp-unescape-word], -[-default novar nocmd quote escape-word '\\""' escape-quote ':+0x:\\""'], +[-nodefault -novar -nocmd -quote -escape-word '\\""' -escape-quote ':+0x:\\""'], [\Seen "quote \"" "bs \\" "3\x31 \101" 3\x31 \101], @@ -633,3 +624,3 @@ TOTAL: 6 -TESTWSP([dquote],[],[-default novar nocmd dquote], +TESTWSP([dquote],[],[-nodefault -novar -nocmd -dquote], [a "quoted example" isn't it], @@ -643,3 +634,3 @@ TOTAL: 4 -TESTWSP([squote],[],[-default novar nocmd squote], +TESTWSP([squote],[],[-nodefault -novar -nocmd -squote], [a 'quoted example' isn"t it], @@ -655,3 +646,3 @@ WSPGROUP(wsp-incr) -TESTWSP([incremental],[],[incremental], +TESTWSP([incremental],[],[-incremental], [incremental "input test" line @@ -673,3 +664,3 @@ TOTAL: 3 -TESTWSP([incremental append],[],[incremental append], +TESTWSP([incremental append],[],[-incremental -append], [incremental "input test" line @@ -695,3 +686,3 @@ TOTAL: 3 TESTWSP([incremental ws], -[],[return_delims -squeeze_delims incremental ws], +[],[-return_delims -nosqueeze_delims -incremental -ws], [a list test @@ -713,3 +704,3 @@ TOTAL: 3 -TESTWSP([incremental nosplit],[],[incremental nosplit], +TESTWSP([incremental nosplit],[],[-incremental -nosplit], [incremental "input test" line @@ -723,3 +714,3 @@ TOTAL: 1 -TESTWSP([simple command substitution],[],[-nocmd], +TESTWSP([simple command substitution],[],[-cmd], [begin $(words a b) end], @@ -733,3 +724,3 @@ TOTAL: 4 -TESTWSP([quoted command substitution],[],[-nocmd], +TESTWSP([quoted command substitution],[],[-cmd], [begin "$(words a b)" end], @@ -742,3 +733,3 @@ TOTAL: 3 -TESTWSP([coalesced command substitution],[],[-nocmd], +TESTWSP([coalesced command substitution],[],[-cmd], [begin($(words a b))end], @@ -750,3 +741,3 @@ TOTAL: 2 -TESTWSP([quoted coalesced command substitution],[],[-nocmd], +TESTWSP([quoted coalesced command substitution],[],[-cmd], ["begin($(words a b))end"], @@ -757,3 +748,3 @@ TOTAL: 1 -TESTWSP([variable and command substitution],[],[-nocmd -novar], +TESTWSP([variable and command substitution],[],[-cmd -var], [begin $X $(words $X $Y) end], @@ -768,3 +759,3 @@ TOTAL: 5 -TESTWSP([variable expansion and command substitution in quotes],[],[-nocmd -novar], +TESTWSP([variable expansion and command substitution in quotes],[],[-cmd -var], ["${BEGIN}($(words $X $Y))end"], @@ -775,3 +766,3 @@ TOTAL: 1 -TESTWSP([nested commands],[],[-nocmd -novar], +TESTWSP([nested commands],[],[-cmd -var], [$(words output $(words in$SUFFIX text) end)], @@ -794,3 +785,3 @@ mkdir dir -wsp pathexpand<<'EOT' +wsp -pathexpand<<'EOT' begin dir/*.c end @@ -815,3 +806,3 @@ mkdir dir -wsp pathexpand<<'EOT' +wsp -pathexpand<<'EOT' begin dir/*.d end @@ -835,3 +826,3 @@ mkdir dir -wsp pathexpand nullglob<<'EOT' +wsp -pathexpand -nullglob<<'EOT' begin dir/*.d end @@ -854,3 +845,3 @@ mkdir dir -wsp pathexpand failglob<<'EOT' +wsp -pathexpand -failglob<<'EOT' begin dir/*.d end @@ -864,3 +855,3 @@ AT_CLEANUP -TESTWSP([append],[],[-- extra arguments follow], +TESTWSP([append],[],[-append-args extra arguments follow], [some words and], @@ -877,3 +868,3 @@ TOTAL: 3 TESTWSP([append + dooffs + env],[], -[-env dooffs 2 preface words V=2 -- extra arguments follow], +[-env none -dooffs preface words -- V=2 -append-args extra arguments follow], [some words and var=$V], @@ -894,3 +885,3 @@ TOTAL: 4 TESTWSP([maxwords],[], -[trimnl maxwords 3], +[-trimnl -maxwords 3], [ws_maxwords limits the number of returned words], @@ -904,3 +895,3 @@ TOTAL: 3 TESTWSP([maxwords return_delims],[], -[trimnl maxwords 8 return_delims delim :-], +[-trimnl -maxwords 8 -return_delims -delim :-], [foo:::bar-:baz-quux:ux:zu], @@ -919,3 +910,3 @@ TOTAL: 8 TESTWSP([maxwords return_delims -squeeze_delims],[], -[trimnl maxwords 8 return_delims -squeeze_delims delim :-], +[-trimnl -maxwords 8 -return_delims -nosqueeze_delims -delim :-], [foo:::bar-:baz:qux-], @@ -934,3 +925,3 @@ TOTAL: 8 TESTWSP([maxwords incremental],[], -[trimnl maxwords 3 incremental], +[-trimnl -maxwords 3 -incremental], [foo bar baz qux uz @@ -952,3 +943,3 @@ TOTAL: 3 -TESTWSP([variable nosplit],[],[novar novarsplit], +TESTWSP([variable nosplit],[],[-novar -novarsplit], [begin ${VAR:- a b} end], @@ -961,3 +952,3 @@ TOTAL: 3 -TESTWSP([command nosplit],[],[nocmd nocmdsplit], +TESTWSP([command nosplit],[],[-nocmd -nocmdsplit], [begin $(words a b) end], @@ -970,2 +961,15 @@ TOTAL: 3 +TESTWSP([positional parameters],[],[one two three four five six seven eight nine ten eleven twelve], +[$0 $5 ${10} +$#], +[NF: 3 +0: one +1: six +2: eleven +TOTAL: 3 +NF: 1 +0: 12 +TOTAL: 1 +]) + m4_popdef([TESTWSP]) |