aboutsummaryrefslogtreecommitdiff
path: root/tests/wordsplit.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/wordsplit.at')
-rw-r--r--tests/wordsplit.at122
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
@@ -109,5 +109,5 @@ dnl ------------------------------------------------------------
109dnl Test worsplit-specific behavior 109dnl Test worsplit-specific behavior
110dnl ------------------------------------------------------------ 110dnl ------------------------------------------------------------
111TESTWSP([append],[wsp-append],[append], 111TESTWSP([append],[wsp-append],[-append],
112[jeden dwa trzy 112[jeden dwa trzy
113cztery 113cztery
@@ -134,5 +134,5 @@ TOTAL: 2
134]) 134])
135 135
136TESTWSP([dooffs],[wsp-doofs ],[dooffs 3 jeden dwa trzy], 136TESTWSP([dooffs],[wsp-doofs ],[-dooffs jeden dwa trzy],
137[cztery piec], 137[cztery piec],
138[NF: 2 (3) 138[NF: 2 (3)
@@ -215,5 +215,5 @@ TOTAL: 3
215[unset FOO;]) 215[unset FOO;])
216 216
217TESTWSP([undefined variables 2],[],[keepundef], 217TESTWSP([undefined variables 2],[],[-keepundef],
218[a $FOO test a${FOO}b], 218[a $FOO test a${FOO}b],
219[NF: 4 219[NF: 4
@@ -227,5 +227,5 @@ TOTAL: 4
227[unset FOO;]) 227[unset FOO;])
228 228
229TESTWSP([warn about undefined variables],[],[warnundef], 229TESTWSP([warn about undefined variables],[],[-warnundef],
230[$FOO], 230[$FOO],
231[NF: 0 231[NF: 0
@@ -236,5 +236,5 @@ TOTAL: 0
236[unset FOO;]) 236[unset FOO;])
237 237
238TESTWSP([bail out on undefined variables],[],[undef], 238TESTWSP([bail out on undefined variables],[],[-undef],
239[$FOO], 239[$FOO],
240[], 240[],
@@ -243,5 +243,5 @@ TESTWSP([bail out on undefined variables],[],[undef],
243[unset FOO;]) 243[unset FOO;])
244 244
245TESTWSP([disable variable expansion],[],[novar], 245TESTWSP([disable variable expansion],[],[-novar],
246[$FOO], 246[$FOO],
247[NF: 1 247[NF: 1
@@ -253,5 +253,5 @@ TOTAL: 1
253 253
254TESTWSP([K/V environment],[wsp-env-kv wsp-env_kv], 254TESTWSP([K/V environment],[wsp-env-kv wsp-env_kv],
255[env_kv], 255[-env_kv],
256[$FOO a$BAZ], 256[$FOO a$BAZ],
257[NF: 2 257[NF: 2
@@ -263,5 +263,5 @@ TOTAL: 2
263[FOO=bar BAZ=qux]) 263[FOO=bar BAZ=qux])
264 264
265TESTWSP([nosplit with variable expansion],[wsp-var-nosplit],[nosplit], 265TESTWSP([nosplit with variable expansion],[wsp-var-nosplit],[-nosplit],
266[a $FOO test], 266[a $FOO test],
267[NF: 1 267[NF: 1
@@ -272,5 +272,5 @@ TOTAL: 1
272[FOO="variable expansion"]) 272[FOO="variable expansion"])
273 273
274TESTWSP([nosplit without variable expansion],[],[nosplit novar], 274TESTWSP([nosplit without variable expansion],[],[-nosplit -novar],
275[a $FOO test], 275[a $FOO test],
276[NF: 1 276[NF: 1
@@ -281,5 +281,5 @@ TOTAL: 1
281[FOO="variable expansion"]) 281[FOO="variable expansion"])
282 282
283TESTWSP([nosplit: empty expansion],[],[nosplit trimnl], 283TESTWSP([nosplit: empty expansion],[],[-nosplit -trimnl],
284[$FOO], 284[$FOO],
285[NF: 1 285[NF: 1
@@ -290,13 +290,4 @@ TOTAL: 1
290[FOO=""]) 290[FOO=""])
291 291
292TESTWSP([default value (defined)],[],[],
293[${FOO:-bar}],
294[NF: 1
2950: qux
296TOTAL: 1
297],
298[],
299[FOO=qux])
300
301TESTWSP([default value],[],[], 292TESTWSP([default value],[],[],
302[${FOO:-bar}], 293[${FOO:-bar}],
@@ -452,5 +443,5 @@ TOTAL: 2
452WSPGROUP() 443WSPGROUP()
453 444
454TESTWSP([ignore quotes],[wsp-ignore-quotes ],[-quote], 445TESTWSP([ignore quotes],[wsp-ignore-quotes ],[-noquote],
455["a text"], 446["a text"],
456[NF: 2 447[NF: 2
@@ -463,5 +454,5 @@ WSPGROUP(wsp-delim)
463 454
464TESTWSP([custom delimiters (squeeze)],[], 455TESTWSP([custom delimiters (squeeze)],[],
465[delim : -ws trimnl], 456[-delim : -nows -trimnl],
466[semicolon: separated::list: of :words], 457[semicolon: separated::list: of :words],
467[NF: 5 458[NF: 5
@@ -475,5 +466,5 @@ TOTAL: 5
475 466
476TESTWSP([custom delimiters (no squeeze)],[], 467TESTWSP([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],
479[NF: 6 470[NF: 6
@@ -488,5 +479,5 @@ TOTAL: 6
488 479
489TESTWSP([custom, with returned delimiters],[], 480TESTWSP([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],
492[NF: 9 483[NF: 9
@@ -504,5 +495,5 @@ TOTAL: 9
504 495
505TESTWSP([custom, with returned & squeezed delimiters],[], 496TESTWSP([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],
508[NF: 10 499[NF: 10
@@ -522,5 +513,5 @@ TOTAL: 10
522WSPGROUP(wsp-sed) 513WSPGROUP(wsp-sed)
523 514
524TESTWSP([sed expressions],[],[sed], 515TESTWSP([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],
526[NF: 3 517[NF: 3
@@ -533,5 +524,5 @@ TOTAL: 3
533WSPGROUP() 524WSPGROUP()
534 525
535TESTWSP([C escapes on],[wcp-c-escape],[cescapes], 526TESTWSP([C escapes on],[wcp-c-escape],[-cescapes],
536[a\ttab form\ffeed and new\nline], 527[a\ttab form\ffeed and new\nline],
537[NF: 4 528[NF: 4
@@ -543,5 +534,5 @@ TOTAL: 4
543]) 534])
544 535
545TESTWSP([C escapes off],[wcp-c-escape-off],[-cescapes], 536TESTWSP([C escapes off],[wcp-c-escape-off],[-nocescapes],
546[a\ttab form\ffeed and new\nline], 537[a\ttab form\ffeed and new\nline],
547[NF: 4 538[NF: 4
@@ -553,5 +544,5 @@ TOTAL: 4
553]) 544])
554 545
555TESTWSP([ws elimination],[wsp-ws-elim],[delim ' ()' ws return_delims], 546TESTWSP([ws elimination],[wsp-ws-elim],[-delim ' ()' -ws -return_delims],
556[( list items )], 547[( list items )],
557[NF: 4 548[NF: 4
@@ -564,5 +555,5 @@ TOTAL: 4
564 555
565TESTWSP([ws elimination + return delim],[wsp-ws-elim-ret], 556TESTWSP([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" ],
568[NF: 7 559[NF: 7
@@ -577,5 +568,5 @@ TOTAL: 7
577]) 568])
578 569
579TESTWSP([empty quotes],[wsp-empty-quotes],[delim : ws return_delims], 570TESTWSP([empty quotes],[wsp-empty-quotes],[-delim : -ws -return_delims],
580[t=""], 571[t=""],
581[NF: 1 572[NF: 1
@@ -585,5 +576,5 @@ TOTAL: 1
585 576
586TESTWSP([delimiter following empty quotes], 577TESTWSP([delimiter following empty quotes],
587[],[delim : ws return_delims], 578[],[-delim : -ws -return_delims],
588[t="":r], 579[t="":r],
589[NF: 3 580[NF: 3
@@ -596,5 +587,5 @@ TOTAL: 3
596TESTWSP([suppress ws trimming within quotes], 587TESTWSP([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}, "],
600[NF: 5 591[NF: 5
@@ -609,5 +600,5 @@ TOTAL: 5
609TESTWSP([unescape], 600TESTWSP([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 \\"],
613[NF: 3 604[NF: 3
@@ -620,5 +611,5 @@ TOTAL: 3
620TESTWSP([unescape: word/quote], 611TESTWSP([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],
624[NF: 6 615[NF: 6
@@ -632,5 +623,5 @@ TOTAL: 6
632]) 623])
633 624
634TESTWSP([dquote],[],[-default novar nocmd dquote], 625TESTWSP([dquote],[],[-nodefault -novar -nocmd -dquote],
635[a "quoted example" isn't it], 626[a "quoted example" isn't it],
636[NF: 4 627[NF: 4
@@ -642,5 +633,5 @@ TOTAL: 4
642]) 633])
643 634
644TESTWSP([squote],[],[-default novar nocmd squote], 635TESTWSP([squote],[],[-nodefault -novar -nocmd -squote],
645[a 'quoted example' isn"t it], 636[a 'quoted example' isn"t it],
646[NF: 4 637[NF: 4
@@ -654,5 +645,5 @@ TOTAL: 4
654WSPGROUP(wsp-incr) 645WSPGROUP(wsp-incr)
655 646
656TESTWSP([incremental],[],[incremental], 647TESTWSP([incremental],[],[-incremental],
657[incremental "input test" line 648[incremental "input test" line
658 649
@@ -672,5 +663,5 @@ TOTAL: 3
672]) 663])
673 664