Module Name: src Committed By: rillig Date: Sat Sep 12 17:47:24 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: cond-token-plain.exp cond-token-plain.mk Log Message: make(1): add tests for comparison tokens without whitespace To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-token-plain.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-token-plain.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/unit-tests/cond-token-plain.exp diff -u src/usr.bin/make/unit-tests/cond-token-plain.exp:1.2 src/usr.bin/make/unit-tests/cond-token-plain.exp:1.3 --- src/usr.bin/make/unit-tests/cond-token-plain.exp:1.2 Fri Sep 11 06:47:42 2020 +++ src/usr.bin/make/unit-tests/cond-token-plain.exp Sat Sep 12 17:47:24 2020 @@ -15,4 +15,15 @@ lhs = "no", rhs = "no", op = != CondParser_Eval: ${1 # comment :?yes:no} != yes CondParser_Eval: 1 # comment lhs = "yes", rhs = "yes", op = != +CondParser_Eval: ${UNDEF:Uundefined}!=undefined +lhs = "undefined", rhs = "undefined", op = != +CondParser_Eval: ${UNDEF:U12345}>12345 +lhs = 12345.000000, rhs = 12345.000000, op = >1 +CondParser_Eval: ${UNDEF:U12345}<12345 +lhs = 12345.000000, rhs = 12345.000000, op = <1 +CondParser_Eval: (${UNDEF:U0})||0 +CondParser_Eval: ${:Uvar}&&name != "var&&name" +lhs = "var&&name", rhs = "var&&name", op = != +CondParser_Eval: ${:Uvar}||name != "var||name" +lhs = "var||name", rhs = "var||name", op = != exit status 0 Index: src/usr.bin/make/unit-tests/cond-token-plain.mk diff -u src/usr.bin/make/unit-tests/cond-token-plain.mk:1.3 src/usr.bin/make/unit-tests/cond-token-plain.mk:1.4 --- src/usr.bin/make/unit-tests/cond-token-plain.mk:1.3 Fri Sep 11 06:47:42 2020 +++ src/usr.bin/make/unit-tests/cond-token-plain.mk Sat Sep 12 17:47:24 2020 @@ -1,4 +1,4 @@ -# $NetBSD: cond-token-plain.mk,v 1.3 2020/09/11 06:47:42 rillig Exp $ +# $NetBSD: cond-token-plain.mk,v 1.4 2020/09/12 17:47:24 rillig Exp $ # # Tests for plain tokens (that is, string literals without quotes) # in .if conditions. @@ -63,5 +63,32 @@ . error .endif +# Usually there is whitespace around the comparison operator, but this is +# not required. +.if ${UNDEF:Uundefined}!=undefined +. error +.endif +.if ${UNDEF:U12345}>12345 +. error +.endif +.if ${UNDEF:U12345}<12345 +. error +.endif +.if (${UNDEF:U0})||0 +. error +.endif + +# Only the comparison operator terminates the comparison operand, and it's +# a coincidence that the '!' is both used in the '!=' comparison operator +# as well as for negating a comparison result. +# +# The boolean operators '&' and '|' don't terminate a comparison operand. +.if ${:Uvar}&&name != "var&&name" +. error +.endif +.if ${:Uvar}||name != "var||name" +. error +.endif + all: @:;