Permalink
Browse files

Add regression tests for m4.

Obtained-from:  FreeBSD
  • Loading branch information...
1 parent 4afad3d commit 9b9cf381ce6afc9eff34a6591ec00faa7aa03476 Peter Avalos committed Jan 15, 2013
Showing with 1,092 additions and 0 deletions.
  1. +4 −0 tools/regression/usr.bin/m4/Makefile
  2. +9 −0 tools/regression/usr.bin/m4/args.m4
  3. +5 −0 tools/regression/usr.bin/m4/args2.m4
  4. +59 −0 tools/regression/usr.bin/m4/comments.m4
  5. +43 −0 tools/regression/usr.bin/m4/esyscmd.m4
  6. +6 −0 tools/regression/usr.bin/m4/eval.m4
  7. +11 −0 tools/regression/usr.bin/m4/ff_after_dnl.m4.uu
  8. +7 −0 tools/regression/usr.bin/m4/gnueval.m4
  9. +2 −0 tools/regression/usr.bin/m4/gnuformat.m4
  10. +4 −0 tools/regression/usr.bin/m4/gnupatterns.m4
  11. +6 −0 tools/regression/usr.bin/m4/gnupatterns2.m4
  12. +2 −0 tools/regression/usr.bin/m4/gnuprefix.m4
  13. +4 −0 tools/regression/usr.bin/m4/gnusofterror.m4
  14. +3 −0 tools/regression/usr.bin/m4/includes.aux
  15. +5 −0 tools/regression/usr.bin/m4/includes.m4
  16. +12 −0 tools/regression/usr.bin/m4/m4wrap3.m4
  17. +12 −0 tools/regression/usr.bin/m4/patterns.m4
  18. +58 −0 tools/regression/usr.bin/m4/quotes.m4
  19. +17 −0 tools/regression/usr.bin/m4/redef.m4
  20. +3 −0 tools/regression/usr.bin/m4/regress.args.out
  21. +1 −0 tools/regression/usr.bin/m4/regress.args2.out
  22. +47 −0 tools/regression/usr.bin/m4/regress.comments.out
  23. +578 −0 tools/regression/usr.bin/m4/regress.esyscmd.out
  24. +3 −0 tools/regression/usr.bin/m4/regress.eval.out
  25. +2 −0 tools/regression/usr.bin/m4/regress.ff_after_dnl.out
  26. +3 −0 tools/regression/usr.bin/m4/regress.gnueval.out
  27. +1 −0 tools/regression/usr.bin/m4/regress.gnuformat.out
  28. +3 −0 tools/regression/usr.bin/m4/regress.gnupatterns.out
  29. +1 −0 tools/regression/usr.bin/m4/regress.gnupatterns2.out
  30. +46 −0 tools/regression/usr.bin/m4/regress.gnuprefix.out
  31. +1 −0 tools/regression/usr.bin/m4/regress.gnusofterror.out
  32. +6 −0 tools/regression/usr.bin/m4/regress.gnutranslit2.out
  33. +1 −0 tools/regression/usr.bin/m4/regress.includes.out
  34. +4 −0 tools/regression/usr.bin/m4/regress.m4wrap3.out
  35. +6 −0 tools/regression/usr.bin/m4/regress.patterns.out
  36. +49 −0 tools/regression/usr.bin/m4/regress.quotes.out
  37. +2 −0 tools/regression/usr.bin/m4/regress.redef.out
  38. +31 −0 tools/regression/usr.bin/m4/regress.sh
  39. +1 −0 tools/regression/usr.bin/m4/regress.strangequotes.out
  40. +6 −0 tools/regression/usr.bin/m4/regress.t
  41. +1 −0 tools/regression/usr.bin/m4/regress.translit.out
  42. +6 −0 tools/regression/usr.bin/m4/regress.translit2.out
  43. +8 −0 tools/regression/usr.bin/m4/strangequotes.m4.uu
  44. +4 −0 tools/regression/usr.bin/m4/translit.m4
  45. +9 −0 tools/regression/usr.bin/m4/translit2.m4
@@ -0,0 +1,4 @@
+# $FreeBSD: src/tools/regression/usr.bin/m4/Makefile,v 1.5 2012/11/17 01:53:58 svnexp Exp $
+
+all:
+ @m4 ${.CURDIR}/../regress.m4 ${.CURDIR}/regress.sh | sh /dev/stdin ${.CURDIR}
@@ -0,0 +1,9 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/args.m4,v 1.2 2012/11/17 01:53:58 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/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')
@@ -0,0 +1,5 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/args2.m4,v 1.2 2012/11/17 01:53:58 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/args2.m4,v 1.1 2008/08/16 09:57:12 espie Exp $
+dnl Preserving spaces within nested parentheses
+define(`foo',`$1')dnl
+foo(( check for embedded spaces))
@@ -0,0 +1,59 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/comments.m4,v 1.2 2012/11/17 01:53:58 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/comments.m4,v 1.1 2005/09/06 15:33:21 espie Exp $
+dnl checking the way changecom works.
+1: normal
+define(`comment', `COMMENT')dnl
+define(`p', 'XXX')dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+2: `changecom(>>)dnl'
+changecom(>>)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+3: `changecom dnl'
+changecom dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+4: `changecom()dnl'
+changecom()dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+5: `changecom(,)dnl'
+changecom(,)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+6: `changecom(`p',q)dnl'
+changecom(`p',q)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+7: `changecom(`p')dnl'
+changecom(`p')dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+8: `changecom(#)dnl'
+changecom(#)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
@@ -0,0 +1,43 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/esyscmd.m4,v 1.2 2012/11/17 01:53:58 svnexp Exp $
+changequote(`{',`}')dnl
+dnl
+esyscmd({sh -c "m4<<EOF
+define(_bp,hi there a)
+define(_comb,
+_bp($1$2)
+_bp($2$1)
+)
+define(bp,
+_comb(aaaa,foo0)
+_comb(bbbb,foo0)
+_comb(cccc,foo0)
+_comb(dddd,foo0)
+_comb(aaaa,foo0)
+_comb(bbbb,foo0)
+_comb(cccc,foo0)
+_comb(dddd,foo0)
+)
+bp(a00)
+bp(b00)
+bp(c00)
+bp(d00)
+bp(e00)
+bp(f00)
+bp(g00)
+bp(h00)
+bp(i00)
+bp(j00)
+bp(k00)
+bp(l00)
+bp(m00)
+bp(n00)
+bp(o00)
+bp(p00)
+bp(q00)
+bp(r00)
+bp(s00)
+bp(t00)
+bp(u00)
+bp(v00)
+bp(w00)
+EOF"})dnl
@@ -0,0 +1,6 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/eval.m4,v 1.2 2012/11/17 01:53:58 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/eval.m4,v 1.1 2004/05/12 21:24:37 espie Exp $
+dnl expr parser
+eval(224&127)
+eval(224|127)
+eval(224&&127)
@@ -0,0 +1,11 @@
+$FreeBSD: src/tools/regression/usr.bin/m4/ff_after_dnl.m4.uu,v 1.2 2012/11/17 01:53:58 svnexp Exp $
+$OpenBSD: src/regress/usr.bin/m4/ff_after_dnl.m4.uu,v 1.1.1.1 2000/07/01 00:31:01 espie Exp $
+$NetBSD: ff_after_dnl.m4.uu,v 1.1 1997/12/30 23:30:53 cgd Exp $
+
+begin 644 ff_after_dnl.m4
+M"0E42$E3(%-(3U5,1"!32$]7(%50("A,24Y%(#$I"F1N;`D)5$A)4R!32$]5
+M3$0@3D]4(%-(3U<@55`@*$Q)3D4@,BD*9&YL_PD)5$A)4R!32$]53$0@3D]4
+M(%-(3U<@55`@*$Q)3D4@,RD*9&YL"?\)5$A)4R!32$]53$0@3D]4(%-(3U<@
+K55`@*$Q)3D4@-"D*"0E42$E3(%-(3U5,1"!32$]7(%50("A,24Y%(#4I"E<@
+`
+end
@@ -0,0 +1,7 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/gnueval.m4,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/gnueval.m4,v 1.1 2012/04/12 16:58:15 espie Exp $
+dnl exponentiation is right associative
+eval(`4**2**3')
+dnl priority between unary operators and *
+eval(`4**2*3')
+eval(`-4**3')
@@ -0,0 +1,2 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/gnuformat.m4,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+format(`a%15sa%%b%-15sbc%3scd%-3sd', `string', `pouet', `toolong', `toolong2')
@@ -0,0 +1,4 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/gnupatterns.m4,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+patsubst(`string with a + to replace with a minus', `+', `minus')
+patsubst(`string with aaaaa to replace with a b', `a+', `b')
+patsubst(`+string with a starting + to replace with a minus', `^+', `minus')
@@ -0,0 +1,6 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/gnupatterns2.m4,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+define(`zoinx',dnl
+`patsubst($1,\(\w+\)\(\W*\),\1 )')dnl
+zoinx(acosl asinl atanl \
+ cosl sinl tanl \
+ coshl sinhl tanhl)
@@ -0,0 +1,2 @@
+dumpdef()
+m4_dumpdef()
@@ -0,0 +1,4 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/gnusofterror.m4,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/gnusofterror.m4,v 1.1 2012/04/12 16:58:15 espie Exp $
+include(`hey I do not exit')dnl
+abc
@@ -0,0 +1,3 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/includes.aux,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/includes.aux,v 1.1 2008/08/16 10:02:32 espie Exp $
+hello world dnl
@@ -0,0 +1,5 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/includes.m4,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/includes.m4,v 1.1 2008/08/16 10:02:32 espie Exp $
+dnl Check that include can occur within parameters
+define(`foo', include(includes.aux))dnl
+foo
@@ -0,0 +1,12 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/m4wrap3.m4,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/m4wrap3.m4,v 1.1 2005/03/02 10:12:41 espie Exp $
+dnl Another test, this time for multiple wrappers
+dnl Check the behavior in presence of recursive m4wraps
+dnl both for POSIX m4 and for gnu-m4 mode
+m4wrap(`this is
+')dnl
+m4wrap(`a string
+')dnl
+m4wrap(`m4wrap(`recurse
+')')dnl
+normal m4 stuff
@@ -0,0 +1,12 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/patterns.m4,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/patterns.m4,v 1.4 2003/06/08 20:11:45 espie Exp $
+patsubst(`quote s in string', `(s)', `\\\1')
+patsubst(`check whether subst
+over several lines
+works as expected', `^', `>>>')
+patsubst(`# This is a line to zap
+# and a second line
+keep this one', `^ *#.*
+')
+dnl Special case: empty regexp
+patsubst(`empty regexp',`',`a ')
@@ -0,0 +1,58 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/quotes.m4,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/quotes.m4,v 1.2 2005/09/06 15:33:21 espie Exp $
+dnl Checking the way changequote() is supposed to work
+define(`string',`STRING')dnl
+1: normal
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+2: kill quotes
+changequote()dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+3: normal changed quote
+changequote([,])dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+4: empty quotes, kill them too
+changequote(,)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+5: start quote only
+changequote(`)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+6: normal quotes are back
+changequote
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+7: start quote+empty end quote
+changequote([,)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
@@ -0,0 +1,17 @@
+dnl $FreeBSD: src/tools/regression/usr.bin/m4/redef.m4,v 1.2 2012/11/17 01:53:59 svnexp Exp $
+dnl $OpenBSD: src/regress/usr.bin/m4/redef.m4,v 1.2 2001/09/27 22:40:58 espie Exp $
+dnl check all properties of builtin are passed on, including args behavior
+define(`mybuiltin',defn(`builtin'))dnl
+builtin mybuiltin
+define(`mydefine',defn(`define'))dnl
+mydefine(`mydefn',defn(`defn'))dnl
+mydefine(`myundefine',mydefn(`undefine'))dnl
+myundefine(`defn')dnl
+myundefine(`define')dnl
+myundefine(`undefine')dnl
+mydefine(`mydef2',mydefn(`mydefine'))dnl
+mydefine(`mydef', mydefn(`define'))dnl
+myundefine(`mydefine')dnl
+mydef2(`A',`B')dnl
+mydef(`C',`D')dnl
+A C
@@ -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
@@ -0,0 +1 @@
+( check for embedded spaces)
@@ -0,0 +1,47 @@
+1: normal
+# this is a comment
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+2: changecom(>>)dnl
+# this is a COMMENT
+>> this is a comment
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+3: changecom dnl
+ # this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+4: changecom()dnl
+# this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+5: changecom(,)dnl
+# this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+6: changecom(`p',q)dnl
+# this is a COMMENT
+>> this is a COMMENT
+p this is a comment
+p this is a comment q COMMENT too
+
+7: changecom(`p')dnl
+# this is a COMMENT
+>> this is a COMMENT
+p this is a comment
+p this is a comment q comment too
+
+8: changecom(#)dnl
+# this is a comment
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
Oops, something went wrong.

0 comments on commit 9b9cf38

Please sign in to comment.