From 774eb34c4aae8b61859abffa823e5d5dbb59954f Mon Sep 17 00:00:00 2001 Message-Id: <774eb34c4aae8b61859abffa823e5d5dbb59954f.1715654637.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sat, 3 May 2008 20:59:58 +0100 Subject: [PATCH] Further macros.c testing Organization: Straylight/Edgeware From: Richard Kettlewell --- lib/t-macros.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/t-macros.c b/lib/t-macros.c index 22308f9..479d2fb 100644 --- a/lib/t-macros.c +++ b/lib/t-macros.c @@ -143,17 +143,25 @@ static void test_macros(void) { m = mx_parse("macro7", 1, "@macro{arg1}{arg2}@", NULL); check_string(mx_dump(m), "@macro{arg1}{arg2}@"); - m = mx_parse("macro7", 1, "@macro{\narg1}{\narg2}@", NULL); + m = mx_parse("macro8", 1, "@macro{\narg1}{\narg2}@", NULL); check_string(mx_dump(m), "@macro{\narg1}{\narg2}@"); check_integer(m->args[0]->line, 1); check_integer(m->args[1]->line, 2); /* ...yes, lines 1 and 2: the first character of the first arg is - * the \n at the end of line 1. Compare with macro8: */ + * the \n at the end of line 1. Compare with macro9: */ - m = mx_parse("macro8", 1, "@macro\n{arg1}\n{arg2}@", NULL); + m = mx_parse("macro9", 1, "@macro\n{arg1}\n{arg2}@", NULL); check_string(mx_dump(m), "@macro{arg1}{arg2}@"); check_integer(m->args[0]->line, 2); check_integer(m->args[1]->line, 3); + + /* Arguments that themselves contain expansions */ + m = mx_parse("macro10", 1, "@macro{@macro2{arg1}{arg2}@}@", NULL); + check_string(mx_dump(m), "@macro{@macro2{arg1}{arg2}@}@"); + + /* ...and with omitted trailing @ */ + m = mx_parse("macro11", 1, "@macro{@macro2{arg1}{arg2}}", NULL); + check_string(mx_dump(m), "@macro{@macro2{arg1}{arg2}@}@"); } -- [mdw]