1 # arch-tag: org.pipapo.mala.tests.stdmodule
3 TESTING "stdmodule tests:" ./test-mala
6 TEST "cat three 1st way" --CAT --CAT foo bar baz <<END
14 TEST "cat three 2nd way" --CAT foo --CAT bar baz <<END
22 TEST "cat missing arg 1st way" --CAT --CAT foo bar <<END
26 literal: --ERROR-MISSING-ARGUMENT.
32 TEST "cat missing arg 2nd way" --CAT foo --CAT bar <<END
38 literal: --ERROR-MISSING-ARGUMENT.
44 TEST "missing arg at --PRINT" --PRINT <<END
47 literal: --ERROR-MISSING-ARGUMENT.
53 TEST "--PRINT --LITERAL" --PRINT --LITERAL --LITERAL <<END
60 TEST "--PRINT and --NL" --PRINT "foo bar" --NL <<END
68 TEST "begin w/o end" --BEGIN <<END
71 literal: --ERROR-MISSING-END.
77 TEST "begin empty end" --BEGIN --END <<END
84 TEST "begin single word" --BEGIN foo --END <<END
92 TEST "begin 2 words" --BEGIN foo bar --END <<END
101 TEST "begin single macro" --BEGIN '%2%1' --END foo bar <<END
109 TEST "begin double macro" --BEGIN '%2' '%1' --END foo bar <<END
118 TEST "missing name at --DEF" --DEF <<END
121 literal: --ERROR-MISSING-ARGUMENT.
127 TEST "missing body at --DEF" --DEF foo <<END
131 literal: --ERROR-MISSING-ARGUMENT.
137 TEST "define macro w/o parameter" --DEF foo --BEGIN bar baz --END <<END
144 TEST "substitute" --DEF foo bar foo <<END
152 TEST "expand macro w/o parameter" --DEF foo --BEGIN bar baz --END foo <<END
161 TEST "expand macro w/ parameter" --DEF foo --BEGIN %1 bar --END foo baz <<END
170 TEST "%% expand test" --DEF foo foo%%bar foo baz <<END
179 TEST "%0 expand test" --DEF foo foo%0bar foo baz <<END
188 PLANNED "%-0 expand test" --DEF foo bar barf --END-DEF --DEF foo -BEEGIN baz %-0 --END foo gnarf <<END
198 TEST "define nested macro w/o parameter" --DEF foo --BEGIN bar --DEF baz --BEGIN barf gnarf --END --END baz foo baz <<END
209 PLANNED "variable expansion in macro" variable = bar --DEF foo '$variable' --END-DEF --PRINT foo --NL <<END
216 TEST "missing macro argument" --DEF foo %2 foo bar <<END
220 literal: --ERROR-MISSING-ARGUMENT.
226 TEST "stale --END" --PRINT foo bar baz --END <<END
230 literal: --ERROR-END-WITHOUT-BEGIN.
237 TEST "escaped argument" --DEF foo %%1 foo <<END
245 TEST "invalid macro" --DEF foo %illegal foo bar <<END
249 literal: --ERROR-MACRO-SYNTAX.
258 PLANNED "definition redefinition" --DEF --substitute --ESCAPE --DEF %1 %2 --ESCAPE --END-DEF --END-DEF --substitute foo bar foo <<END
266 PLANNED "--no-PRINT" --no-PRINT <<END
268 prg: --ERROR-UNEXPECTED-NEGATED
275 PLANNED "negated --DEF" ! --DEF foo bar --END-DEF <<END
279 prg: --HERE-ERROR-NEGATED
288 TEST "printl" --PRINTL --LITERAL foo <<END
296 TEST "undef substitution" --DEF foo bar foo --DEL --LITERAL foo foo <<END
305 TEST "delete error" --DEL foo <<END
308 literal: --ERROR-ACTION-NOT-DEFINED.
315 TEST "remove literal" --REMOVE foo <<END
322 TEST "remove printl" --REMOVE --PRINTL foo <<END
329 TEST "remove def" --REMOVE --DEF foo bar baz <<END
337 PLANNED TEST "simple not true" --NOT --TRUE <<END
345 PLANNED TEST "simple not false" --NOT --FALSE <<END
353 PLANNED TEST "double not true" --NOT --NOT --TRUE <<END
361 PLANNED TEST "double not false" --NOT --NOT --FALSE <<END
369 TEST "delete expand" --DEF foo --BEGIN bar baz --END foo --DEL --LITERAL foo foo <<END
379 TEST "delete macro" --DEF foo --BEGIN bar %1 --END foo baz --DEL --LITERAL foo foo baz <<END
390 PLANNED "redef macro" --DEF foo bar --REDEF foo baz foo goo --DEL foo --DEL foo <<END
393 prg: --ERROR-UNKNOWN-ACTION
396 prg: --HERE-ERROR-UNKNOWN-ACTION
401 PLANNED "defined" --DEFINED --DEF ! --DEFINED foo --DEFINED bar --NO-DEFINED --DEFINED <<END
411 PLANNED "attach" --DEF foo bar --END-DEF --DEF baz barf --END-DEF --ATTACH foo baz foo --DEL baz foo <<END
419 PLANNED "detach" --DEF foo bar --END-DEF --DEF baz barf --END-DEF --ATTACH foo baz foo --DETACH foo --DEL baz foo <<END
428 TEST "ifelse true" --IF-ELSE --TRUE success fail bar <<END
437 TEST "ifelse false" --IF-ELSE --FALSE success fail bar <<END
446 TEST "if else blocks, true" --IF-ELSE --TRUE --BEGIN --PRINTL true --END --BEGIN --PRINTL false --END <<END
454 TEST "if else blocks, false" --IF-ELSE --FALSE --BEGIN --PRINTL true --END --BEGIN --PRINTL false --END <<END
462 TEST "eval" --PRINT --EVAL --DEF foo evaluated --STOP finally foo <<END
470 TEST "Simple printwraped" --DEF COL 40 --PRINTWRAPED COL 10 2 8 $'foo\t- bar\t right' --PRINTL 12345678901234567890123456789012345678901234567890 <<END
471 stdout: foo - bar right
472 12345678901234567890123456789012345678901234567890
478 TEST "printwraped with wrap" --DEF COL 40 --PRINTWRAPED COL 10 2 8 $'foo\t- bar\t right\nfoo\t- bar baz foobar barf bazbarf gnat\t right' --PRINTL 12345678901234567890123456789012345678901234567890 <<END
479 stdout: foo - bar right
480 foo - bar baz foobar barf bazbarf
482 12345678901234567890123456789012345678901234567890
489 PLANNED "negated --LITERAL" ! --LITERAL <<END