aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/directive-for-empty.exp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/unit-tests/directive-for-empty.exp')
-rw-r--r--contrib/bmake/unit-tests/directive-for-empty.exp27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/bmake/unit-tests/directive-for-empty.exp b/contrib/bmake/unit-tests/directive-for-empty.exp
new file mode 100644
index 000000000000..5cc3ac846b36
--- /dev/null
+++ b/contrib/bmake/unit-tests/directive-for-empty.exp
@@ -0,0 +1,27 @@
+make: "directive-for-empty.mk" line 22: 2
+make: "directive-for-empty.mk" line 38: Missing argument for ".error"
+make: "directive-for-empty.mk" line 38: Missing argument for ".error"
+make: "directive-for-empty.mk" line 38: Missing argument for ".error"
+For: end for 1
+For: loop body with i = value:
+# The identifier 'empty' can only be used in conditions such as .if, .ifdef or
+# .elif. In other lines the string 'empty(' must be preserved.
+CPPFLAGS+= -Dmessage="empty(i)"
+# There may be whitespace between 'empty' and '('.
+.if ! empty (i)
+. error
+.endif
+# Even in conditions, the string 'empty(' is not always a function call, it
+# can occur in a string literal as well.
+.if "empty\(i)" != "empty(i)"
+. error
+.endif
+# In comments like 'empty(i)', the text must be preserved as well.
+#
+# Conditions, including function calls to 'empty', can not only occur in
+# condition directives, they can also occur in the modifier ':?', see
+# varmod-ifelse.mk.
+CPPFLAGS+= -Dmacro="${empty(i):?empty:not-empty}"
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1