summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2020-09-11 15:19:04 +0000
committerrillig <rillig@NetBSD.org>2020-09-11 15:19:04 +0000
commit2451f2f9bf08bbd6c7f75dbab012bbe3e99fe0fa (patch)
tree988f528dd58b0814ad440312489e5b1ad2b47ecb
parent8fa14ce0f915522d66d3f63885a35291599c1e26 (diff)
make(1): add tests for the unknown = and === operators
-rw-r--r--usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk18
-rw-r--r--usr.bin/make/unit-tests/cond-cmp-string.mk18
2 files changed, 34 insertions, 2 deletions
diff --git a/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk b/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk
index 02b95ae593c..3ebd30c0c8f 100644
--- a/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk
+++ b/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk
@@ -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 --git a/usr.bin/make/unit-tests/cond-cmp-string.mk b/usr.bin/make/unit-tests/cond-cmp-string.mk
index 67d86b61e88..e7fa3c61efa 100644
--- a/usr.bin/make/unit-tests/cond-cmp-string.mk
+++ b/usr.bin/make/unit-tests/cond-cmp-string.mk
@@ -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
+