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 test for unsupported re...



details:   https://anonhg.NetBSD.org/src/rev/033c3918bfe1
branches:  trunk
changeset: 958791:033c3918bfe1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jan 19 19:54:57 2021 +0000

description:
make(1): add test for unsupported relational string comparisons

diffstat:

 usr.bin/make/unit-tests/cond-cmp-string.exp |   8 +++++++
 usr.bin/make/unit-tests/cond-cmp-string.mk  |  30 ++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)

diffs (59 lines):

diff -r bd4356bc4f91 -r 033c3918bfe1 usr.bin/make/unit-tests/cond-cmp-string.exp
--- a/usr.bin/make/unit-tests/cond-cmp-string.exp       Tue Jan 19 19:29:35 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-cmp-string.exp       Tue Jan 19 19:54:57 2021 +0000
@@ -3,6 +3,14 @@
 make: "cond-cmp-string.mk" line 49: warning: String comparison operator must be either == or !=
 make: "cond-cmp-string.mk" line 49: Malformed conditional (!("value" = "value"))
 make: "cond-cmp-string.mk" line 56: Malformed conditional (!("value" === "value"))
+make: "cond-cmp-string.mk" line 113: warning: String comparison operator must be either == or !=
+make: "cond-cmp-string.mk" line 113: Malformed conditional ("string" < "string")
+make: "cond-cmp-string.mk" line 120: warning: String comparison operator must be either == or !=
+make: "cond-cmp-string.mk" line 120: Malformed conditional ("string" <= "string")
+make: "cond-cmp-string.mk" line 127: warning: String comparison operator must be either == or !=
+make: "cond-cmp-string.mk" line 127: Malformed conditional ("string" > "string")
+make: "cond-cmp-string.mk" line 134: warning: String comparison operator must be either == or !=
+make: "cond-cmp-string.mk" line 134: Malformed conditional ("string" >= "string")
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
diff -r bd4356bc4f91 -r 033c3918bfe1 usr.bin/make/unit-tests/cond-cmp-string.mk
--- a/usr.bin/make/unit-tests/cond-cmp-string.mk        Tue Jan 19 19:29:35 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-cmp-string.mk        Tue Jan 19 19:54:57 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-string.mk,v 1.13 2020/11/15 14:07:53 rillig Exp $
+# $NetBSD: cond-cmp-string.mk,v 1.14 2021/01/19 19:54:57 rillig Exp $
 #
 # Tests for string comparisons in .if conditions.
 
@@ -108,3 +108,31 @@
 .if 12345.0 == "12345"
 .  error
 .endif
+
+# Strings cannot be compared relationally, only for equality.
+.if "string" < "string"
+.  error
+.else
+.  error
+.endif
+
+# Strings cannot be compared relationally, only for equality.
+.if "string" <= "string"
+.  error
+.else
+.  error
+.endif
+
+# Strings cannot be compared relationally, only for equality.
+.if "string" > "string"
+.  error
+.else
+.  error
+.endif
+
+# Strings cannot be compared relationally, only for equality.
+.if "string" >= "string"
+.  error
+.else
+.  error
+.endif



Home | Main Index | Thread Index | Old Index