diff --git a/usr.bin/m4/TEST/math.m4 b/usr.bin/m4/TEST/math.m4 index 0262af66e253..e8cae3333b4e 100644 --- a/usr.bin/m4/TEST/math.m4 +++ b/usr.bin/m4/TEST/math.m4 @@ -1,181 +1,180 @@ -dnl $FreeBSD$ dnl A regression test for m4 C operators (ksb,petef) dnl If you think you have a short-circuiting m4, run us m4 -DSHORCIRCUIT=yes dnl dnl first level of precedence ifelse(expr(-7),-7,,`failed - ')dnl ifelse(expr(- -2),2,,`failed - ')dnl ifelse(expr(!0),1,,`failed ! ')dnl ifelse(expr(!7),0,,`failed ! ')dnl ifelse(expr(~-1),0,,`failed ~ ')dnl dnl next level of precedence ifelse(expr(3*5),15,,`failed * ')dnl ifelse(expr(3*0),0,,`failed * ')dnl ifelse(expr(11/2),5,,`failed / ')dnl ifelse(expr(1/700),0,,`failed / ')dnl ifelse(expr(10%5),0,,`failed % ')dnl ifelse(expr(2%5),2,,`failed % ')dnl ifelse(expr(2%-1),0,,`failed % ')dnl dnl next level of precedence ifelse(expr(2+2),4,,`failed + ')dnl ifelse(expr(2+-2),0,,`failed + ')dnl ifelse(expr(2- -2),4,,`failed - ')dnl ifelse(expr(2-2),0,,`failed - ')dnl dnl next level of precedence ifelse(expr(1<<4),16,,`failed << ')dnl ifelse(expr(16>>4),1,,`failed >> ')dnl dnl next level of precedence ifelse(expr(4<4),0,,`failed < ')dnl ifelse(expr(4<5),1,,`failed < ')dnl ifelse(expr(4<3),0,,`failed < ')dnl ifelse(expr(4>4),0,,`failed > ')dnl ifelse(expr(4>5),0,,`failed > ')dnl ifelse(expr(4>3),1,,`failed > ')dnl ifelse(expr(4<=4),1,,`failed <= ')dnl ifelse(expr(4<=5),1,,`failed <= ')dnl ifelse(expr(4<=3),0,,`failed <= ')dnl ifelse(expr(4>=4),1,,`failed >= ')dnl ifelse(expr(4>=5),0,,`failed >= ')dnl ifelse(expr(4>=3),1,,`failed >= ')dnl dnl next level of precedence ifelse(expr(1==1),1,,`failed == ')dnl ifelse(expr(1==-1),0,,`failed == ')dnl ifelse(expr(1!=1),0,,`failed != ')dnl ifelse(expr(1!=2),1,,`failed != ')dnl dnl next level of precedence ifelse(expr(3&5),1,,`failed & ')dnl ifelse(expr(8&7),0,,`failed & ')dnl dnl next level of precedence ifelse(expr(1^1),0,,`failed ^ ')dnl ifelse(expr(21^5),16,,`failed ^ ')dnl dnl next level of precedence ifelse(expr(1|1),1,,`failed | ')dnl ifelse(expr(21|5),21,,`failed | ')dnl ifelse(expr(100|1),101,,`failed | ')dnl dnl next level of precedence ifelse(expr(1&&1),1,,`failed && ')dnl ifelse(expr(0&&1),0,,`failed && ')dnl ifelse(expr(1&&0),0,,`failed && ')dnl ifelse(SHORTCIRCUIT,`yes',`ifelse(expr(0&&10/0),0,,`failed && shortcircuit ')')dnl dnl next level of precedence ifelse(expr(1||1),1,,`failed || ')dnl ifelse(expr(1||0),1,,`failed || ')dnl ifelse(expr(0||0),0,,`failed || ')dnl ifelse(SHORTCIRCUIT,`yes',`ifelse(expr(1||10/0),1,,`failed || shortcircuit ')')dnl dnl next level of precedence ifelse(expr(0 ? 2 : 5),5,,`failed ?: ')dnl ifelse(expr(1 ? 2 : 5),2,,`failed ?: ')dnl ifelse(SHORTCIRCUIT,`yes',`ifelse(expr(0 ? 10/0 : 7),7,,`failed ?: shortcircuit ')')dnl ifelse(SHORTCIRCUIT,`yes',`ifelse(expr(1 ? 7 : 10/0),7,,`failed ?: shortcircuit ')')dnl dnl operator precedence ifelse(expr(!0*-2),-2,,`precedence wrong, ! * ')dnl ifelse(expr(~8/~2),3,,`precedence wrong ~ / ')dnl ifelse(expr(~-20%7),5,,`precedence wrong ~ % ')dnl ifelse(expr(3*2+100),106,,`precedence wrong * + ')dnl ifelse(expr(3+2*100),203,,`precedence wrong + * ')dnl ifelse(expr(2%5-6/3),0,,`precedence wrong % - ')dnl ifelse(expr(2/5-5%3),-2,,`precedence wrong / - ')dnl ifelse(expr(2+5%5+1),3,,`precedence wrong % + ')dnl ifelse(expr(7+9<<1),32,,`precedence wrong + << ')dnl ifelse(expr(35-3>>2),8,,`precedence wrong - >> ')dnl ifelse(expr(9<10<<5),1,,`precedence wrong << < ')dnl ifelse(expr(9>10<<5),0,,`precedence wrong << > ')dnl ifelse(expr(32>>2<32),1,,`precedence wrong >> < ')dnl ifelse(expr(9<=10<<5),1,,`precedence wrong << < ')dnl ifelse(expr(5<<1<=20>>1),1,,`precedence wrong << <= ')dnl ifelse(expr(5<<1>=20>>1),1,,`precedence wrong << >= ')dnl ifelse(expr(0<7==5>=5),1,,`precedence wrong < == ')dnl ifelse(expr(0<7!=5>=5),0,,`precedence wrong < != ')dnl ifelse(expr(0>7==5>=5),0,,`precedence wrong > == ')dnl ifelse(expr(0>7!=5>=5),1,,`precedence wrong > != ')dnl ifelse(expr(1&7==7),1,,`precedence wrong & == ')dnl ifelse(expr(0&7!=6),0,,`precedence wrong & != ')dnl ifelse(expr(9&1|5),5,,`precedence wrong & | ')dnl ifelse(expr(9&1^5),4,,`precedence wrong & ^ ')dnl ifelse(expr(9^1|5),13,,`precedence wrong ^ | ')dnl ifelse(expr(5|0&&1),1,,`precedence wrong | && ')dnl ifelse(expr(5&&0||0&&5||5),1,,`precedence wrong && || ')dnl ifelse(expr(0 || 1 ? 0 : 1),0,,`precedence wrong || ?: ')dnl ifelse(expr(5&&(0||0)&&(5||5)),0,,`precedence wrong || parens ')dnl diff --git a/usr.bin/m4/tests/args.m4 b/usr.bin/m4/tests/args.m4 index 3ad30f2442ec..2be7c3fd51fc 100644 --- a/usr.bin/m4/tests/args.m4 +++ b/usr.bin/m4/tests/args.m4 @@ -1,9 +1,8 @@ -dnl $FreeBSD$ 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') diff --git a/usr.bin/m4/tests/args2.m4 b/usr.bin/m4/tests/args2.m4 index 3f9ed600fca7..22f75a0e13af 100644 --- a/usr.bin/m4/tests/args2.m4 +++ b/usr.bin/m4/tests/args2.m4 @@ -1,5 +1,4 @@ -dnl $FreeBSD$ 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)) diff --git a/usr.bin/m4/tests/comments.m4 b/usr.bin/m4/tests/comments.m4 index d7038c4f636e..e94165a19079 100644 --- a/usr.bin/m4/tests/comments.m4 +++ b/usr.bin/m4/tests/comments.m4 @@ -1,59 +1,58 @@ -dnl $FreeBSD$ 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 diff --git a/usr.bin/m4/tests/esyscmd.m4 b/usr.bin/m4/tests/esyscmd.m4 index 7b1342d39d85..a9b83c478e48 100644 --- a/usr.bin/m4/tests/esyscmd.m4 +++ b/usr.bin/m4/tests/esyscmd.m4 @@ -1,43 +1,42 @@ -dnl $FreeBSD$ changequote(`{',`}')dnl dnl esyscmd({sh -c "m4<>>') patsubst(`# This is a line to zap # and a second line keep this one', `^ *#.* ') dnl Special case: empty regexp patsubst(`empty regexp',`',`a ') diff --git a/usr.bin/m4/tests/quotes.m4 b/usr.bin/m4/tests/quotes.m4 index c783e22298a3..376cc1e42c0c 100644 --- a/usr.bin/m4/tests/quotes.m4 +++ b/usr.bin/m4/tests/quotes.m4 @@ -1,58 +1,57 @@ -dnl $FreeBSD$ 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' diff --git a/usr.bin/m4/tests/redef.m4 b/usr.bin/m4/tests/redef.m4 index de01f674b456..4def2df15e21 100644 --- a/usr.bin/m4/tests/redef.m4 +++ b/usr.bin/m4/tests/redef.m4 @@ -1,17 +1,16 @@ -dnl $FreeBSD$ 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 diff --git a/usr.bin/m4/tests/translit.m4 b/usr.bin/m4/tests/translit.m4 index 19af2e1fccef..77b4fe0f1934 100644 --- a/usr.bin/m4/tests/translit.m4 +++ b/usr.bin/m4/tests/translit.m4 @@ -1,4 +1,3 @@ -dnl $FreeBSD$ dnl $OpenBSD: src/regress/usr.bin/m4/translit.m4,v 1.1 2010/03/23 20:11:52 espie Exp $ dnl first one should match, not second one translit(`onk*', `**', `p_') diff --git a/usr.bin/m4/tests/translit2.m4 b/usr.bin/m4/tests/translit2.m4 index ec26c0840573..5c53a57cf3c2 100644 --- a/usr.bin/m4/tests/translit2.m4 +++ b/usr.bin/m4/tests/translit2.m4 @@ -1,9 +1,8 @@ -dnl $FreeBSD$ translit(`[HAVE_abc/def.h ]', ` /.', `/ ') translit(`[HAVE_abc/def.h=]', `=/.', `/~~') translit(`0123456789', `0123456789', `ABCDEFGHIJ') translit(`0123456789', `[0-9]', `[A-J]') translit(`abc-0980-zyx', `abcdefghijklmnopqrstuvwxyz', `ABCDEFGHIJKLMNOPQRSTUVWXYZ') translit(`abc-0980-zyx', `[a-z]', `[A-Z]')