+ check_macro("discard1", "@discard{wibble}", "", 0);
+ check_macro("discard2", "@discard{comment with a\nnewline in}", "", 0);
+
+ check_macro("eq1", "@eq", "true", 0);
+ check_macro("eq2", "@eq{}", "true", 0);
+ check_macro("eq3", "@eq{a}", "true", 0);
+ check_macro("eq4", "@eq{a}{a}", "true", 0);
+ check_macro("eq5", "@eq{a}{a}{a}", "true", 0);
+ check_macro("eq7", "@eq{a}{b}", "false", 0);
+ check_macro("eq8", "@eq{a}{b}{a}", "false", 0);
+ check_macro("eq9", "@eq{a}{a}{b}", "false", 0);
+ check_macro("eq10", "@eq{b}{a}{a}", "false", 0);
+
+ check_macro("ne1", "@ne", "true", 0);
+ check_macro("ne2", "@ne{}", "true", 0);
+ check_macro("ne3", "@ne{a}", "true", 0);
+ check_macro("ne4", "@ne{a}{a}", "false", 0);
+ check_macro("ne5", "@ne{a}{a}{a}", "false", 0);
+ check_macro("ne7", "@ne{a}{b}", "true", 0);
+ check_macro("ne8", "@ne{a}{b}{a}", "false", 0);
+ check_macro("ne9", "@ne{a}{a}{b}", "false", 0);
+ check_macro("ne10", "@ne{b}{a}{a}", "false", 0);
+ check_macro("ne11", "@ne{a}{b}{c}", "true", 0);
+
+ check_macro("sh1", "@shell{true}", "", 0);
+ check_macro("sh2", "@shell{echo spong}", "spong\n", 0);
+ fprintf(stderr, ">>> expect error message about shell command:\n");
+ check_macro("sh3", "@shell{echo spong;exit 3}", "spong\n", 0);
+
+ check_macro("url1", "@urlquote{unreserved}", "unreserved", 0);
+ check_macro("url2", "@urlquote{has space}", "has%20space", 0);
+ check_macro("url3", "@urlquote{\xc0\xc1}", "%c0%c1", 0);
+
+ check_macro("include1", "@include{t-macros-1.tmpl}",
+ "yes\n", 0);
+ check_macro("include2", "@include{t-macros-2}",
+ "wibble\n", 0);
+ fprintf(stderr, ">>> expect error message about t-macros-nonesuch:\n");
+ check_macro("include3", "<@include{t-macros-nonesuch}>",
+ "<[[cannot find 't-macros-nonesuch']]>", 0);
+ fprintf(stderr, ">>> expect error message about 'wibble':\n");
+ check_macro("badex1", "<@wibble>",
+ "<[['wibble' unknown]]>", 0);
+ fprintf(stderr, ">>> expect error message about 'if':\n");
+ check_macro("badex2", "<@if>",
+ "<[['if' too few args]]>", 0);
+ fprintf(stderr, ">>> expect error message about 'if':\n");
+ check_macro("badex3", "<@if{1}{2}{3}{4}{5}>",
+ "<[['if' too many args]]>", 0);
+
+ check_macro("dirname1", "@dirname{foo/bar}", "foo", 0);
+ check_macro("dirname2", "@dirname{foo & something/bar}",
+ "foo & something", 0);
+ check_macro("basename1", "@basename{xyzzy/plugh}", "plugh", 0);
+ check_macro("basename2", "@basename{xyzzy/a<b}", "a<b", 0);
+
+ check_macro("q1", "@q{wibble}", "wibble", 0);
+ check_macro("q2", "@q{wibble}wobble", "wibblewobble", 0);