Module Name: src
Committed By: rillig
Date: Fri Sep 11 15:19:04 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: cond-cmp-numeric-eq.mk cond-cmp-string.mk
Log Message:
make(1): add tests for the unknown = and === operators
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-cmp-string.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-cmp-numeric-eq.mk
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk:1.1 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk:1.2
--- src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk:1.1 Sun Aug 23 13:50:17 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk Fri Sep 11 15:19:04 2020
@@ -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:
@:;
Index: src/usr.bin/make/unit-tests/cond-cmp-string.mk
diff -u src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.3 src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.4
--- src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.3 Thu Aug 20 18:43:19 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-string.mk Fri Sep 11 15:19:04 2020
@@ -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
+