From 71746b839b4bc54d9819777d107def9d30495428 Mon Sep 17 00:00:00 2001 From: sjg Date: Fri, 9 Jan 2004 00:56:44 +0000 Subject: [PATCH] Add unit test for ternary modifier --- usr.bin/make/unit-tests/Makefile | 9 +++++++-- usr.bin/make/unit-tests/ternary | 5 +++++ usr.bin/make/unit-tests/test.exp | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 usr.bin/make/unit-tests/ternary diff --git a/usr.bin/make/unit-tests/Makefile b/usr.bin/make/unit-tests/Makefile index e53e2c83ffdc..c8bb2c1bfac6 100644 --- a/usr.bin/make/unit-tests/Makefile +++ b/usr.bin/make/unit-tests/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.8 2003/09/27 21:29:37 sjg Exp $ +# $Id: Makefile,v 1.9 2004/01/09 00:56:44 sjg Exp $ # # Unit tests for make(1) # The main targets are: @@ -16,7 +16,7 @@ UNIT_TESTS:= ${.PARSEDIR} -all: mod-ts varcmd modword +all: mod-ts varcmd modword ternary LIST= one two three LIST+= four five six @@ -53,6 +53,11 @@ mod-ts: varcmd modword: @${.MAKE} -k -f ${UNIT_TESTS}/$@ +ternary: + @${.MAKE} -k -f ${UNIT_TESTS}/$@ + @${.MAKE} -k -f ${UNIT_TESTS}/$@ A= + @${.MAKE} -k -f ${UNIT_TESTS}/$@ A=42 + clean: rm -f *.out *.fail *.core diff --git a/usr.bin/make/unit-tests/ternary b/usr.bin/make/unit-tests/ternary new file mode 100644 index 000000000000..a6c2cb950278 --- /dev/null +++ b/usr.bin/make/unit-tests/ternary @@ -0,0 +1,5 @@ + +all: + @echo "The answer is ${A:?known:unknown}" + @echo "The answer is ${A:?$A:unknown}" + @echo "The answer is ${empty(A):?empty:$A}" diff --git a/usr.bin/make/unit-tests/test.exp b/usr.bin/make/unit-tests/test.exp index e353adf5a5cb..62fda644ccf4 100644 --- a/usr.bin/make/unit-tests/test.exp +++ b/usr.bin/make/unit-tests/test.exp @@ -156,3 +156,12 @@ LIST:tw:C/ /,/g="one two three four five six" LIST:tw:C/ /,/1g="one two three four five six" LIST:tw:tW:C/ /,/="one,two three four five six" LIST:tW:tw:C/ /,/="one two three four five six" +The answer is unknown +The answer is unknown +The answer is empty +The answer is known +The answer is +The answer is empty +The answer is known +The answer is 42 +The answer is 42