aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/varmod-order.mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/unit-tests/varmod-order.mk')
-rw-r--r--contrib/bmake/unit-tests/varmod-order.mk27
1 files changed, 26 insertions, 1 deletions
diff --git a/contrib/bmake/unit-tests/varmod-order.mk b/contrib/bmake/unit-tests/varmod-order.mk
index c6028fc10abd..67919543a93e 100644
--- a/contrib/bmake/unit-tests/varmod-order.mk
+++ b/contrib/bmake/unit-tests/varmod-order.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-order.mk,v 1.8 2022/01/15 12:35:18 rillig Exp $
+# $NetBSD: varmod-order.mk,v 1.11 2023/06/01 20:56:35 rillig Exp $
#
# Tests for the :O variable modifier and its variants, which either sort the
# words of the value or shuffle them.
@@ -11,9 +11,13 @@ NUMBERS= 8 5 4 9 1 7 6 10 3 2 # in English alphabetical order
.endif
# Unknown modifier "OX"
+# FIXME: The error message is wrong.
+# expect+1: Undefined variable "${WORDS:OX"
_:= ${WORDS:OX}
# Unknown modifier "OxXX"
+# FIXME: The error message is wrong.
+# expect+1: Undefined variable "${WORDS:Ox"
_:= ${WORDS:OxXX}
# Missing closing brace, to cover the error handling code.
@@ -36,6 +40,7 @@ _:= ${NUMBERS:Onr
# TODO: Add line number information to the "Bad modifier" diagnostic.
#
# expect: make: Bad modifier ":On_typo" for variable "NUMBERS"
+# expect+1: Malformed conditional (${NUMBERS:On_typo})
.if ${NUMBERS:On_typo}
. error
.else
@@ -45,6 +50,7 @@ _:= ${NUMBERS:Onr
# Extra characters after ':Onr' are detected and diagnosed.
#
# expect: make: Bad modifier ":Onr_typo" for variable "NUMBERS"
+# expect+1: Malformed conditional (${NUMBERS:Onr_typo})
.if ${NUMBERS:Onr_typo}
. error
.else
@@ -54,6 +60,7 @@ _:= ${NUMBERS:Onr
# Extra characters after ':Orn' are detected and diagnosed.
#
# expect: make: Bad modifier ":Orn_typo" for variable "NUMBERS"
+# expect+1: Malformed conditional (${NUMBERS:Orn_typo})
.if ${NUMBERS:Orn_typo}
. error
.else
@@ -65,6 +72,7 @@ _:= ${NUMBERS:Onr
# not make sense.
#
# expect: make: Bad modifier ":Onn" for variable "NUMBERS"
+# expect+1: Malformed conditional (${NUMBERS:Onn})
.if ${NUMBERS:Onn}
. error
.else
@@ -74,6 +82,7 @@ _:= ${NUMBERS:Onr
# Repeating the 'r' is not supported as well, for the same reasons as above.
#
# expect: make: Bad modifier ":Onrr" for variable "NUMBERS"
+# expect+1: Malformed conditional (${NUMBERS:Onrr})
.if ${NUMBERS:Onrr}
. error
.else
@@ -83,10 +92,26 @@ _:= ${NUMBERS:Onr
# Repeating the 'r' is not supported as well, for the same reasons as above.
#
# expect: make: Bad modifier ":Orrn" for variable "NUMBERS"
+# expect+1: Malformed conditional (${NUMBERS:Orrn})
.if ${NUMBERS:Orrn}
. error
.else
. error
.endif
+
+# If a modifier that starts with ':O' is not one of the known sort or shuffle
+# forms, it is a parse error. Several other modifiers such as ':H' or ':u'
+# fall back to the SysV modifier, for example, ':H=new' is not the standard
+# ':H' modifier but instead replaces a trailing 'H' with 'new' in each word.
+# There is no such fallback for the ':O' modifiers.
+SWITCH= On
+# expect: make: Bad modifier ":On=Off" for variable "SWITCH"
+# expect+1: Malformed conditional (${SWITCH:On=Off} != "Off")
+.if ${SWITCH:On=Off} != "Off"
+. error
+.else
+. error
+.endif
+
all: