Module Name:    src
Committed By:   rillig
Date:           Tue Dec  1 19:33:50 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: cond-short.exp cond-short.mk

Log Message:
make(1): adjust condition descriptions in test cond-short

Before, the conditions in the output had been expanded, which made them
illegible.  The expanded conditions were unrealistic as well since the
evaluation flags differ between a condition and normal evaluation
(VARE_WANTRES, VARE_UNDEFERR).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-short.exp
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-short.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-short.exp
diff -u src/usr.bin/make/unit-tests/cond-short.exp:1.10 src/usr.bin/make/unit-tests/cond-short.exp:1.11
--- src/usr.bin/make/unit-tests/cond-short.exp:1.10	Thu Jul  9 22:34:09 2020
+++ src/usr.bin/make/unit-tests/cond-short.exp	Tue Dec  1 19:33:50 2020
@@ -7,10 +7,10 @@ expected M pattern
 expected or
 expected or exists
 expected or empty
-defined(V42) && 42 > 0: Ok
-defined(V66) && ( "" < 42 ): Ok
-1 || 42 < 42: Ok
-1 ||  < 42: Ok
-0 || 42 <= 42: Ok
-0 ||  < 42: Ok
+defined(V42) && ${V42} > 0: Ok
+defined(V66) && ( "${iV2}" < ${V42} ): Ok
+1 || ${iV1} < ${V42}: Ok
+1 || ${iV2:U2} < ${V42}: Ok
+0 || ${iV1} <= ${V42}: Ok
+0 || ${iV2:U2} < ${V42}: Ok
 exit status 0

Index: src/usr.bin/make/unit-tests/cond-short.mk
diff -u src/usr.bin/make/unit-tests/cond-short.mk:1.13 src/usr.bin/make/unit-tests/cond-short.mk:1.14
--- src/usr.bin/make/unit-tests/cond-short.mk:1.13	Mon Nov 30 18:20:20 2020
+++ src/usr.bin/make/unit-tests/cond-short.mk	Tue Dec  1 19:33:50 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-short.mk,v 1.13 2020/11/30 18:20:20 rillig Exp $
+# $NetBSD: cond-short.mk,v 1.14 2020/12/01 19:33:50 rillig Exp $
 #
 # Demonstrates that in conditions, the right-hand side of an && or ||
 # is only evaluated if it can actually influence the result.
@@ -132,7 +132,7 @@ x=	Ok
 .else
 x=	Fail
 .endif
-x!=	echo 'defined(V42) && ${V42} > 0: $x' >&2; echo
+x!=	echo 'defined(V42) && $${V42} > 0: $x' >&2; echo
 
 # With cond.c 1.76 from 2020-07-03, the following condition triggered a
 # warning: "String comparison operator should be either == or !=".
@@ -155,14 +155,14 @@ x=	Ok
 # above.  This is a crucial detail since without quotes, the variable
 # expression ${iV2} evaluates to "${V66}", and with quotes, it evaluates to ""
 # since undefined variables are allowed and expand to an empty string.
-x!=	echo 'defined(V66) && ( "${iV2}" < ${V42} ): $x' >&2; echo
+x!=	echo 'defined(V66) && ( "$${iV2}" < $${V42} ): $x' >&2; echo
 
 .if 1 || ${iV1} < ${V42}
 x=	Ok
 .else
 x=	Fail
 .endif
-x!=	echo '1 || ${iV1} < ${V42}: $x' >&2; echo
+x!=	echo '1 || $${iV1} < $${V42}: $x' >&2; echo
 
 # With cond.c 1.76 from 2020-07-03, the following condition triggered a
 # warning: "String comparison operator should be either == or !=".
@@ -181,7 +181,7 @@ x=	Ok
 .else
 x=	Fail
 .endif
-x!=	echo '1 || ${iV2:U2} < ${V42}: $x' >&2; echo
+x!=	echo '1 || $${iV2:U2} < $${V42}: $x' >&2; echo
 
 # the same expressions are fine when the lhs is expanded
 # ${iV1} expands to 42
@@ -190,7 +190,7 @@ x=	Ok
 .else
 x=	Fail
 .endif
-x!=	echo '0 || ${iV1} <= ${V42}: $x' >&2; echo
+x!=	echo '0 || $${iV1} <= $${V42}: $x' >&2; echo
 
 # ${iV2:U2} expands to 2
 .if 0 || ${iV2:U2} < ${V42}
@@ -198,7 +198,7 @@ x=	Ok
 .else
 x=	Fail
 .endif
-x!=	echo '0 || ${iV2:U2} < ${V42}: $x' >&2; echo
+x!=	echo '0 || $${iV2:U2} < $${V42}: $x' >&2; echo
 
 # TODO: Has this always worked?  There may have been a time, maybe around
 # 2000, when make would complain about the "Malformed conditional" because

Reply via email to