make(1): update and add comments in tests

As a result of the new comments, some line numbers have changed in the
output of the tests.  No other changes.
This commit is contained in:
rillig 2020-11-15 20:20:58 +00:00
parent 2655930386
commit 7c69bb8eca
34 changed files with 216 additions and 91 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.200 2020/11/14 18:07:26 rillig Exp $
# $NetBSD: Makefile,v 1.201 2020/11/15 20:20:58 rillig Exp $
#
# Unit tests for make(1)
#
@ -381,6 +381,26 @@ TESTS+= varparse-mod
TESTS+= varparse-undef-partial
TESTS+= varquote
# Ideas for more tests:
# char-0020-space.mk
# char-005C-backslash.mk
# escape-cond-str.mk
# escape-cond-func-arg.mk
# escape-cond-func-arg.mk
# escape-varmod.mk
# escape-varmod-define.mk
# escape-varmod-match.mk
# escape-varname.mk
# escape-varassign-varname.mk
# escape-varassign-varname-cmdline.mk
# escape-varassign-value.mk
# escape-varassign-value-cmdline.mk
# escape-dependency-source.mk
# escape-dependency-target.mk
# escape-for-varname.mk
# escape-for-item.mk
# posix-*.mk (see posix.mk and posix1.mk)
.if ${.OBJDIR} != ${.CURDIR}
RO_OBJDIR:= ${.OBJDIR}/roobj
.else

View File

@ -1,6 +1,9 @@
# $NetBSD: dep-double-colon.mk,v 1.4 2020/09/26 15:41:53 rillig Exp $
# $NetBSD: dep-double-colon.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the :: operator in dependency declarations.
# Tests for the '::' operator in dependency declarations, which allows
# several dependency groups for a single node, each having its own attributes
# and dependencies. In the code, the additional dependency groups are called
# cohorts.
all::
@echo 'command 1a'

View File

@ -1,6 +1,11 @@
# $NetBSD: dep-exclam.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: dep-exclam.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the ! operator in dependency declarations.
# Tests for the ! operator in dependency declarations, which always re-creates
# the target, whether or not it is out of date.
#
# TODO: Is this related to OP_PHONY?
# TODO: Is this related to OP_EXEC?
# TODO: Is this related to OP_MAKE?
# TODO: Implementation

View File

@ -1,11 +1,10 @@
# $NetBSD: depsrc-ignore.mk,v 1.4 2020/08/29 16:13:27 rillig Exp $
# $NetBSD: depsrc-ignore.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the special source .IGNORE in dependency declarations,
# which ignores any command failures for that target.
#
# Even though ignore-errors fails, the all target is still made.
# Since the all target is not marked with .IGNORE, it stops at the
# first failing command.
# Even though 'ignore-errors' fails, 'all' is still made. Since 'all' is
# not marked with .IGNORE, it stops at the first failing command.
#
# XXX: The ordering of the messages in the output is confusing.
# The "ignored" comes much too late to be related to the "false
@ -24,8 +23,8 @@
# This is what actually happens, as of 2020-08-29. To verify it, set the
# following breakpoints in CompatRunCommand:
#
# * the "!silent" line, to see all commands.
# * the "fflush" line, to see stdout being flushed.
# * the "!silent" line, to see all commands
# * the "fflush" line, to see stdout being flushed
# * the "status = WEXITSTATUS" line
# * the "(continuing)" line
# * the "(ignored)" line

View File

@ -1,9 +1,11 @@
# $NetBSD: depsrc-make.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
# $NetBSD: depsrc-make.mk,v 1.4 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the special source .MAKE in dependency declarations, which
# executes the commands of the target even if the -n or -t command line
# options are given.
# TODO: Add a test for the -t command line option.
.MAKEFLAGS: -n
all: this-is-made

View File

@ -1,6 +1,14 @@
# $NetBSD: depsrc-precious.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: depsrc-precious.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the special source .PRECIOUS in dependency declarations.
# Tests for the special source .PRECIOUS in dependency declarations, which
# is only relevant if the commands for the target fail or are interrupted.
# In such a case, the target file is usually removed, to avoid having
# half-finished files with a timestamp suggesting the file were up-to-date.
#
# For targets marked with .PRECIOUS, the target file is not removed.
# The author of the makefile is then responsible for avoiding the above
# situation, in which the target would be wrongly considered up-to-date,
# just because its timestamp says so.
# TODO: Implementation

View File

@ -1,7 +1,11 @@
# $NetBSD: depsrc-usebefore.mk,v 1.5 2020/08/22 11:53:18 rillig Exp $
# $NetBSD: depsrc-usebefore.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the special source .USEBEFORE in dependency declarations,
# which allows to prepend common commands to other targets.
#
# See also:
# .USE
# depsrc-use.mk
all: action directly

View File

@ -1,9 +1,11 @@
# $NetBSD: depsrc.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: depsrc.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
#
# Tests for special sources (those starting with a dot, followed by
# uppercase letters) in dependency declarations, such as .PHONY.
# TODO: Implementation
# TODO: Test 'target: ${:U.SILENT}'
all:
@:;

View File

@ -1,6 +1,7 @@
# $NetBSD: deptgt-error.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: deptgt-error.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the special target .ERROR in dependency declarations.
# Tests for the special target .ERROR in dependency declarations, which
# collects commands that are run when another target fails.
# TODO: Implementation

View File

@ -1,6 +1,7 @@
# $NetBSD: deptgt-ignore.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: deptgt-ignore.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the special target .IGNORE in dependency declarations.
# Tests for the special target .IGNORE in dependency declarations, which
# does not stop if a command from this target exits with a non-zero status.
# TODO: Implementation

View File

@ -1,6 +1,8 @@
# $NetBSD: deptgt-interrupt.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: deptgt-interrupt.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the special target .INTERRUPT in dependency declarations.
# Tests for the special target .INTERRUPT in dependency declarations, which
# collects commands to be run when make is interrupted while building another
# target.
# TODO: Implementation

View File

@ -1,6 +1,8 @@
# $NetBSD: deptgt-main.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: deptgt-main.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the special target .MAIN in dependency declarations.
# Tests for the special target .MAIN in dependency declarations, which defines
# the main target. This main target is built if no target has been specified
# on the command line or via MAKEFLAGS.
# TODO: Implementation

View File

@ -1,7 +1,10 @@
# $NetBSD: deptgt-makeflags.mk,v 1.5 2020/11/08 02:31:24 rillig Exp $
# $NetBSD: deptgt-makeflags.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the special target .MAKEFLAGS in dependency declarations,
# which adds command line options later, at parse time.
#
# In these unit tests, it is often used to temporarily toggle the debug log
# during parsing.
# The -D option sets a variable in the "Global" scope and thus can be
# undefined later.

View File

@ -1,19 +1,19 @@
make: "directive-for.mk" line 100: outer
make: "directive-for.mk" line 125: a:\ a:\file.txt
make: "directive-for.mk" line 125: d:\\
make: "directive-for.mk" line 125: d:\\file.txt
make: "directive-for.mk" line 132: ( ( (
make: "directive-for.mk" line 132: [ [ [
make: "directive-for.mk" line 132: { { {
make: "directive-for.mk" line 132: ) ) )
make: "directive-for.mk" line 132: ] ] ]
make: "directive-for.mk" line 132: } } }
make: "directive-for.mk" line 132: (()) (()) (())
make: "directive-for.mk" line 132: [[]] [[]] [[]]
make: "directive-for.mk" line 132: {{}} {{}} {{}}
make: "directive-for.mk" line 132: )( )( )(
make: "directive-for.mk" line 132: ][ ][ ][
make: "directive-for.mk" line 132: }{ }{ }{
make: "directive-for.mk" line 140: outer value value
make: "directive-for.mk" line 140: outer "quoted" \"quoted\"
make: "directive-for.mk" line 108: outer
make: "directive-for.mk" line 133: a:\ a:\file.txt
make: "directive-for.mk" line 133: d:\\
make: "directive-for.mk" line 133: d:\\file.txt
make: "directive-for.mk" line 140: ( ( (
make: "directive-for.mk" line 140: [ [ [
make: "directive-for.mk" line 140: { { {
make: "directive-for.mk" line 140: ) ) )
make: "directive-for.mk" line 140: ] ] ]
make: "directive-for.mk" line 140: } } }
make: "directive-for.mk" line 140: (()) (()) (())
make: "directive-for.mk" line 140: [[]] [[]] [[]]
make: "directive-for.mk" line 140: {{}} {{}} {{}}
make: "directive-for.mk" line 140: )( )( )(
make: "directive-for.mk" line 140: ][ ][ ][
make: "directive-for.mk" line 140: }{ }{ }{
make: "directive-for.mk" line 148: outer value value
make: "directive-for.mk" line 148: outer "quoted" \"quoted\"
exit status 0

View File

@ -1,6 +1,13 @@
# $NetBSD: directive-for.mk,v 1.8 2020/10/25 15:49:03 rillig Exp $
# $NetBSD: directive-for.mk,v 1.9 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the .for directive.
#
# TODO: Describe naming conventions for the loop variables.
# .for f in values
# .for file in values
# .for _FILE_ in values
# .for .FILE. in values
# .for _f_ in values
# Using the .for loop, lists of values can be produced.
# In simple cases, the :@var@${var}@ variable modifier can be used to
@ -15,6 +22,7 @@ NUMBERS+= ${num}
.endif
# The .for loop also works for multiple iteration variables.
# This is something that the variable modifier :@ cannot do.
.for name value in VARNAME value NAME2 value2
${name}= ${value}
.endfor
@ -26,7 +34,7 @@ ${name}= ${value}
# just like the :M or :S variable modifiers.
#
# Until 2012-06-03, it had split the items exactly at whitespace, without
# taking the quotes into account.
# taking the quotes into account. This had resulted in 10 words.
#
.undef WORDS
.for var in one t\ w\ o "three three" 'four four' `five six`

View File

@ -1,15 +1,15 @@
make: "directive-if.mk" line 10: 0 evaluates to false.
make: "directive-if.mk" line 14: 1 evaluates to true.
make: "directive-if.mk" line 37: Unknown directive "ifx"
make: "directive-if.mk" line 38: Unknown directive "error"
make: "directive-if.mk" line 39: if-less else
make: "directive-if.mk" line 40: Unknown directive "error"
make: "directive-if.mk" line 41: if-less endif
make: "directive-if.mk" line 44: Malformed conditional ()
make: "directive-if.mk" line 54: Quotes in plain words are probably a mistake.
make: "directive-if.mk" line 63: Don't do this, always put a space after a directive.
make: "directive-if.mk" line 67: Don't do this, always put a space after a directive.
make: "directive-if.mk" line 73: Don't do this, always put a space around comparison operators.
make: "directive-if.mk" line 13: 0 evaluates to false.
make: "directive-if.mk" line 17: 1 evaluates to true.
make: "directive-if.mk" line 40: Unknown directive "ifx"
make: "directive-if.mk" line 41: Unknown directive "error"
make: "directive-if.mk" line 42: if-less else
make: "directive-if.mk" line 43: Unknown directive "error"
make: "directive-if.mk" line 44: if-less endif
make: "directive-if.mk" line 47: Malformed conditional ()
make: "directive-if.mk" line 57: Quotes in plain words are probably a mistake.
make: "directive-if.mk" line 66: Don't do this, always put a space after a directive.
make: "directive-if.mk" line 70: Don't do this, always put a space after a directive.
make: "directive-if.mk" line 76: 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

View File

@ -1,6 +1,9 @@
# $NetBSD: directive-if.mk,v 1.6 2020/11/12 19:46:36 rillig Exp $
# $NetBSD: directive-if.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the .if directive.
#
# See also:
# cond-*.mk
# TODO: Implementation

View File

@ -1,10 +1,10 @@
make: "directive-ifmake.mk" line 10: ok: positive condition works
make: "directive-ifmake.mk" line 21: ok: negation works
make: "directive-ifmake.mk" line 27: ok: double negation works
make: "directive-ifmake.mk" line 34: ok: both mentioned
make: "directive-ifmake.mk" line 41: ok: only those mentioned
make: "directive-ifmake.mk" line 51: Targets can even be added at parse time.
make: "directive-ifmake.mk" line 69: ok
make: "directive-ifmake.mk" line 13: ok: positive condition works
make: "directive-ifmake.mk" line 24: ok: negation works
make: "directive-ifmake.mk" line 33: ok: double negation works
make: "directive-ifmake.mk" line 40: ok: both mentioned
make: "directive-ifmake.mk" line 47: ok: only those mentioned
make: "directive-ifmake.mk" line 57: Targets can even be added at parse time.
make: "directive-ifmake.mk" line 75: ok
: first
: second
: late-target

View File

@ -1,7 +1,10 @@
# $NetBSD: directive-ifmake.mk,v 1.7 2020/11/11 07:13:42 rillig Exp $
# $NetBSD: directive-ifmake.mk,v 1.8 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the .ifmake directive, which provides a shortcut for asking
# whether a certain target is requested to be made from the command line.
#
# TODO: Describe why the shortcut may be useful (if it's useful at all),
# instead of sticking to the simple '.if' only.
# The targets 'first' and 'second' are passed in on the command line.
@ -22,7 +25,10 @@
.endif
# See if the exclamation mark really means "not", or if it is just part of
# the target name.
# the target name. Since it means 'not', the two exclamation marks are
# effectively ignored, and 'first' is indeed a requested target. If the
# exclamation mark were part of the name instead, the name would be '!!first',
# and such a target was not requested to be made.
.ifmake !!first
. info ok: double negation works
.else

View File

@ -1,7 +1,11 @@
# $NetBSD: directive-sinclude.mk,v 1.1 2020/09/13 09:20:23 rillig Exp $
# $NetBSD: directive-sinclude.mk,v 1.2 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the .sinclude directive, which includes another file,
# silently skipping it if it cannot be opened.
#
# The 'silently skipping' only applies to the case where the file cannot be
# opened. Parse errors and other errors are handled the same way as in the
# other .include directives.
# TODO: Implementation

View File

@ -1,4 +1,4 @@
# $NetBSD: moderrs.mk,v 1.24 2020/11/01 14:36:25 rillig Exp $
# $NetBSD: moderrs.mk,v 1.25 2020/11/15 20:20:58 rillig Exp $
#
# various modifier error tests
@ -123,7 +123,7 @@ mod-regex-delimiter: print-header print-footer
# always set; some may be missing. Warn about these.
#
# Since there is no way to turn off this warning, the combination of
# alternative matches and capturing groups is not widely used.
# alternative matches and capturing groups is seldom used, if at all.
#
# A newly added modifier 'U' such as in :C,(a.)|(b.),\1\2,U might be added
# for treating undefined capturing groups as empty, but that would create a

View File

@ -1,4 +1,4 @@
# $NetBSD: modmisc.mk,v 1.50 2020/11/03 18:42:33 rillig Exp $
# $NetBSD: modmisc.mk,v 1.51 2020/11/15 20:20:58 rillig Exp $
#
# miscellaneous modifier tests
@ -60,7 +60,7 @@ undefvar:
mod-quote:
@echo $@: new${.newline:Q}${.newline:Q}line
# Cover the bmake_realloc in brk_string.
# Cover the bmake_realloc in Str_Words.
mod-break-many-words:
@echo $@: ${UNDEF:U:range=500:[#]}

View File

@ -1,6 +1,7 @@
# $NetBSD: modword.mk,v 1.4 2020/11/01 13:55:31 rillig Exp $
# $NetBSD: modword.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
#
# Test behaviour of new :[] modifier
# TODO: When was this modifier new?
all: mod-squarebrackets mod-S-W mod-C-W mod-tW-tw

View File

@ -1,7 +1,12 @@
# $NetBSD: sh-leading-at.mk,v 1.4 2020/11/09 20:57:36 rillig Exp $
# $NetBSD: sh-leading-at.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
#
# Tests for shell commands preceded by an '@', to suppress printing
# the command to stdout.
#
# See also:
# .SILENT
# depsrc-silent.mk
# opt-silent.mk
all:
@

View File

@ -1,7 +1,12 @@
# $NetBSD: sh-leading-hyphen.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: sh-leading-hyphen.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
#
# Tests for shell commands preceded by a '-', to ignore the exit status of
# the command line.
#
# See also:
# .IGNORE
# depsrc-ignore.mk
# opt-ignore.mk
# TODO: Implementation

View File

@ -1,9 +1,13 @@
# $NetBSD: sh-meta-chars.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: sh-meta-chars.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
#
# Tests for running shell commands that contain meta-characters.
#
# These meta-characters decide whether the command is run by the shell
# or executed directly via execv. See Cmd_Exec for details.
# or executed directly via execv, but only in compatibility mode, not
# in jobs mode, and only if MAKE_NATIVE is defined during compilation.
#
# See also:
# Compat_RunCommand, useShell
# TODO: Implementation

View File

@ -1,6 +1,6 @@
this will be evaluated later
make: "var-op-assign.mk" line 52: Need an operator
make: "var-op-assign.mk" line 86: Parsing still continues until here.
make: "var-op-assign.mk" line 59: Need an operator
make: "var-op-assign.mk" line 93: Parsing still continues until here.
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1

View File

@ -1,11 +1,12 @@
# $NetBSD: var-op-assign.mk,v 1.6 2020/10/24 08:50:17 rillig Exp $
# $NetBSD: var-op-assign.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the = variable assignment operator, which overwrites an existing
# variable or creates it.
# This is a simple variable assignment.
# To the left of the assignment operator '=' there is the variable name,
# and to the right is the variable value.
# and to the right is the variable value. The variable value is stored as-is,
# it is not expanded in any way.
#
VAR= value
@ -36,9 +37,15 @@ VAR= new value and \# some $$ special characters # comment
# The variable value may contain references to other variables.
# In this example, the reference is to the variable with the empty name,
# which always expands to an empty string. This alone would not produce
# any side-effects, therefore the variable has a :!...! modifier that
# executes a shell command.
# which is never defined.
#
# This alone would not produce any side-effects, therefore the variable has
# a :!...! modifier that executes a shell command. The :!...! modifier turns
# an undefined expression into a defined one, see ApplyModifier_ShellCommand,
# the call to ApplyModifiersState_Define.
#
# Since the right-hand side of a '=' assignment is not expanded at the time
# when the variable is defined, the first command is not run at all.
VAR= ${:! echo 'not yet evaluated' 1>&2 !}
VAR= ${:! echo 'this will be evaluated later' 1>&2 !}
@ -48,7 +55,7 @@ VAR= ${:! echo 'this will be evaluated later' 1>&2 !}
.endif
# In a variable assignment, the variable name must consist of a single word.
#
# The following line therefore generates a parse error.
VARIABLE NAME= variable value
# But if the whitespace appears inside parentheses or braces, everything is

View File

@ -1,4 +1,4 @@
# $NetBSD: var-op-sunsh.mk,v 1.5 2020/10/04 08:32:52 rillig Exp $
# $NetBSD: var-op-sunsh.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the :sh= variable assignment operator, which runs its right-hand
# side through the shell. It is a seldom-used alternative to the !=
@ -118,5 +118,7 @@ VAR :sh += echo two
. error ${VAR}
.endif
# TODO: test VAR:sh!=command
all:
@:;

View File

@ -1,7 +1,9 @@
# $NetBSD: varmod-shell.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: varmod-shell.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the :sh variable modifier, which runs the shell command
# given by the variable value and returns its output.
#
# TODO: Since when is this modifier available?
# TODO: Implementation

View File

@ -1,4 +1,4 @@
# $NetBSD: varmod-subst.mk,v 1.6 2020/11/03 18:21:36 rillig Exp $
# $NetBSD: varmod-subst.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the :S,from,to, variable modifier.
@ -8,55 +8,72 @@ all: mod-subst-chain
all: mod-subst-dollar
WORDS= sequences of letters
.if ${WORDS:S,,,} != ${WORDS}
. warning The empty pattern matches something.
.endif
.if ${WORDS:S,e,*,1} != "s*quences of letters"
. warning The :S modifier flag '1' is not applied exactly once.
.endif
.if ${WORDS:S,f,*,1} != "sequences o* letters"
. warning The :S modifier flag '1' is only applied to the first word,\
not to the first occurrence.
.endif
.if ${WORDS:S,e,*,} != "s*quences of l*tters"
. warning The :S modifier does not replace every first match per word.
.endif
.if ${WORDS:S,e,*,g} != "s*qu*nc*s of l*tt*rs"
. warning The :S modifier flag 'g' does not replace every occurrence.
.endif
.if ${WORDS:S,^sequ,occurr,} != "occurrences of letters"
. warning The :S modifier fails for a short match anchored at the start.
.endif
.if ${WORDS:S,^of,with,} != "sequences with letters"
. warning The :S modifier fails for an exact match anchored at the start.
.endif
.if ${WORDS:S,^office,does not match,} != ${WORDS}
. warning The :S modifier matches a too long pattern anchored at the start.
.endif
.if ${WORDS:S,f$,r,} != "sequences or letters"
. warning The :S modifier fails for a short match anchored at the end.
.endif
.if ${WORDS:S,s$,,} != "sequence of letter"
. warning The :S modifier fails to replace one occurrence per word.
.endif
.if ${WORDS:S,of$,,} != "sequences letters"
. warning The :S modifier fails for an exact match anchored at the end.
.endif
.if ${WORDS:S,eof$,,} != ${WORDS}
. warning The :S modifier matches a too long pattern anchored at the end.
.endif
.if ${WORDS:S,^of$,,} != "sequences letters"
. warning The :S modifier does not match a word anchored at both ends.
.endif
.if ${WORDS:S,^o$,,} != ${WORDS}
. warning The :S modifier matches a prefix anchored at both ends.
.endif
.if ${WORDS:S,^f$,,} != ${WORDS}
. warning The :S modifier matches a suffix anchored at both ends.
.endif
.if ${WORDS:S,^eof$,,} != ${WORDS}
. warning The :S modifier matches a too long prefix anchored at both ends.
.endif
.if ${WORDS:S,^office$,,} != ${WORDS}
. warning The :S modifier matches a too long suffix anchored at both ends.
.endif

View File

@ -1,7 +1,9 @@
# $NetBSD: varmod-to-lower.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
# $NetBSD: varmod-to-lower.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the :tl variable modifier, which returns the words in the
# variable value, converted to lowercase.
#
# TODO: What about non-ASCII characters? ISO-8859-1, UTF-8?
.if ${:UUPPER:tl} != "upper"
. error

View File

@ -1,4 +1,4 @@
# $NetBSD: varmod-to-separator.mk,v 1.6 2020/11/01 14:36:25 rillig Exp $
# $NetBSD: varmod-to-separator.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the :ts variable modifier, which joins the words of the variable
# using an arbitrary character as word separator.
@ -166,4 +166,10 @@ WORDS= one two three four five six
. info This line is not reached.
.endif
# TODO: This modifier used to accept decimal numbers as well, in the form
# ':ts\120'. When has this been changed to octal, and what happens now
# for ':ts\90' ('Z' in decimal ASCII, undefined in octal)?
# TODO: :ts\x1F600
all:

View File

@ -1,9 +1,10 @@
# $NetBSD: varmod-undefined.mk,v 1.6 2020/10/24 08:46:08 rillig Exp $
# $NetBSD: varmod-undefined.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $
#
# Tests for the :U variable modifier, which returns the given string
# if the variable is undefined.
#
# See also:
# directive-for.mk
# varmod-defined.mk
# The pattern ${:Uword} is heavily used when expanding .for loops.