Module Name:    src
Committed By:   rillig
Date:           Sun Nov  8 22:28:05 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: cond-token-number.exp cond-token-number.mk

Log Message:
make(1): add test for hexadecimal numbers in conditionals


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-token-number.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-token-number.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-token-number.exp
diff -u src/usr.bin/make/unit-tests/cond-token-number.exp:1.2 src/usr.bin/make/unit-tests/cond-token-number.exp:1.3
--- src/usr.bin/make/unit-tests/cond-token-number.exp:1.2	Mon Sep 14 06:22:59 2020
+++ src/usr.bin/make/unit-tests/cond-token-number.exp	Sun Nov  8 22:28:05 2020
@@ -2,7 +2,7 @@ make: "cond-token-number.mk" line 13: Ma
 make: "cond-token-number.mk" line 21: Malformed conditional (+0)
 make: "cond-token-number.mk" line 29: Malformed conditional (!-1)
 make: "cond-token-number.mk" line 37: Malformed conditional (!+1)
-make: "cond-token-number.mk" line 54: End of the tests.
+make: "cond-token-number.mk" line 70: End of the tests.
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-token-number.mk
diff -u src/usr.bin/make/unit-tests/cond-token-number.mk:1.3 src/usr.bin/make/unit-tests/cond-token-number.mk:1.4
--- src/usr.bin/make/unit-tests/cond-token-number.mk:1.3	Mon Sep 14 06:22:59 2020
+++ src/usr.bin/make/unit-tests/cond-token-number.mk	Sun Nov  8 22:28:05 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-number.mk,v 1.3 2020/09/14 06:22:59 rillig Exp $
+# $NetBSD: cond-token-number.mk,v 1.4 2020/11/08 22:28:05 rillig Exp $
 #
 # Tests for number tokens in .if conditions.
 
@@ -50,6 +50,22 @@
 .  error
 .endif
 
+# Hexadecimal numbers are accepted.
+.if 0x0
+.  error
+.endif
+.if 0x1
+.else
+.  error
+.endif
+
+# This is not a hexadecimal number, even though it has an x.
+# It is interpreted as a string instead, effectively meaning defined(3x4).
+.if 3x4
+.else
+.  error
+.endif
+
 # Ensure that parsing continues until here.
 .info End of the tests.
 

Reply via email to