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): add tests for the unknown =...



details:   https://anonhg.NetBSD.org/src/rev/66442a2e3d76
branches:  trunk
changeset: 938586:66442a2e3d76
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Sep 11 15:19:04 2020 +0000

description:
make(1): add tests for the unknown = and === operators

diffstat:

 usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk |  18 +++++++++++++++++-
 usr.bin/make/unit-tests/cond-cmp-string.mk     |  18 +++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)

diffs (60 lines):

diff -r 5b83cc7155ca -r 66442a2e3d76 usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk
--- a/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk    Fri Sep 11 15:16:48 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk    Fri Sep 11 15:19:04 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-numeric-eq.mk,v 1.1 2020/08/23 13:50:17 rillig Exp $
+# $NetBSD: cond-cmp-numeric-eq.mk,v 1.2 2020/09/11 15:19:04 rillig Exp $
 #
 # Tests for numeric comparisons with the == operator in .if conditions.
 
@@ -49,5 +49,21 @@
 .error
 .endif
 
+
+# There is no = operator for numbers.  Well, not quite, there is one, but
+# it generates a warning.  Therefore it is not used in practice.
+.if !(12345 = 12345)
+.  error
+.else
+.  error
+.endif
+
+# There is no === operator for numbers either.
+.if !(12345 === 12345)
+.  error
+.else
+.  error
+.endif
+
 all:
        @:;
diff -r 5b83cc7155ca -r 66442a2e3d76 usr.bin/make/unit-tests/cond-cmp-string.mk
--- a/usr.bin/make/unit-tests/cond-cmp-string.mk        Fri Sep 11 15:16:48 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-cmp-string.mk        Fri Sep 11 15:19:04 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-string.mk,v 1.3 2020/08/20 18:43:19 rillig Exp $
+# $NetBSD: cond-cmp-string.mk,v 1.4 2020/09/11 15:19:04 rillig Exp $
 #
 # Tests for string comparisons in .if conditions.
 
@@ -37,3 +37,19 @@
 .if "string" != "str""ing"
 .error
 .endif
+
+# There is no = operator for strings.  Well, not quite, there is one, but
+# it generates a warning.  Therefore it is not used in practice.
+.if !("value" = "value")
+.  error
+.else
+.  error
+.endif
+
+# There is no === operator for strings either.
+.if !("value" === "value")
+.  error
+.else
+.  error
+.endif
+



Home | Main Index | Thread Index | Old Index