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
27 literal: --ERROR-MISSING-ARGUMENT.
33 TEST "cat missing arg 2nd way" --CAT foo --CAT bar <<END
41 literal: --ERROR-MISSING-ARGUMENT.
47 TEST "missing arg at --PRINT" --PRINT <<END
51 literal: --ERROR-MISSING-ARGUMENT.
57 TEST "--PRINT --LITERAL" --PRINT --LITERAL --LITERAL <<END
64 TEST "--PRINT and --NL" --PRINT "foo bar" --NL <<END
72 TEST "begin w/o end" --BEGIN <<END
74 literal: --ERROR-MISSING-END.
81 TEST "begin empty end" --BEGIN --END <<END
88 TEST "begin single word" --BEGIN foo --END <<END
96 TEST "begin 2 words" --BEGIN foo bar --END <<END
105 TEST "begin single macro" --BEGIN '%2%1' --END foo bar <<END
113 TEST "begin double macro" --BEGIN '%2' '%1' --END foo bar <<END
122 TEST "missing name at --DEF" --DEF <<END
126 literal: --ERROR-MISSING-ARGUMENT.
132 TEST "missing body at --DEF" --DEF foo <<END
137 literal: --ERROR-MISSING-ARGUMENT.
143 TEST "define macro w/o parameter" --DEF foo --BEGIN bar baz --END <<END
150 TEST "substitute" --DEF foo bar foo <<END
158 TEST "expand macro w/o parameter" --DEF foo --BEGIN bar baz --END foo <<END
167 TEST "expand macro w/ parameter" --DEF foo --BEGIN %1 bar --END foo baz <<END
176 TEST "%% expand test" --DEF foo foo%%bar foo baz <<END
185 TEST "%0 expand test" --DEF foo foo%0bar foo baz <<END
194 PLANNED "%-0 expand test" --DEF foo bar barf --END-DEF --DEF foo -BEEGIN baz %-0 --END foo gnarf <<END
204 TEST "define nested macro w/o parameter" --DEF foo --BEGIN bar --DEF baz --BEGIN barf gnarf --END --END baz foo baz <<END
215 PLANNED "variable expansion in macro" variable = bar --DEF foo '$variable' --END-DEF --PRINT foo --NL <<END
222 TEST "missing macro argument" --DEF foo %2 foo bar <<END
227 literal: --ERROR-MISSING-ARGUMENT.
233 TEST "stale --END" --PRINT foo --END <<END
235 literal: --ERROR-END-WITHOUT-BEGIN.
242 TEST "escaped argument" --DEF foo %%1 foo <<END
250 TEST "invalid macro" --DEF foo %illegal foo bar <<END
252 literal: --ERROR-MACRO-SYNTAX.
263 PLANNED "definition redefinition" --DEF --substitute --ESCAPE --DEF %1 %2 --ESCAPE --END-DEF --END-DEF --substitute foo bar foo <<END
271 PLANNED "--no-PRINT" --no-PRINT <<END
273 prg: --ERROR-UNEXPECTED-NEGATED
280 PLANNED "negated --DEF" ! --DEF foo bar --END-DEF <<END
284 prg: --HERE-ERROR-NEGATED
293 TEST "printl" --PRINTL --LITERAL foo <<END
301 TEST "undef substitution" --DEF foo bar foo --DEL --LITERAL foo foo <<END
310 TEST "delete error" --DEL foo <<END
312 literal: --ERROR-ACTION-NOT-DEFINED.
320 TEST "remove literal" --REMOVE foo <<END
327 TEST "remove printl" --REMOVE --PRINTL foo <<END
334 TEST "remove def" --REMOVE --DEF foo bar baz <<END
342 PLANNED TEST "simple not true" --NOT --TRUE <<END
350 PLANNED TEST "simple not false" --NOT --FALSE <<END
358 PLANNED TEST "double not true" --NOT --NOT --TRUE <<END
366 PLANNED TEST "double not false" --NOT --NOT --FALSE <<END
374 TEST "delete expand" --DEF foo --BEGIN bar baz --END foo --DEL --LITERAL foo foo <<END
384 TEST "delete macro" --DEF foo --BEGIN bar %1 --END foo baz --DEL --LITERAL foo foo baz <<END
395 PLANNED "redef macro" --DEF foo bar --REDEF foo baz foo goo --DEL foo --DEL foo <<END
398 prg: --ERROR-UNKNOWN-ACTION
401 prg: --HERE-ERROR-UNKNOWN-ACTION
406 PLANNED "defined" --DEFINED --DEF ! --DEFINED foo --DEFINED bar --NO-DEFINED --DEFINED <<END
416 PLANNED "attach" --DEF foo bar --END-DEF --DEF baz barf --END-DEF --ATTACH foo baz foo --DEL baz foo <<END
424 PLANNED "detach" --DEF foo bar --END-DEF --DEF baz barf --END-DEF --ATTACH foo baz foo --DETACH foo --DEL baz foo <<END
433 TEST "ifelse true" --IF-ELSE --TRUE success fail bar <<END
442 TEST "ifelse false" --IF-ELSE --FALSE success fail bar <<END
451 TEST "if else blocks, true" --IF-ELSE --TRUE --BEGIN --PRINTL true --END --BEGIN --PRINTL false --END <<END
459 TEST "if else blocks, false" --IF-ELSE --FALSE --BEGIN --PRINTL true --END --BEGIN --PRINTL false --END <<END
467 TEST "eval" --PRINT --EVAL --DEF foo evaluated --STOP finally foo <<END
475 TEST "Simple printwraped" --DEF COL 40 --PRINTWRAPED COL 10 2 8 $'foo\t- bar\t right' --PRINTL 12345678901234567890123456789012345678901234567890 <<END
476 stdout: foo - bar right
477 12345678901234567890123456789012345678901234567890
483 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
484 stdout: foo - bar right
485 foo - bar baz foobar barf bazbarf
487 12345678901234567890123456789012345678901234567890
494 PLANNED "negated --LITERAL" ! --LITERAL <<END