Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): adjust condition descriptio...



details:   https://anonhg.NetBSD.org/src/rev/a41e883706a9
branches:  trunk
changeset: 946573:a41e883706a9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 01 19:33:50 2020 +0000

description:
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).

diffstat:

 usr.bin/make/unit-tests/cond-short.exp |  12 ++++++------
 usr.bin/make/unit-tests/cond-short.mk  |  14 +++++++-------
 2 files changed, 13 insertions(+), 13 deletions(-)

diffs (82 lines):

diff -r 3d6fb6d24915 -r a41e883706a9 usr.bin/make/unit-tests/cond-short.exp
--- a/usr.bin/make/unit-tests/cond-short.exp    Tue Dec 01 19:28:32 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-short.exp    Tue Dec 01 19:33:50 2020 +0000
@@ -7,10 +7,10 @@
 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
diff -r 3d6fb6d24915 -r a41e883706a9 usr.bin/make/unit-tests/cond-short.mk
--- a/usr.bin/make/unit-tests/cond-short.mk     Tue Dec 01 19:28:32 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-short.mk     Tue Dec 01 19:33:50 2020 +0000
@@ -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 @@
 .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 @@
 # 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 @@
 .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 @@
 .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 @@
 .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



Home | Main Index | Thread Index | Old Index