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 missing space ...



details:   https://anonhg.NetBSD.org/src/rev/f9614e53869d
branches:  trunk
changeset: 956965:f9614e53869d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Nov 12 19:45:24 2020 +0000

description:
make(1): add test for missing space after .if directive

diffstat:

 usr.bin/make/unit-tests/directive-elif.exp |   3 +++
 usr.bin/make/unit-tests/directive-elif.mk  |  21 +++++++++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r 57fc4c766b6b -r f9614e53869d usr.bin/make/unit-tests/directive-elif.exp
--- a/usr.bin/make/unit-tests/directive-elif.exp        Thu Nov 12 19:43:18 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-elif.exp        Thu Nov 12 19:45:24 2020 +0000
@@ -12,6 +12,9 @@
 make: "directive-elif.mk" line 58: 2-elsif
 make: "directive-elif.mk" line 64: if-less elif
 make: "directive-elif.mk" line 69: warning: extra elif
+make: "directive-elif.mk" line 75: Don't do this, always put a space after a directive.
+make: "directive-elif.mk" line 79: Don't do this, always put a space after a directive.
+make: "directive-elif.mk" line 85: Don't do this, always put a space around comparison operators.
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
diff -r 57fc4c766b6b -r f9614e53869d usr.bin/make/unit-tests/directive-elif.mk
--- a/usr.bin/make/unit-tests/directive-elif.mk Thu Nov 12 19:43:18 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-elif.mk Thu Nov 12 19:45:24 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-elif.mk,v 1.4 2020/11/10 22:23:37 rillig Exp $
+# $NetBSD: directive-elif.mk,v 1.5 2020/11/12 19:45:24 rillig Exp $
 #
 # Tests for the .elif directive.
 
@@ -69,5 +69,22 @@
 .elif
 .endif
 
+.if0
+.  error
+.else
+.  info Don't do this, always put a space after a directive.
+.endif
+
+.if${:U-3}
+.  info Don't do this, always put a space after a directive.
+.else
+.  error
+.endif
+
+.if${:U-3}>-4
+.  info Don't do this, always put a space around comparison operators.
+.else
+.  error
+.endif
+
 all:
-       @:;



Home | Main Index | Thread Index | Old Index