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 | |||
110 | dnl ------------------------------------------------------------ | 110 | dnl ------------------------------------------------------------ |
111 | TESTWSP([append],[wsp-append],[append], | 111 | TESTWSP([append],[wsp-append],[-append], |
112 | [jeden dwa trzy | 112 | [jeden dwa trzy |
@@ -135,3 +135,3 @@ TOTAL: 2 | |||
135 | 135 | ||
136 | TESTWSP([dooffs],[wsp-doofs ],[dooffs 3 jeden dwa trzy], | 136 | TESTWSP([dooffs],[wsp-doofs ],[-dooffs jeden dwa trzy], |
137 | [cztery piec], | 137 | [cztery piec], |
@@ -216,3 +216,3 @@ TOTAL: 3 | |||
216 | 216 | ||
217 | TESTWSP([undefined variables 2],[],[keepundef], | 217 | TESTWSP([undefined variables 2],[],[-keepundef], |
218 | [a $FOO test a${FOO}b], | 218 | [a $FOO test a${FOO}b], |
@@ -228,3 +228,3 @@ TOTAL: 4 | |||
228 | 228 | ||
229 | TESTWSP([warn about undefined variables],[],[warnundef], | 229 | TESTWSP([warn about undefined variables],[],[-warnundef], |
230 | [$FOO], | 230 | [$FOO], |
@@ -237,3 +237,3 @@ TOTAL: 0 | |||
237 | 237 | ||
238 | TESTWSP([bail out on undefined variables],[],[undef], | 238 | TESTWSP([bail out on undefined variables],[],[-undef], |
239 | [$FOO], | 239 | [$FOO], |
@@ -244,3 +244,3 @@ TESTWSP([bail out on undefined variables],[],[undef], | |||
244 | 244 | ||
245 | TESTWSP([disable variable expansion],[],[novar], | 245 | TESTWSP([disable variable expansion],[],[-novar], |
246 | [$FOO], | 246 | [$FOO], |
@@ -254,3 +254,3 @@ TOTAL: 1 | |||
254 | TESTWSP([K/V environment],[wsp-env-kv wsp-env_kv], | 254 | TESTWSP([K/V environment],[wsp-env-kv wsp-env_kv], |
255 | [env_kv], | 255 | [-env_kv], |
256 | [$FOO a$BAZ], | 256 | [$FOO a$BAZ], |
@@ -264,3 +264,3 @@ TOTAL: 2 | |||
264 | 264 | ||
265 | TESTWSP([nosplit with variable expansion],[wsp-var-nosplit],[nosplit], | 265 | TESTWSP([nosplit with variable expansion],[wsp-var-nosplit],[-nosplit], |
266 | [a $FOO test], | 266 | [a $FOO test], |
@@ -273,3 +273,3 @@ TOTAL: 1 | |||
273 | 273 | ||
274 | TESTWSP([nosplit without variable expansion],[],[nosplit novar], | 274 | TESTWSP([nosplit without variable expansion],[],[-nosplit -novar], |
275 | [a $FOO test], | 275 | [a $FOO test], |
@@ -282,3 +282,3 @@ TOTAL: 1 | |||
282 | 282 | ||
283 | TESTWSP([nosplit: empty expansion],[],[nosplit trimnl], | 283 | TESTWSP([nosplit: empty expansion],[],[-nosplit -trimnl], |
284 | [$FOO], | 284 | [$FOO], |
@@ -291,11 +291,2 @@ TOTAL: 1 | |||
291 | 291 | ||
292 | TESTWSP([default value (defined)],[],[], | ||
293 | [${FOO:-bar}], | ||
294 | [NF: 1 | ||
295 | 0: qux | ||
296 | TOTAL: 1 | ||
297 | ], | ||
298 | [], | ||
299 | [FOO=qux]) | ||
300 | |||
301 | TESTWSP([default value],[],[], | 292 | TESTWSP([default value],[],[], |
@@ -453,3 +444,3 @@ WSPGROUP() | |||
453 | 444 | ||
454 | TESTWSP([ignore quotes],[wsp-ignore-quotes ],[-quote], | 445 | TESTWSP([ignore quotes],[wsp-ignore-quotes ],[-noquote], |
455 | ["a text"], | 446 | ["a text"], |
@@ -464,3 +455,3 @@ WSPGROUP(wsp-delim) | |||
464 | TESTWSP([custom delimiters (squeeze)],[], | 455 | TESTWSP([custom delimiters (squeeze)],[], |
465 | [delim : -ws trimnl], | 456 | [-delim : -nows -trimnl], |
466 | [semicolon: separated::list: of :words], | 457 | [semicolon: separated::list: of :words], |
@@ -476,3 +467,3 @@ TOTAL: 5 | |||
476 | TESTWSP([custom delimiters (no squeeze)],[], | 467 | TESTWSP([custom delimiters (no squeeze)],[], |
477 | [delim : -ws -squeeze_delims trimnl], | 468 | [-delim : -nows -nosqueeze_delims -trimnl], |
478 | [semicolon: separated::list: of :words], | 469 | [semicolon: separated::list: of :words], |
@@ -489,3 +480,3 @@ TOTAL: 6 | |||
489 | TESTWSP([custom, with returned delimiters],[], | 480 | TESTWSP([custom, with returned delimiters],[], |
490 | [delim : -ws trimnl return_delims], | 481 | [-delim : -nows -trimnl -return_delims], |
491 | [semicolon: separated::list: of :words], | 482 | [semicolon: separated::list: of :words], |
@@ -505,3 +496,3 @@ TOTAL: 9 | |||
505 | TESTWSP([custom, with returned & squeezed delimiters],[], | 496 | TESTWSP([custom, with returned & squeezed delimiters],[], |
506 | [delim : -ws trimnl return_delims -squeeze_delims], | 497 | [-delim : -nows -trimnl -return_delims -nosqueeze_delims], |
507 | [semicolon: separated::list: of :words], | 498 | [semicolon: separated::list: of :words], |
@@ -523,3 +514,3 @@ WSPGROUP(wsp-sed) | |||
523 | 514 | ||
524 | TESTWSP([sed expressions],[],[sed], | 515 | TESTWSP([sed expressions],[],[-sed], |
525 | [arg1 s/foo/bar/g;s/bar baz/quz quux/ arg2], | 516 | [arg1 s/foo/bar/g;s/bar baz/quz quux/ arg2], |
@@ -534,3 +525,3 @@ WSPGROUP() | |||
534 | 525 | ||
535 | TESTWSP([C escapes on],[wcp-c-escape],[cescapes], | 526 | TESTWSP([C escapes on],[wcp-c-escape],[-cescapes], |
536 | [a\ttab form\ffeed and new\nline], | 527 | [a\ttab form\ffeed and new\nline], |
@@ -544,3 +535,3 @@ TOTAL: 4 | |||
544 | 535 | ||
545 | TESTWSP([C escapes off],[wcp-c-escape-off],[-cescapes], | 536 | TESTWSP([C escapes off],[wcp-c-escape-off],[-nocescapes], |
546 | [a\ttab form\ffeed and new\nline], | 537 | [a\ttab form\ffeed and new\nline], |
@@ -554,3 +545,3 @@ TOTAL: 4 | |||
554 | 545 | ||
555 | TESTWSP([ws elimination],[wsp-ws-elim],[delim ' ()' ws return_delims], | 546 | TESTWSP([ws elimination],[wsp-ws-elim],[-delim ' ()' -ws -return_delims], |
556 | [( list items )], | 547 | [( list items )], |
@@ -565,3 +556,3 @@ TOTAL: 4 | |||
565 | TESTWSP([ws elimination + return delim],[wsp-ws-elim-ret], | 556 | TESTWSP([ws elimination + return delim],[wsp-ws-elim-ret], |
566 | [-default novar nocmd delim ":," return_delims ws dquote], | 557 | [-nodefault -novar -nocmd -delim ":," -return_delims -ws -dquote], |
567 | ["foo" : "bar", "quux" : "baaz" ], | 558 | ["foo" : "bar", "quux" : "baaz" ], |
@@ -578,3 +569,3 @@ TOTAL: 7 | |||
578 | 569 | ||
579 | TESTWSP([empty quotes],[wsp-empty-quotes],[delim : ws return_delims], | 570 | TESTWSP([empty quotes],[wsp-empty-quotes],[-delim : -ws -return_delims], |
580 | [t=""], | 571 | [t=""], |
@@ -586,3 +577,3 @@ TOTAL: 1 | |||
586 | TESTWSP([delimiter following empty quotes], | 577 | TESTWSP([delimiter following empty quotes], |
587 | [],[delim : ws return_delims], | 578 | [],[-delim : -ws -return_delims], |
588 | [t="":r], | 579 | [t="":r], |
@@ -597,3 +588,3 @@ TESTWSP([suppress ws trimming within quotes], | |||
597 | [], | 588 | [], |
598 | [default delim , ws return_delims], | 589 | [-default -delim , -ws -return_delims], |
599 | [nocomponent,nonewline, formatfield="In message %{text}, "], | 590 | [nocomponent,nonewline, formatfield="In message %{text}, "], |
@@ -610,3 +601,3 @@ TESTWSP([unescape], | |||
610 | [wsp-unescape wsp-unescape-simple], | 601 | [wsp-unescape wsp-unescape-simple], |
611 | [-default novar nocmd quote escape ':+:\\""'], | 602 | [-nodefault -novar -nocmd -quote -escape ':+:\\""'], |
612 | [\Seen "quote \"" "bs \\"], | 603 | [\Seen "quote \"" "bs \\"], |
@@ -621,3 +612,3 @@ TESTWSP([unescape: word/quote], | |||
621 | [wsp-unescape wsp-unescape-word], | 612 | [wsp-unescape wsp-unescape-word], |
622 | [-default novar nocmd quote escape-word '\\""' escape-quote ':+0x:\\""'], | 613 | [-nodefault -novar -nocmd -quote -escape-word '\\""' -escape-quote ':+0x:\\""'], |
623 | [\Seen "quote \"" "bs \\" "3\x31 \101" 3\x31 \101], | 614 | [\Seen "quote \"" "bs \\" "3\x31 \101" 3\x31 \101], |
@@ -633,3 +624,3 @@ TOTAL: 6 | |||
633 | 624 | ||
634 | TESTWSP([dquote],[],[-default novar nocmd dquote], | 625 | TESTWSP([dquote],[],[-nodefault -novar -nocmd -dquote], |
635 | [a "quoted example" isn't it], | 626 | [a "quoted example" isn't it], |
@@ -643,3 +634,3 @@ TOTAL: 4 | |||
643 | 634 | ||
644 | TESTWSP([squote],[],[-default novar nocmd squote], | 635 | TESTWSP([squote],[],[-nodefault -novar -nocmd -squote], |
645 | [a 'quoted example' isn"t it], | 636 | [a 'quoted example' isn"t it], |
@@ -655,3 +646,3 @@ WSPGROUP(wsp-incr) | |||
655 | 646 | ||
656 | TESTWSP([incremental],[],[incremental], | 647 | TESTWSP([incremental],[],[-incremental], |
657 | [incremental "input test" line | 648 | [incremental "input test" line |
@@ -673,3 +664,3 @@ TOTAL: 3 | |||
673 | 664 | ||
674 | TESTWSP([incremental append],[],[incremental append], | 665 | TESTWSP([incremental append],[],[-incremental -append], |
675 | [incremental "input test" line | 666 | [incremental "input test" line |
@@ -695,3 +686,3 @@ TOTAL: 3 | |||
695 | TESTWSP([incremental ws], | 686 | TESTWSP([incremental ws], |
696 | [],[return_delims -squeeze_delims incremental ws], | 687 | [],[-return_delims -nosqueeze_delims -incremental -ws], |
697 | [a list test | 688 | [a list test |
@@ -713,3 +704,3 @@ TOTAL: 3 | |||
713 | 704 | ||
714 | TESTWSP([incremental nosplit],[],[incremental nosplit], | 705 | TESTWSP([incremental nosplit],[],[-incremental -nosplit], |
715 | [incremental "input test" line | 706 | [incremental "input test" line |
@@ -723,3 +714,3 @@ TOTAL: 1 | |||
723 | 714 | ||
724 | TESTWSP([simple command substitution],[],[-nocmd], | 715 | TESTWSP([simple command substitution],[],[-cmd], |
725 | [begin $(words a b) end], | 716 | [begin $(words a b) end], |
@@ -733,3 +724,3 @@ TOTAL: 4 | |||
733 | 724 | ||
734 | TESTWSP([quoted command substitution],[],[-nocmd], | 725 | TESTWSP([quoted command substitution],[],[-cmd], |
735 | [begin "$(words a b)" end], | 726 | [begin "$(words a b)" end], |
@@ -742,3 +733,3 @@ TOTAL: 3 | |||
742 | 733 | ||
743 | TESTWSP([coalesced command substitution],[],[-nocmd], | 734 | TESTWSP([coalesced command substitution],[],[-cmd], |
744 | [begin($(words a b))end], | 735 | [begin($(words a b))end], |
@@ -750,3 +741,3 @@ TOTAL: 2 | |||
750 | 741 | ||
751 | TESTWSP([quoted coalesced command substitution],[],[-nocmd], | 742 | TESTWSP([quoted coalesced command substitution],[],[-cmd], |
752 | ["begin($(words a b))end"], | 743 | ["begin($(words a b))end"], |
@@ -757,3 +748,3 @@ TOTAL: 1 | |||
757 | 748 | ||
758 | TESTWSP([variable and command substitution],[],[-nocmd -novar], | 749 | TESTWSP([variable and command substitution],[],[-cmd -var], |
759 | [begin $X $(words $X $Y) end], | 750 | [begin $X $(words $X $Y) end], |
@@ -768,3 +759,3 @@ TOTAL: 5 | |||
768 | 759 | ||
769 | TESTWSP([variable expansion and command substitution in quotes],[],[-nocmd -novar], | 760 | TESTWSP([variable expansion and command substitution in quotes],[],[-cmd -var], |
770 | ["${BEGIN}($(words $X $Y))end"], | 761 | ["${BEGIN}($(words $X $Y))end"], |
@@ -775,3 +766,3 @@ TOTAL: 1 | |||
775 | 766 | ||
776 | TESTWSP([nested commands],[],[-nocmd -novar], | 767 | TESTWSP([nested commands],[],[-cmd -var], |
777 | [$(words output $(words in$SUFFIX text) end)], | 768 | [$(words output $(words in$SUFFIX text) end)], |
@@ -794,3 +785,3 @@ mkdir dir | |||
794 | 785 | ||
795 | wsp pathexpand<<'EOT' | 786 | wsp -pathexpand<<'EOT' |
796 | begin dir/*.c end | 787 | begin dir/*.c end |
@@ -815,3 +806,3 @@ mkdir dir | |||
815 | 806 | ||
816 | wsp pathexpand<<'EOT' | 807 | wsp -pathexpand<<'EOT' |
817 | begin dir/*.d end | 808 | begin dir/*.d end |
@@ -835,3 +826,3 @@ mkdir dir | |||
835 | 826 | ||
836 | wsp pathexpand nullglob<<'EOT' | 827 | wsp -pathexpand -nullglob<<'EOT' |
837 | begin dir/*.d end | 828 | begin dir/*.d end |
@@ -854,3 +845,3 @@ mkdir dir | |||
854 | 845 | ||
855 | wsp pathexpand failglob<<'EOT' | 846 | wsp -pathexpand -failglob<<'EOT' |
856 | begin dir/*.d end | 847 | begin dir/*.d end |
@@ -864,3 +855,3 @@ AT_CLEANUP | |||
864 | 855 | ||
865 | TESTWSP([append],[],[-- extra arguments follow], | 856 | TESTWSP([append],[],[-append-args extra arguments follow], |
866 | [some words and], | 857 | [some words and], |
@@ -877,3 +868,3 @@ TOTAL: 3 | |||
877 | TESTWSP([append + dooffs + env],[], | 868 | TESTWSP([append + dooffs + env],[], |
878 | [-env dooffs 2 preface words V=2 -- extra arguments follow], | 869 | [-env none -dooffs preface words -- V=2 -append-args extra arguments follow], |
879 | [some words and var=$V], | 870 | [some words and var=$V], |
@@ -894,3 +885,3 @@ TOTAL: 4 | |||
894 | TESTWSP([maxwords],[], | 885 | TESTWSP([maxwords],[], |