summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2001-10-10 23:24:00 +0000
committerMarc Espie <espie@cvs.openbsd.org>2001-10-10 23:24:00 +0000
commit531d904d05107d1b2bfe14de444673d129e20a41 (patch)
treedbd6fe044ec07735f7c285f7ace35b185a02ad1c /regress
parent6e1802e56d2935c7e3f35755fed0de9b3c69f0a0 (diff)
nasty, nasty... with indir calls, we might end up with expand_macro call
for a macro call without parenthesis...
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/m4/Makefile7
-rw-r--r--regress/usr.bin/m4/args.m48
-rw-r--r--regress/usr.bin/m4/args.out3
3 files changed, 16 insertions, 2 deletions
diff --git a/regress/usr.bin/m4/Makefile b/regress/usr.bin/m4/Makefile
index 4c78a10fb95..b0094d53843 100644
--- a/regress/usr.bin/m4/Makefile
+++ b/regress/usr.bin/m4/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.12 2001/10/10 11:16:28 espie Exp $
+# $OpenBSD: Makefile,v 1.13 2001/10/10 23:23:59 espie Exp $
# $NetBSD: Makefile,v 1.2 1999/02/13 02:54:33 lukem Exp $
NOMAN=
@@ -12,7 +12,7 @@ CLEANFILES+= ff_after_dnl.m4 strangequotes.m4 fibo.out
ALL_TESTS= test-ff_after_dnl test-m4wrap test-m4wrap2 test-fibo \
test-patterns trip test-strangequotes test-redef test-quotes \
- test-weird
+ test-weird test-args
regress: ${ALL_TESTS}
@@ -55,6 +55,9 @@ test-redef:
test-weird:
test `${M4} ${.CURDIR}/weird,name.m4 | wc -c` == 0
+test-args:
+ ${M4} ${.CURDIR}/args.m4 | diff - ${.CURDIR}/args.out
+
.PHONY: ${ALL_TESTS}
.include <bsd.prog.mk>
diff --git a/regress/usr.bin/m4/args.m4 b/regress/usr.bin/m4/args.m4
new file mode 100644
index 00000000000..8d871011625
--- /dev/null
+++ b/regress/usr.bin/m4/args.m4
@@ -0,0 +1,8 @@
+dnl $OpenBSD: args.m4,v 1.1 2001/10/10 23:23:59 espie Exp $
+dnl Expanding all arguments
+define(`A', `first form: $@, second form $*')dnl
+define(`B', `C')dnl
+A(1,2,`B')
+dnl indirection means macro can get called with argc == 2 !
+indir(`A',1,2,`B')
+indir(`A')
diff --git a/regress/usr.bin/m4/args.out b/regress/usr.bin/m4/args.out
new file mode 100644
index 00000000000..aaa890010a5
--- /dev/null
+++ b/regress/usr.bin/m4/args.out
@@ -0,0 +1,3 @@
+first form: 1,2,B, second form 1,2,C
+first form: 1,2,B, second form 1,2,C
+first form: , second form