summaryrefslogtreecommitdiff
path: root/unit-tests/varmod-shell.mk
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/varmod-shell.mk')
-rw-r--r--unit-tests/varmod-shell.mk28
1 files changed, 27 insertions, 1 deletions
diff --git a/unit-tests/varmod-shell.mk b/unit-tests/varmod-shell.mk
index 052968004f1b..db82e302f2a8 100644
--- a/unit-tests/varmod-shell.mk
+++ b/unit-tests/varmod-shell.mk
@@ -1,9 +1,35 @@
-# $NetBSD: varmod-shell.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-shell.mk,v 1.5 2020/11/17 20:11:02 rillig Exp $
#
# Tests for the :sh variable modifier, which runs the shell command
# given by the variable value and returns its output.
+#
+# This modifier has been added on 2000-04-29.
+#
+# See also:
+# ApplyModifier_ShellCommand
# TODO: Implementation
+# The command to be run is enclosed between exclamation marks.
+# The previous value of the expression is irrelevant for this modifier.
+# The :!cmd! modifier turns an undefined expression into a defined one.
+.if ${:!echo word!} != "word"
+. error
+.endif
+
+# If the command exits with non-zero, an error message is printed.
+# XXX: Processing continues as usual though.
+#
+# Between 2000-04-29 and 2020-11-17, the error message mentioned the previous
+# value of the expression (which is usually an empty string) instead of the
+# command that was executed. It's strange that such a simple bug could
+# survive such a long time.
+.if ${:!echo word; false!} != "word"
+. error
+.endif
+.if ${:Uprevious value:!echo word; false!} != "word"
+. error
+.endif
+
all:
@:;