Module Name:    src
Committed By:   rillig
Date:           Sun Jan 23 16:09:39 UTC 2022

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/usr.bin/make/unit-tests: Makefile directive-sinclude.exp
            directive-sinclude.mk directive-unexport-env.mk
            directive-warning.exp directive-warning.mk directive.exp
            directive.mk opt-debug-cond.exp opt-debug-cond.mk
            opt-debug-curdir.mk opt-debug-var.exp opt-debug-var.mk
            opt-debug-x-trace.exp opt-debug-x-trace.mk opt-define.mk
            opt-env.exp opt-env.mk opt-jobs-internal.exp opt-jobs-internal.mk
            opt-raw.mk opt-silent.exp opt-silent.mk sh.mk var-class-global.mk
            varmod-select-words.exp varmod-select-words.mk
Removed Files:
        src/usr.bin/make/unit-tests: envfirst.exp envfirst.mk modword.exp
            modword.mk

Log Message:
tests/make: extend test suite, move old tests to 2020 scheme

The tests from envfirst.mk are now in opt-env.mk.
The tests from modword.mk are now in varmod-select-words.mk.


To generate a diff of this commit:
cvs rdiff -u -r1.1182 -r1.1183 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.297 -r1.298 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/directive-sinclude.exp \
    src/usr.bin/make/unit-tests/opt-debug-cond.exp \
    src/usr.bin/make/unit-tests/opt-debug-cond.mk \
    src/usr.bin/make/unit-tests/opt-debug-curdir.mk \
    src/usr.bin/make/unit-tests/opt-debug-var.exp \
    src/usr.bin/make/unit-tests/opt-debug-var.mk \
    src/usr.bin/make/unit-tests/opt-debug-x-trace.exp \
    src/usr.bin/make/unit-tests/opt-debug-x-trace.mk \
    src/usr.bin/make/unit-tests/opt-env.exp \
    src/usr.bin/make/unit-tests/opt-jobs-internal.exp \
    src/usr.bin/make/unit-tests/opt-silent.exp \
    src/usr.bin/make/unit-tests/varmod-select-words.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-sinclude.mk \
    src/usr.bin/make/unit-tests/opt-define.mk \
    src/usr.bin/make/unit-tests/opt-env.mk \
    src/usr.bin/make/unit-tests/opt-jobs-internal.mk \
    src/usr.bin/make/unit-tests/opt-raw.mk \
    src/usr.bin/make/unit-tests/opt-silent.mk \
    src/usr.bin/make/unit-tests/sh.mk \
    src/usr.bin/make/unit-tests/var-class-global.mk
cvs rdiff -u -r1.7 -r1.8 \
    src/usr.bin/make/unit-tests/directive-unexport-env.mk
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-warning.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-warning.mk
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive.exp \
    src/usr.bin/make/unit-tests/directive.mk
cvs rdiff -u -r1.1 -r0 src/usr.bin/make/unit-tests/envfirst.exp
cvs rdiff -u -r1.5 -r0 src/usr.bin/make/unit-tests/envfirst.mk
cvs rdiff -u -r1.4 -r0 src/usr.bin/make/unit-tests/modword.exp
cvs rdiff -u -r1.6 -r0 src/usr.bin/make/unit-tests/modword.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-select-words.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1182 src/distrib/sets/lists/tests/mi:1.1183
--- src/distrib/sets/lists/tests/mi:1.1182	Wed Jan 19 22:10:41 2022
+++ src/distrib/sets/lists/tests/mi	Sun Jan 23 16:09:38 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1182 2022/01/19 22:10:41 rillig Exp $
+# $NetBSD: mi,v 1.1183 2022/01/23 16:09:38 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5659,8 +5659,8 @@
 ./usr/tests/usr.bin/make/unit-tests/doterror.mk					tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dotwait.exp					tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dotwait.mk					tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/envfirst.exp				tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/envfirst.mk					tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/envfirst.exp				tests-obsolete		obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/envfirst.mk					tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/make/unit-tests/error.exp					tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/error.mk					tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/escape.exp					tests-usr.bin-tests	compattestfile,atf
@@ -5723,8 +5723,8 @@
 ./usr/tests/usr.bin/make/unit-tests/modorder.mk					tests-obsolete		obsolete
 ./usr/tests/usr.bin/make/unit-tests/modts.exp					tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/modts.mk					tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/modword.exp					tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/modword.mk					tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/modword.exp					tests-obsolete		obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/modword.mk					tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/make/unit-tests/objdir-writable.exp				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/objdir-writable.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/opt-backwards.exp				tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.297 src/usr.bin/make/unit-tests/Makefile:1.298
--- src/usr.bin/make/unit-tests/Makefile:1.297	Sat Jan 22 16:23:56 2022
+++ src/usr.bin/make/unit-tests/Makefile	Sun Jan 23 16:09:38 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.297 2022/01/22 16:23:56 rillig Exp $
+# $NetBSD: Makefile,v 1.298 2022/01/23 16:09:38 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -192,7 +192,6 @@ TESTS+=		directive-warning
 TESTS+=		dollar
 TESTS+=		doterror
 TESTS+=		dotwait
-TESTS+=		envfirst
 TESTS+=		error
 TESTS+=		# escape	# broken by reverting POSIX changes
 TESTS+=		export
@@ -220,7 +219,6 @@ TESTS+=		moderrs
 TESTS+=		modmatch
 TESTS+=		modmisc
 TESTS+=		modts
-TESTS+=		modword
 .if ${.MAKE.UID} > 0
 TESTS+=		objdir-writable
 .endif

Index: src/usr.bin/make/unit-tests/directive-sinclude.exp
diff -u src/usr.bin/make/unit-tests/directive-sinclude.exp:1.1 src/usr.bin/make/unit-tests/directive-sinclude.exp:1.2
--- src/usr.bin/make/unit-tests/directive-sinclude.exp:1.1	Sun Sep 13 09:20:23 2020
+++ src/usr.bin/make/unit-tests/directive-sinclude.exp	Sun Jan 23 16:09:38 2022
@@ -1 +1,4 @@
-exit status 0
+make: "directive-include-error.inc" line 1: Invalid line type
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/opt-debug-cond.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-cond.exp:1.1 src/usr.bin/make/unit-tests/opt-debug-cond.exp:1.2
--- src/usr.bin/make/unit-tests/opt-debug-cond.exp:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-cond.exp	Sun Jan 23 16:09:38 2022
@@ -1 +1,6 @@
+CondParser_Eval: ${:U12345} > ${:U55555}
+lhs = 12345.000000, rhs = 55555.000000, op = >
+CondParser_Eval: "string" != "string"
+lhs = "string", rhs = "string", op = !=
+CondParser_Eval: "nonempty"
 exit status 0
Index: src/usr.bin/make/unit-tests/opt-debug-cond.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-cond.mk:1.1 src/usr.bin/make/unit-tests/opt-debug-cond.mk:1.2
--- src/usr.bin/make/unit-tests/opt-debug-cond.mk:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-cond.mk	Sun Jan 23 16:09:38 2022
@@ -1,10 +1,24 @@
-# $NetBSD: opt-debug-cond.mk,v 1.1 2020/09/05 06:20:51 rillig Exp $
+# $NetBSD: opt-debug-cond.mk,v 1.2 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the -dc command line option, which adds debug logging for the
 # evaluation of conditional expressions, such as in .if directives and
 # ${cond:?then:else} expressions.
 
-# TODO: Implementation
+.MAKEFLAGS: -dc
 
-all:
-	@:;
+# expect: CondParser_Eval: ${:U12345} > ${:U55555}
+# expect: lhs = 12345.000000, rhs = 55555.000000, op = >
+.if ${:U12345} > ${:U55555}
+
+# expect: CondParser_Eval: "string" != "string"
+# expect: lhs = "string", rhs = "string", op = !=
+.elif "string" != "string"
+
+# expect: CondParser_Eval: "nonempty"
+.elif "nonempty"
+
+.endif
+
+.MAKEFLAGS: -d0
+
+all: .PHONY
Index: src/usr.bin/make/unit-tests/opt-debug-curdir.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-curdir.mk:1.1 src/usr.bin/make/unit-tests/opt-debug-curdir.mk:1.2
--- src/usr.bin/make/unit-tests/opt-debug-curdir.mk:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-curdir.mk	Sun Jan 23 16:09:38 2022
@@ -1,8 +1,8 @@
-# $NetBSD: opt-debug-curdir.mk,v 1.1 2020/09/05 06:20:51 rillig Exp $
+# $NetBSD: opt-debug-curdir.mk,v 1.2 2022/01/23 16:09:38 rillig Exp $
 #
-# Tests for the -dC command line option, which does nothing, as of 2020-09-05.
+# Tests for the -dC command line option, which does nothing, as of 2020-09-05,
+# as the string "DEBUG(CWD" does not occur in the source code.
 
-# TODO: Implementation
+.MAKEFLAGS: -dC
 
-all:
-	@:;
+all: .PHONY
Index: src/usr.bin/make/unit-tests/opt-debug-var.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-var.exp:1.1 src/usr.bin/make/unit-tests/opt-debug-var.exp:1.2
--- src/usr.bin/make/unit-tests/opt-debug-var.exp:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-var.exp	Sun Jan 23 16:09:38 2022
@@ -1 +1,7 @@
+Global: ASSIGNED = value
+Global: SUBST = 
+Global: SUBST = value
+Var_Parse: y(ASSIGNED) (eval)
+Global: .MAKEFLAGS =  -r -k -d v -d
+Global: .MAKEFLAGS =  -r -k -d v -d 0
 exit status 0
Index: src/usr.bin/make/unit-tests/opt-debug-var.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-var.mk:1.1 src/usr.bin/make/unit-tests/opt-debug-var.mk:1.2
--- src/usr.bin/make/unit-tests/opt-debug-var.mk:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-var.mk	Sun Jan 23 16:09:38 2022
@@ -1,9 +1,31 @@
-# $NetBSD: opt-debug-var.mk,v 1.1 2020/09/05 06:20:51 rillig Exp $
+# $NetBSD: opt-debug-var.mk,v 1.2 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the -dv command line option, which adds debug logging about
 # variable assignment and evaluation.
 
-# TODO: Implementation
+.MAKEFLAGS: -dv
 
-all:
-	@:;
+# expect: Global: ASSIGNED = value
+ASSIGNED=	value
+
+# TODO: Explain why the empty assignment "Global: SUBST = " is needed.
+# expect: Global: SUBST = value
+SUBST:=		value
+
+.if defined(ASSIGNED)
+.endif
+
+# The usual form of variable expressions is ${VAR}.  The form $(VAR) is used
+# less often as it can be visually confused with the shell construct for
+# capturing the output of a subshell, which looks the same.
+#
+# In conditions, a call to the function 'empty' is syntactically similar to
+# the form $(VAR), only that the initial '$' is the 'y' of 'empty'.
+#
+# expect: Var_Parse: y(ASSIGNED) (eval)
+.if !empty(ASSIGNED)
+.endif
+
+.MAKEFLAGS: -d0
+
+all: .PHONY
Index: src/usr.bin/make/unit-tests/opt-debug-x-trace.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-x-trace.exp:1.1 src/usr.bin/make/unit-tests/opt-debug-x-trace.exp:1.2
--- src/usr.bin/make/unit-tests/opt-debug-x-trace.exp:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-x-trace.exp	Sun Jan 23 16:09:38 2022
@@ -1 +1,3 @@
++ echo 'Counting 1 2 3 4 5 6 7'
+Counting 1 2 3 4 5 6 7
 exit status 0
Index: src/usr.bin/make/unit-tests/opt-debug-x-trace.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-x-trace.mk:1.1 src/usr.bin/make/unit-tests/opt-debug-x-trace.mk:1.2
--- src/usr.bin/make/unit-tests/opt-debug-x-trace.mk:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-x-trace.mk	Sun Jan 23 16:09:38 2022
@@ -1,10 +1,12 @@
-# $NetBSD: opt-debug-x-trace.mk,v 1.1 2020/09/05 06:20:51 rillig Exp $
+# $NetBSD: opt-debug-x-trace.mk,v 1.2 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the -dx command line option, which runs shell commands with
 # the -x option, thereby printing the actual commands as they are
 # executed.
 
-# TODO: Implementation
+.MAKEFLAGS: -dx
 
-all:
-	@:;
+# expect: + echo 'Counting 1 2 3 4 5 6 7'
+# expect: Counting 1 2 3 4 5 6 7
+all: .PHONY
+	@echo 'Counting ${:U:range=7}'
Index: src/usr.bin/make/unit-tests/opt-env.exp
diff -u src/usr.bin/make/unit-tests/opt-env.exp:1.1 src/usr.bin/make/unit-tests/opt-env.exp:1.2
--- src/usr.bin/make/unit-tests/opt-env.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-env.exp	Sun Jan 23 16:09:38 2022
@@ -1 +1,5 @@
-exit status 0
+make: "opt-env.mk" line 9: Malformed conditional (${FROM_ENV} != value-from-env)
+make: "opt-env.mk" line 16: value-from-mk
+
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/opt-jobs-internal.exp
diff -u src/usr.bin/make/unit-tests/opt-jobs-internal.exp:1.1 src/usr.bin/make/unit-tests/opt-jobs-internal.exp:1.2
--- src/usr.bin/make/unit-tests/opt-jobs-internal.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-jobs-internal.exp	Sun Jan 23 16:09:38 2022
@@ -1 +1,6 @@
-exit status 0
+make: internal error -- J option malformed (garbage)
+usage: make [-BeikNnqrSstWwX]
+            [-C directory] [-D variable] [-d flags] [-f makefile]
+            [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]
+            [-V variable] [-v variable] [variable=value] [target ...]
+exit status 2
Index: src/usr.bin/make/unit-tests/opt-silent.exp
diff -u src/usr.bin/make/unit-tests/opt-silent.exp:1.1 src/usr.bin/make/unit-tests/opt-silent.exp:1.2
--- src/usr.bin/make/unit-tests/opt-silent.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-silent.exp	Sun Jan 23 16:09:38 2022
@@ -1 +1,3 @@
+message
+silent message
 exit status 0
Index: src/usr.bin/make/unit-tests/varmod-select-words.exp
diff -u src/usr.bin/make/unit-tests/varmod-select-words.exp:1.1 src/usr.bin/make/unit-tests/varmod-select-words.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-select-words.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-select-words.exp	Sun Jan 23 16:09:38 2022
@@ -1 +1,126 @@
+make: Bad modifier ":[]" for variable "LIST"
+LIST:[]="" is an error
+LIST:[0]="one two three four five six"
+LIST:[0x0]="one two three four five six"
+LIST:[000]="one two three four five six"
+LIST:[*]="one two three four five six"
+LIST:[@]="one two three four five six"
+LIST:[0]:C/ /,/="one,two three four five six"
+LIST:[0]:C/ /,/g="one,two,three,four,five,six"
+LIST:[0]:C/ /,/1g="one,two,three,four,five,six"
+LIST:[*]:C/ /,/="one,two three four five six"
+LIST:[*]:C/ /,/g="one,two,three,four,five,six"
+LIST:[*]:C/ /,/1g="one,two,three,four,five,six"
+LIST:[@]:C/ /,/="one two three four five six"
+LIST:[@]:C/ /,/g="one two three four five six"
+LIST:[@]:C/ /,/1g="one two three four five six"
+LIST:[@]:[0]:C/ /,/="one,two three four five six"
+LIST:[0]:[@]:C/ /,/="one two three four five six"
+LIST:[@]:[*]:C/ /,/="one,two three four five six"
+LIST:[*]:[@]:C/ /,/="one two three four five six"
+EMPTY=""
+EMPTY:[#]="1" == 1 ?
+ESCAPEDSPACE="\ "
+ESCAPEDSPACE:[#]="1" == 1 ?
+REALLYSPACE=" "
+REALLYSPACE:[#]="1" == 1 ?
+LIST:[#]="6"
+LIST:[0]:[#]="1" == 1 ?
+LIST:[*]:[#]="1" == 1 ?
+LIST:[@]:[#]="6"
+LIST:[1]:[#]="1"
+LIST:[1..3]:[#]="3"
+EMPTY:[1]=""
+ESCAPEDSPACE="\ "
+ESCAPEDSPACE:[1]="\ "
+REALLYSPACE=" "
+REALLYSPACE:[1]="" == "" ?
+REALLYSPACE:[*]:[1]=" " == " " ?
+LIST:[1]="one"
+make: Bad modifier ":[1.]" for variable "LIST"
+LIST:[1.]="" is an error
+make: Bad modifier ":[1]." for variable "LIST"
+LIST:[1].="}" is an error
+LIST:[2]="two"
+LIST:[6]="six"
+LIST:[7]=""
+LIST:[999]=""
+make: Bad modifier ":[-]" for variable "LIST"
+LIST:[-]="" is an error
+make: Bad modifier ":[--]" for variable "LIST"
+LIST:[--]="" is an error
+LIST:[-1]="six"
+LIST:[-2]="five"
+LIST:[-6]="one"
+LIST:[-7]=""
+LIST:[-999]=""
+LONGLIST:[17]="17"
+LONGLIST:[0x11]="17"
+LONGLIST:[021]="17"
+LIST:[0]:[1]="one two three four five six"
+LIST:[*]:[1]="one two three four five six"
+LIST:[@]:[1]="one"
+LIST:[0]:[2]=""
+LIST:[*]:[2]=""
+LIST:[@]:[2]="two"
+LIST:[*]:C/ /,/:[2]=""
+LIST:[*]:C/ /,/:[*]:[2]=""
+LIST:[*]:C/ /,/:[@]:[2]="three"
+LONGLIST:[012..0x12]="10 11 12 13 14 15 16 17 18"
+make: Bad modifier ":[1.]" for variable "LIST"
+LIST:[1.]="" is an error
+make: Bad modifier ":[1..]" for variable "LIST"
+LIST:[1..]="" is an error
+make: Bad modifier ":[1.. ]" for variable "LIST"
+LIST:[1.. ]="" is an error
+LIST:[1..1]="one"
+make: Bad modifier ":[1..1.]" for variable "LIST"
+LIST:[1..1.]="" is an error
+LIST:[1..2]="one two"
+LIST:[2..1]="two one"
+LIST:[3..-2]="three four five"
+LIST:[-4..4]="three four"
+make: Bad modifier ":[0..1]" for variable "LIST"
+LIST:[0..1]="" is an error
+make: Bad modifier ":[-1..0]" for variable "LIST"
+LIST:[-1..0]="" is an error
+LIST:[-1..1]="six five four three two one"
+LIST:[0..0]="one two three four five six"
+LIST:[3..99]="three four five six"
+LIST:[-3..-99]="four three two one"
+LIST:[-99..-3]="one two three four"
+HASH="#" == "#" ?
+LIST:[${HASH}]="6"
+LIST:[${ZERO}]="one two three four five six"
+LIST:[${ZERO}x${ONE}]="one"
+LIST:[${ONE}]="one"
+LIST:[${MINUSONE}]="six"
+LIST:[${STAR}]="one two three four five six"
+LIST:[${AT}]="one two three four five six"
+make: Bad modifier ":[${EMPTY" for variable "LIST"
+LIST:[${EMPTY}]="" is an error
+LIST:[${LONGLIST:[21]:S/2//}]="one"
+LIST:[${LIST:[#]}]="six"
+LIST:[${LIST:[${HASH}]}]="six"
+LIST:[  -1..   +3]="six five four three"
+LIST:S/ /,/="one two three four five six"
+LIST:S/ /,/W="one,two three four five six"
+LIST:S/ /,/gW="one,two,three,four,five,six"
+EMPTY:S/^/,/=","
+EMPTY:S/^/,/W=","
+LIST:C/ /,/="one two three four five six"
+LIST:C/ /,/W="one,two three four five six"
+LIST:C/ /,/gW="one,two,three,four,five,six"
+EMPTY:C/^/,/=","
+EMPTY:C/^/,/W=","
+LIST:tW="one two three four five six"
+LIST:tw="one two three four five six"
+LIST:tW:C/ /,/="one,two three four five six"
+LIST:tW:C/ /,/g="one,two,three,four,five,six"
+LIST:tW:C/ /,/1g="one,two,three,four,five,six"
+LIST:tw:C/ /,/="one two three four five six"
+LIST:tw:C/ /,/g="one two three four five six"
+LIST:tw:C/ /,/1g="one two three four five six"
+LIST:tw:tW:C/ /,/="one,two three four five six"
+LIST:tW:tw:C/ /,/="one two three four five six"
 exit status 0

Index: src/usr.bin/make/unit-tests/directive-sinclude.mk
diff -u src/usr.bin/make/unit-tests/directive-sinclude.mk:1.2 src/usr.bin/make/unit-tests/directive-sinclude.mk:1.3
--- src/usr.bin/make/unit-tests/directive-sinclude.mk:1.2	Sun Nov 15 20:20:58 2020
+++ src/usr.bin/make/unit-tests/directive-sinclude.mk	Sun Jan 23 16:09:38 2022
@@ -1,4 +1,4 @@
-# $NetBSD: directive-sinclude.mk,v 1.2 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: directive-sinclude.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the .sinclude directive, which includes another file,
 # silently skipping it if it cannot be opened.
@@ -7,7 +7,17 @@
 # opened.  Parse errors and other errors are handled the same way as in the
 # other .include directives.
 
-# TODO: Implementation
+# No complaint that there is no such file.
+.sinclude "${.CURDIR}/directive-include-nonexistent.inc"
+
+# No complaint either, even though the operating system error is ENOTDIR, not
+# ENOENT.
+.sinclude "${MAKEFILE}/subdir"
+
+# Errors that are not related to opening the file are still reported.
+# expect: make: "directive-include-error.inc" line 1: Invalid line type
+_!=	echo 'syntax error' > directive-include-error.inc
+.sinclude "${.CURDIR}/directive-include-error.inc"
+_!=	rm directive-include-error.inc
 
 all:
-	@:;
Index: src/usr.bin/make/unit-tests/opt-define.mk
diff -u src/usr.bin/make/unit-tests/opt-define.mk:1.2 src/usr.bin/make/unit-tests/opt-define.mk:1.3
--- src/usr.bin/make/unit-tests/opt-define.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-define.mk	Sun Jan 23 16:09:38 2022
@@ -1,8 +1,28 @@
-# $NetBSD: opt-define.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-define.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
 #
-# Tests for the -D command line option.
+# Tests for the -D command line option, which defines global variables to the
+# value 1, like in the C preprocessor.
 
-# TODO: Implementation
+.MAKEFLAGS: -DVAR
 
-all:
-	@:;
+# The variable has the exact value "1", not "1.0".
+.if ${VAR} != "1"
+.  error
+.endif
+
+# The variable can be overwritten by assigning another value to it.  This
+# would not be possible if the variable had been specified on the command line
+# as 'VAR=1' instead of '-DVAR'.
+VAR=		overwritten
+.if ${VAR} != "overwritten"
+.  error
+.endif
+
+# The variable can be undefined.  If the variable had been defined in the
+# "Internal" scope instead, undefining it would have no effect.
+.undef VAR
+.if defined(VAR)
+.  error
+.endif
+
+all: .PHONY
Index: src/usr.bin/make/unit-tests/opt-env.mk
diff -u src/usr.bin/make/unit-tests/opt-env.mk:1.2 src/usr.bin/make/unit-tests/opt-env.mk:1.3
--- src/usr.bin/make/unit-tests/opt-env.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-env.mk	Sun Jan 23 16:09:38 2022
@@ -1,8 +1,45 @@
-# $NetBSD: opt-env.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-env.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the -e command line option.
 
-# TODO: Implementation
+# The variable FROM_ENV is defined in ./Makefile.
 
-all:
-	@:;
+.MAKEFLAGS: -e
+
+.if ${FROM_ENV} != value-from-env
+.  error ${FROM_ENV}
+.endif
+
+# Try to override the variable; this does not have any effect.
+FROM_ENV=	value-from-mk
+.if ${FROM_ENV} != value-from-env
+.  error ${FROM_ENV}
+.endif
+
+# Try to append to the variable; this also doesn't have any effect.
+FROM_ENV+=	appended
+.if ${FROM_ENV} != value-from-env
+.  error ${FROM_ENV}
+.endif
+
+# The default assignment also cannot change the variable.
+FROM_ENV?=	default
+.if ${FROM_ENV} != value-from-env
+.  error ${FROM_ENV}
+.endif
+
+# Neither can the assignment modifiers.
+.if ${FROM_ENV::=from-condition}
+.endif
+.if ${FROM_ENV} != value-from-env
+.  error ${FROM_ENV}
+.endif
+
+# Even .undef doesn't work since it only affects the global scope,
+# which is independent from the environment variables.
+.undef FROM_ENV
+.if ${FROM_ENV} != value-from-env
+.  error ${FROM_ENV}
+.endif
+
+all: .PHONY
Index: src/usr.bin/make/unit-tests/opt-jobs-internal.mk
diff -u src/usr.bin/make/unit-tests/opt-jobs-internal.mk:1.2 src/usr.bin/make/unit-tests/opt-jobs-internal.mk:1.3
--- src/usr.bin/make/unit-tests/opt-jobs-internal.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-jobs-internal.mk	Sun Jan 23 16:09:38 2022
@@ -1,8 +1,9 @@
-# $NetBSD: opt-jobs-internal.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-jobs-internal.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the (intentionally undocumented) -J command line option.
+#
+# Only test the error handling here, the happy path is covered in other tests
+# as a side effect.
 
-# TODO: Implementation
-
-all:
-	@:;
+# expect: make: internal error -- J option malformed (garbage)
+.MAKEFLAGS: -Jgarbage
Index: src/usr.bin/make/unit-tests/opt-raw.mk
diff -u src/usr.bin/make/unit-tests/opt-raw.mk:1.2 src/usr.bin/make/unit-tests/opt-raw.mk:1.3
--- src/usr.bin/make/unit-tests/opt-raw.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-raw.mk	Sun Jan 23 16:09:38 2022
@@ -1,8 +1,14 @@
-# $NetBSD: opt-raw.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-raw.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
 #
-# Tests for the -r command line option.
+# Tests for the -r command line option, which skips the system-defined default
+# rules from <sys.mk>.
 
-# TODO: Implementation
+# To provide a clean testing environment without unintended side effects,
+# these unit tests run make with the option '-r' by default.  This means there
+# are no predefined suffixes and no predefined tools.
 
-all:
-	@:;
+.if defined(CC)
+.  error
+.endif
+
+all: .PHONY
Index: src/usr.bin/make/unit-tests/opt-silent.mk
diff -u src/usr.bin/make/unit-tests/opt-silent.mk:1.2 src/usr.bin/make/unit-tests/opt-silent.mk:1.3
--- src/usr.bin/make/unit-tests/opt-silent.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-silent.mk	Sun Jan 23 16:09:38 2022
@@ -1,8 +1,10 @@
-# $NetBSD: opt-silent.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-silent.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the -s command line option.
 
-# TODO: Implementation
+.MAKEFLAGS: -s
 
+# No matter whether a command is prefixed by '@' or not, it is not echoed.
 all:
-	@:;
+	echo 'message'
+	@echo 'silent message'
Index: src/usr.bin/make/unit-tests/sh.mk
diff -u src/usr.bin/make/unit-tests/sh.mk:1.2 src/usr.bin/make/unit-tests/sh.mk:1.3
--- src/usr.bin/make/unit-tests/sh.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/sh.mk	Sun Jan 23 16:09:38 2022
@@ -1,7 +1,10 @@
-# $NetBSD: sh.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: sh.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for running shell commands from the targets, or from the != variable
 # assignment operator or the :sh variable modifier.
+#
+# See also:
+#	var-op-shell.mk		for the assignment operator '!='
 
 # TODO: Implementation
 
Index: src/usr.bin/make/unit-tests/var-class-global.mk
diff -u src/usr.bin/make/unit-tests/var-class-global.mk:1.2 src/usr.bin/make/unit-tests/var-class-global.mk:1.3
--- src/usr.bin/make/unit-tests/var-class-global.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/var-class-global.mk	Sun Jan 23 16:09:38 2022
@@ -1,8 +1,18 @@
-# $NetBSD: var-class-global.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: var-class-global.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for global variables, which are the most common variables.
 
-# TODO: Implementation
+# Global variables can be assigned and appended to.
+GLOBAL=		value
+GLOBAL+=	addition
+.if ${GLOBAL} != "value addition"
+.  error
+.endif
 
-all:
-	@:;
+# Global variables can be removed from their scope.
+.undef GLOBAL
+.if defined(GLOBAL)
+.  error
+.endif
+
+all: .PHONY

Index: src/usr.bin/make/unit-tests/directive-unexport-env.mk
diff -u src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.7 src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.8
--- src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.7	Sat Dec 12 18:11:42 2020
+++ src/usr.bin/make/unit-tests/directive-unexport-env.mk	Sun Jan 23 16:09:38 2022
@@ -1,4 +1,4 @@
-# $NetBSD: directive-unexport-env.mk,v 1.7 2020/12/12 18:11:42 rillig Exp $
+# $NetBSD: directive-unexport-env.mk,v 1.8 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the .unexport-env directive.
 #
@@ -21,5 +21,4 @@ UT_UNEXPORTED=	value
 .unexport-env UT_EXPORTED UT_UNEXPORTED
 .MAKEFLAGS: -d0
 
-all:
-	@:;
+all: .PHONY

Index: src/usr.bin/make/unit-tests/directive-warning.exp
diff -u src/usr.bin/make/unit-tests/directive-warning.exp:1.4 src/usr.bin/make/unit-tests/directive-warning.exp:1.5
--- src/usr.bin/make/unit-tests/directive-warning.exp:1.4	Sat Dec 19 22:33:11 2020
+++ src/usr.bin/make/unit-tests/directive-warning.exp	Sun Jan 23 16:09:38 2022
@@ -1,11 +1,11 @@
-make: "directive-warning.mk" line 11: Unknown directive "warn"
-make: "directive-warning.mk" line 12: Unknown directive "warn"
-make: "directive-warning.mk" line 13: Unknown directive "warnin"
-make: "directive-warning.mk" line 14: Unknown directive "warnin"
-make: "directive-warning.mk" line 15: Missing argument for ".warning"
-make: "directive-warning.mk" line 16: warning: message
-make: "directive-warning.mk" line 17: Unknown directive "warnings"
-make: "directive-warning.mk" line 18: Unknown directive "warnings"
+make: "directive-warning.mk" line 9: Unknown directive "warn"
+make: "directive-warning.mk" line 10: Unknown directive "warn"
+make: "directive-warning.mk" line 11: Unknown directive "warnin"
+make: "directive-warning.mk" line 12: Unknown directive "warnin"
+make: "directive-warning.mk" line 13: Missing argument for ".warning"
+make: "directive-warning.mk" line 14: warning: message
+make: "directive-warning.mk" line 15: Unknown directive "warnings"
+make: "directive-warning.mk" line 16: Unknown directive "warnings"
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/directive-warning.mk
diff -u src/usr.bin/make/unit-tests/directive-warning.mk:1.6 src/usr.bin/make/unit-tests/directive-warning.mk:1.7
--- src/usr.bin/make/unit-tests/directive-warning.mk:1.6	Sat Dec 19 22:33:11 2020
+++ src/usr.bin/make/unit-tests/directive-warning.mk	Sun Jan 23 16:09:38 2022
@@ -1,4 +1,4 @@
-# $NetBSD: directive-warning.mk,v 1.6 2020/12/19 22:33:11 rillig Exp $
+# $NetBSD: directive-warning.mk,v 1.7 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the .warning directive.
 #
@@ -6,16 +6,13 @@
 # produced the wrong error message "Unknown directive".  Since parse.c 1.503
 # from 2020-12-19, the correct "Missing argument" is produced.
 
-# TODO: Implementation
-
 .warn				# misspelled
 .warn message			# misspelled
 .warnin				# misspelled
 .warnin	message			# misspelled
 .warning			# "Missing argument"
-.warning message		# ok
+.warning message		# expect+0: message
 .warnings			# misspelled
 .warnings messages		# Accepted before 2020-12-13 01:07:54.
 
-all:
-	@:;
+all: .PHONY

Index: src/usr.bin/make/unit-tests/directive.exp
diff -u src/usr.bin/make/unit-tests/directive.exp:1.5 src/usr.bin/make/unit-tests/directive.exp:1.6
--- src/usr.bin/make/unit-tests/directive.exp:1.5	Mon Dec 13 23:38:54 2021
+++ src/usr.bin/make/unit-tests/directive.exp	Sun Jan 23 16:09:38 2022
@@ -1,14 +1,14 @@
-make: "directive.mk" line 9: Unknown directive "indented"
 make: "directive.mk" line 10: Unknown directive "indented"
-make: "directive.mk" line 11: Unknown directive "indented"
-make: "directive.mk" line 15: Unknown directive "info"
+make: "directive.mk" line 12: Unknown directive "indented"
+make: "directive.mk" line 14: Unknown directive "indented"
+make: "directive.mk" line 21: Unknown directive "info"
 Global: .info = 
 Global: .info = value
-make: "directive.mk" line 26: :=	value
+make: "directive.mk" line 33: :=	value
 Global: .MAKEFLAGS =  -r -k -d v -d
 Global: .MAKEFLAGS =  -r -k -d v -d 0
-make: "directive.mk" line 35: Invalid line type
-make: "directive.mk" line 38: Invalid line type
+make: "directive.mk" line 42: Invalid line type
+make: "directive.mk" line 45: Invalid line type
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
Index: src/usr.bin/make/unit-tests/directive.mk
diff -u src/usr.bin/make/unit-tests/directive.mk:1.5 src/usr.bin/make/unit-tests/directive.mk:1.6
--- src/usr.bin/make/unit-tests/directive.mk:1.5	Mon Dec 13 23:38:54 2021
+++ src/usr.bin/make/unit-tests/directive.mk	Sun Jan 23 16:09:38 2022
@@ -1,4 +1,4 @@
-# $NetBSD: directive.mk,v 1.5 2021/12/13 23:38:54 rillig Exp $
+# $NetBSD: directive.mk,v 1.6 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the preprocessing directives, such as .if or .info.
 
@@ -6,23 +6,30 @@
 
 # Unknown directives are correctly named in the error messages,
 # even if they are indented.
+# expect+1: Unknown directive "indented"
 .indented none
+# expect+1: Unknown directive "indented"
 .  indented 2 spaces
+# expect+1: Unknown directive "indented"
 .	indented tab
 
 # Directives must be written directly, not indirectly via variable
 # expressions.
+# FIXME: The error message is misleading because it shows the expanded text of
+#  the line, while the parser works on the unexpanded line.
+# expect+1: Unknown directive "info"
 .${:Uinfo} directives cannot be indirect
 
 # There is no directive called '.target', therefore this is parsed as a
 # dependency declaration with 2 targets and 1 source.
 .target target: source
 
-# This looks ambiguous.  It could be either an .info message or a variable
-# assignment.  It is a variable assignment.
+# The following lines demonstrate how the parser tells an .info message apart
+# from a variable assignment to ".info", which syntactically is very similar.
 .MAKEFLAGS: -dv
-.info:=		value
+.info:=		value		# This is a variable assignment.
 .info?=		value		# This is a variable assignment as well.
+# expect+1: :=	value
 .info :=	value		# The space after the '.info' makes this
 				# a directive.
 .MAKEFLAGS: -d0

Index: src/usr.bin/make/unit-tests/varmod-select-words.mk
diff -u src/usr.bin/make/unit-tests/varmod-select-words.mk:1.3 src/usr.bin/make/unit-tests/varmod-select-words.mk:1.4
--- src/usr.bin/make/unit-tests/varmod-select-words.mk:1.3	Sun Dec  5 12:06:23 2021
+++ src/usr.bin/make/unit-tests/varmod-select-words.mk	Sun Jan 23 16:09:38 2022
@@ -1,12 +1,166 @@
-# $NetBSD: varmod-select-words.mk,v 1.3 2021/12/05 12:06:23 rillig Exp $
+# $NetBSD: varmod-select-words.mk,v 1.4 2022/01/23 16:09:38 rillig Exp $
 #
 # Tests for the :[...] variable modifier, which selects a single word
 # or a range of words from a variable.
 #
+# History:
+#	The variable modifier ':[...]' was added on 2003-09-27.
+#
 # See also:
 #	modword.mk		(should be migrated here)
 
-# TODO: Implementation
+all: mod-squarebrackets mod-S-W mod-C-W mod-tW-tw
+
+LIST=		one two three four five six
+LONGLIST=	1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
+
+EMPTY=		# the space should be ignored
+ESCAPEDSPACE=	\ # escaped space before the '#', the actual value is '\ '
+REALLYSPACE:=	${:U }
+HASH=		\#
+AT=		@
+STAR=		*
+ZERO=		0
+ONE=		1
+MINUSONE=	-1
+
+mod-squarebrackets: mod-squarebrackets-0-star-at \
+	mod-squarebrackets-hash \
+	mod-squarebrackets-n \
+	mod-squarebrackets-start-end \
+	mod-squarebrackets-nested \
+	mod-squarebrackets-space
+
+mod-squarebrackets-0-star-at:
+	@echo 'LIST:[]="${LIST:[]}" is an error'
+	@echo 'LIST:[0]="${LIST:[0]}"'
+	@echo 'LIST:[0x0]="${LIST:[0x0]}"'
+	@echo 'LIST:[000]="${LIST:[000]}"'
+	@echo 'LIST:[*]="${LIST:[*]}"'
+	@echo 'LIST:[@]="${LIST:[@]}"'
+	@echo 'LIST:[0]:C/ /,/="${LIST:[0]:C/ /,/}"'
+	@echo 'LIST:[0]:C/ /,/g="${LIST:[0]:C/ /,/g}"'
+	@echo 'LIST:[0]:C/ /,/1g="${LIST:[0]:C/ /,/1g}"'
+	@echo 'LIST:[*]:C/ /,/="${LIST:[*]:C/ /,/}"'
+	@echo 'LIST:[*]:C/ /,/g="${LIST:[*]:C/ /,/g}"'
+	@echo 'LIST:[*]:C/ /,/1g="${LIST:[*]:C/ /,/1g}"'
+	@echo 'LIST:[@]:C/ /,/="${LIST:[@]:C/ /,/}"'
+	@echo 'LIST:[@]:C/ /,/g="${LIST:[@]:C/ /,/g}"'
+	@echo 'LIST:[@]:C/ /,/1g="${LIST:[@]:C/ /,/1g}"'
+	@echo 'LIST:[@]:[0]:C/ /,/="${LIST:[@]:[0]:C/ /,/}"'
+	@echo 'LIST:[0]:[@]:C/ /,/="${LIST:[0]:[@]:C/ /,/}"'
+	@echo 'LIST:[@]:[*]:C/ /,/="${LIST:[@]:[*]:C/ /,/}"'
+	@echo 'LIST:[*]:[@]:C/ /,/="${LIST:[*]:[@]:C/ /,/}"'
+
+mod-squarebrackets-hash:
+	@echo 'EMPTY="${EMPTY}"'
+	@echo 'EMPTY:[#]="${EMPTY:[#]}" == 1 ?'
+	@echo 'ESCAPEDSPACE="${ESCAPEDSPACE}"'
+	@echo 'ESCAPEDSPACE:[#]="${ESCAPEDSPACE:[#]}" == 1 ?'
+	@echo 'REALLYSPACE="${REALLYSPACE}"'
+	@echo 'REALLYSPACE:[#]="${REALLYSPACE:[#]}" == 1 ?'
+	@echo 'LIST:[#]="${LIST:[#]}"'
+	@echo 'LIST:[0]:[#]="${LIST:[0]:[#]}" == 1 ?'
+	@echo 'LIST:[*]:[#]="${LIST:[*]:[#]}" == 1 ?'
+	@echo 'LIST:[@]:[#]="${LIST:[@]:[#]}"'
+	@echo 'LIST:[1]:[#]="${LIST:[1]:[#]}"'
+	@echo 'LIST:[1..3]:[#]="${LIST:[1..3]:[#]}"'
+
+mod-squarebrackets-n:
+	@echo 'EMPTY:[1]="${EMPTY:[1]}"'
+	@echo 'ESCAPEDSPACE="${ESCAPEDSPACE}"'
+	@echo 'ESCAPEDSPACE:[1]="${ESCAPEDSPACE:[1]}"'
+	@echo 'REALLYSPACE="${REALLYSPACE}"'
+	@echo 'REALLYSPACE:[1]="${REALLYSPACE:[1]}" == "" ?'
+	@echo 'REALLYSPACE:[*]:[1]="${REALLYSPACE:[*]:[1]}" == " " ?'
+	@echo 'LIST:[1]="${LIST:[1]}"'
+	@echo 'LIST:[1.]="${LIST:[1.]}" is an error'
+	@echo 'LIST:[1].="${LIST:[1].}" is an error'
+	@echo 'LIST:[2]="${LIST:[2]}"'
+	@echo 'LIST:[6]="${LIST:[6]}"'
+	@echo 'LIST:[7]="${LIST:[7]}"'
+	@echo 'LIST:[999]="${LIST:[999]}"'
+	@echo 'LIST:[-]="${LIST:[-]}" is an error'
+	@echo 'LIST:[--]="${LIST:[--]}" is an error'
+	@echo 'LIST:[-1]="${LIST:[-1]}"'
+	@echo 'LIST:[-2]="${LIST:[-2]}"'
+	@echo 'LIST:[-6]="${LIST:[-6]}"'
+	@echo 'LIST:[-7]="${LIST:[-7]}"'
+	@echo 'LIST:[-999]="${LIST:[-999]}"'
+	@echo 'LONGLIST:[17]="${LONGLIST:[17]}"'
+	@echo 'LONGLIST:[0x11]="${LONGLIST:[0x11]}"'
+	@echo 'LONGLIST:[021]="${LONGLIST:[021]}"'
+	@echo 'LIST:[0]:[1]="${LIST:[0]:[1]}"'
+	@echo 'LIST:[*]:[1]="${LIST:[*]:[1]}"'
+	@echo 'LIST:[@]:[1]="${LIST:[@]:[1]}"'
+	@echo 'LIST:[0]:[2]="${LIST:[0]:[2]}"'
+	@echo 'LIST:[*]:[2]="${LIST:[*]:[2]}"'
+	@echo 'LIST:[@]:[2]="${LIST:[@]:[2]}"'
+	@echo 'LIST:[*]:C/ /,/:[2]="${LIST:[*]:C/ /,/:[2]}"'
+	@echo 'LIST:[*]:C/ /,/:[*]:[2]="${LIST:[*]:C/ /,/:[*]:[2]}"'
+	@echo 'LIST:[*]:C/ /,/:[@]:[2]="${LIST:[*]:C/ /,/:[@]:[2]}"'
+	@echo 'LONGLIST:[012..0x12]="${LONGLIST:[012..0x12]}"'
+
+mod-squarebrackets-start-end:
+	@echo 'LIST:[1.]="${LIST:[1.]}" is an error'
+	@echo 'LIST:[1..]="${LIST:[1..]}" is an error'
+	@echo 'LIST:[1.. ]="${LIST:[1.. ]}" is an error'
+	@echo 'LIST:[1..1]="${LIST:[1..1]}"'
+	@echo 'LIST:[1..1.]="${LIST:[1..1.]}" is an error'
+	@echo 'LIST:[1..2]="${LIST:[1..2]}"'
+	@echo 'LIST:[2..1]="${LIST:[2..1]}"'
+	@echo 'LIST:[3..-2]="${LIST:[3..-2]}"'
+	@echo 'LIST:[-4..4]="${LIST:[-4..4]}"'
+	@echo 'LIST:[0..1]="${LIST:[0..1]}" is an error'
+	@echo 'LIST:[-1..0]="${LIST:[-1..0]}" is an error'
+	@echo 'LIST:[-1..1]="${LIST:[-1..1]}"'
+	@echo 'LIST:[0..0]="${LIST:[0..0]}"'
+	@echo 'LIST:[3..99]="${LIST:[3..99]}"'
+	@echo 'LIST:[-3..-99]="${LIST:[-3..-99]}"'
+	@echo 'LIST:[-99..-3]="${LIST:[-99..-3]}"'
+
+mod-squarebrackets-nested:
+	@echo 'HASH="${HASH}" == "#" ?'
+	@echo 'LIST:[$${HASH}]="${LIST:[${HASH}]}"'
+	@echo 'LIST:[$${ZERO}]="${LIST:[${ZERO}]}"'
+	@echo 'LIST:[$${ZERO}x$${ONE}]="${LIST:[${ZERO}x${ONE}]}"'
+	@echo 'LIST:[$${ONE}]="${LIST:[${ONE}]}"'
+	@echo 'LIST:[$${MINUSONE}]="${LIST:[${MINUSONE}]}"'
+	@echo 'LIST:[$${STAR}]="${LIST:[${STAR}]}"'
+	@echo 'LIST:[$${AT}]="${LIST:[${AT}]}"'
+	@echo 'LIST:[$${EMPTY}]="${LIST:[${EMPTY}]}" is an error'
+	@echo 'LIST:[$${LONGLIST:[21]:S/2//}]="${LIST:[${LONGLIST:[21]:S/2//}]}"'
+	@echo 'LIST:[$${LIST:[#]}]="${LIST:[${LIST:[#]}]}"'
+	@echo 'LIST:[$${LIST:[$${HASH}]}]="${LIST:[${LIST:[${HASH}]}]}"'
+
+mod-squarebrackets-space:
+	# As of 2020-11-01, it is possible to have spaces before the numbers
+	# but not after them.  This is an unintended side-effect of using
+	# strtol for parsing the numbers.
+	@echo 'LIST:[  -1..   +3]="${LIST:[  -1..   +3]}"'
+
+mod-C-W:
+	@echo 'LIST:C/ /,/="${LIST:C/ /,/}"'
+	@echo 'LIST:C/ /,/W="${LIST:C/ /,/W}"'
+	@echo 'LIST:C/ /,/gW="${LIST:C/ /,/gW}"'
+	@echo 'EMPTY:C/^/,/="${EMPTY:C/^/,/}"'
+	@echo 'EMPTY:C/^/,/W="${EMPTY:C/^/,/W}"'
+
+mod-S-W:
+	@echo 'LIST:S/ /,/="${LIST:S/ /,/}"'
+	@echo 'LIST:S/ /,/W="${LIST:S/ /,/W}"'
+	@echo 'LIST:S/ /,/gW="${LIST:S/ /,/gW}"'
+	@echo 'EMPTY:S/^/,/="${EMPTY:S/^/,/}"'
+	@echo 'EMPTY:S/^/,/W="${EMPTY:S/^/,/W}"'
 
-all:
-	@:;
+mod-tW-tw:
+	@echo 'LIST:tW="${LIST:tW}"'
+	@echo 'LIST:tw="${LIST:tw}"'
+	@echo 'LIST:tW:C/ /,/="${LIST:tW:C/ /,/}"'
+	@echo 'LIST:tW:C/ /,/g="${LIST:tW:C/ /,/g}"'
+	@echo 'LIST:tW:C/ /,/1g="${LIST:tW:C/ /,/1g}"'
+	@echo 'LIST:tw:C/ /,/="${LIST:tw:C/ /,/}"'
+	@echo 'LIST:tw:C/ /,/g="${LIST:tw:C/ /,/g}"'
+	@echo 'LIST:tw:C/ /,/1g="${LIST:tw:C/ /,/1g}"'
+	@echo 'LIST:tw:tW:C/ /,/="${LIST:tw:tW:C/ /,/}"'
+	@echo 'LIST:tW:tw:C/ /,/="${LIST:tW:tw:C/ /,/}"'

Reply via email to