Module Name:    src
Committed By:   rillig
Date:           Tue Jul 28 00:13:29 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk

Log Message:
make(1): add test for modifier part with unbalanced braces


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/moderrs.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/moderrs.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/moderrs.exp
diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.5 src/usr.bin/make/unit-tests/moderrs.exp:1.6
--- src/usr.bin/make/unit-tests/moderrs.exp:1.5	Sun Jul 26 14:39:46 2020
+++ src/usr.bin/make/unit-tests/moderrs.exp	Tue Jul 28 00:13:29 2020
@@ -19,6 +19,10 @@ make: Unclosed substitution for UNDEF (@
 make: Unclosed substitution for UNDEF (@ missing)
 
 1 2 3
+modloop-close:
+make: Unclosed variable specification (expecting '}') for "UNDEF" (value "1}... 2}... 3}...") modifier @
+1}... 2}... 3}...
+1}... 2}... 3}...
 Expect: 2 errors about missing ] delimiter
 make: Unclosed substitution for UNDEF (] missing)
 

Index: src/usr.bin/make/unit-tests/moderrs.mk
diff -u src/usr.bin/make/unit-tests/moderrs.mk:1.4 src/usr.bin/make/unit-tests/moderrs.mk:1.5
--- src/usr.bin/make/unit-tests/moderrs.mk:1.4	Sun Jul 26 14:39:46 2020
+++ src/usr.bin/make/unit-tests/moderrs.mk	Tue Jul 28 00:13:29 2020
@@ -1,4 +1,4 @@
-# $Id: moderrs.mk,v 1.4 2020/07/26 14:39:46 rillig Exp $
+# $Id: moderrs.mk,v 1.5 2020/07/28 00:13:29 rillig Exp $
 #
 # various modifier error tests
 
@@ -9,6 +9,7 @@ MOD_TERM=S,V,v
 MOD_S:= ${MOD_TERM},
 
 all:	modunkn modunknV varterm vartermV modtermV modloop
+all:	modloop-close
 all:	modwords
 all:	modexclam
 
@@ -38,6 +39,17 @@ modloop:
 	@echo ${UNDEF:U1 2 3:@var@...}
 	@echo ${UNDEF:U1 2 3:@var@${var}@}
 
+# The closing brace after the ${var} is part of the replacement string.
+# In ParseModifierPart, braces and parentheses don't have to be balanced.
+# This is contrary to the :M, :N modifiers, where both parentheses and
+# braces must be balanced.
+# This is also contrary to the SysV modifier, where only the actually
+# used delimiter (either braces or parentheses) must be balanced.
+modloop-close:
+	@echo $@:
+	@echo ${UNDEF:U1 2 3:@var@${var}}...@
+	@echo ${UNDEF:U1 2 3:@var@${var}}...@}
+
 modwords:
 	@echo "Expect: 2 errors about missing ] delimiter"
 	@echo ${UNDEF:U1 2 3:[}

Reply via email to