Module Name: src Committed By: rillig Date: Wed Dec 20 09:46:00 UTC 2023
Modified Files: src/usr.bin/make/unit-tests: vardebug.exp vardebug.mk Log Message: tests/make: add the expected output to the test for variable debugging To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/vardebug.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/vardebug.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/unit-tests/vardebug.exp diff -u src/usr.bin/make/unit-tests/vardebug.exp:1.33 src/usr.bin/make/unit-tests/vardebug.exp:1.34 --- src/usr.bin/make/unit-tests/vardebug.exp:1.33 Wed Dec 20 09:03:09 2023 +++ src/usr.bin/make/unit-tests/vardebug.exp Wed Dec 20 09:46:00 2023 @@ -54,11 +54,11 @@ Var_Parse: ${:Uvariable:unknown} (eval-d Evaluating modifier ${:U...} on value "" (eval-defined, undefined) Result of ${:Uvariable} is "variable" (eval-defined, defined) Evaluating modifier ${:u...} on value "variable" (eval-defined, defined) -make: "vardebug.mk" line 46: Unknown modifier "unknown" +make: "vardebug.mk" line 63: Unknown modifier "unknown" Result of ${:unknown} is error (eval-defined, defined) -make: "vardebug.mk" line 46: Malformed conditional (${:Uvariable:unknown}) +make: "vardebug.mk" line 63: Malformed conditional (${:Uvariable:unknown}) Var_Parse: ${UNDEFINED} (eval-defined) -make: "vardebug.mk" line 56: Malformed conditional (${UNDEFINED}) +make: "vardebug.mk" line 73: Malformed conditional (${UNDEFINED}) Global: ignoring delete '.SHELL' as it is not found Command: .SHELL = </path/to/shell> Command: ignoring '.SHELL = overwritten' as it is read-only Index: src/usr.bin/make/unit-tests/vardebug.mk diff -u src/usr.bin/make/unit-tests/vardebug.mk:1.8 src/usr.bin/make/unit-tests/vardebug.mk:1.9 --- src/usr.bin/make/unit-tests/vardebug.mk:1.8 Thu Jun 1 20:56:35 2023 +++ src/usr.bin/make/unit-tests/vardebug.mk Wed Dec 20 09:46:00 2023 @@ -1,32 +1,46 @@ -# $NetBSD: vardebug.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ +# $NetBSD: vardebug.mk,v 1.9 2023/12/20 09:46:00 rillig Exp $ # # Demonstrates the debugging output for var.c. .MAKEFLAGS: -dv FROM_CMDLINE= +# expect: Global: VAR = added VAR= added # VarAdd +# expect: Global: VAR = overwritten VAR= overwritten # Var_Set -.undef VAR # Var_Delete (found) -.undef VAR # Var_Delete (not found) +# expect: Global: delete VAR +.undef VAR +# expect: Global: ignoring delete 'VAR' as it is not found +.undef VAR # The variable with the empty name cannot be set at all. +# expect: Global: ignoring ' = empty name' as the variable name '${:U}' expands to empty ${:U}= empty name # Var_Set +# expect: Global: ignoring ' += empty name' as the variable name '${:U}' expands to empty ${:U}+= empty name # Var_Append FROM_CMDLINE= overwritten # Var_Set (ignored) +# expect: Global: VAR = 1 VAR= 1 +# expect: Global: VAR = 1 2 VAR+= 2 +# expect: Global: VAR = 1 2 3 VAR+= 3 +# expect: Pattern for ':M' is "[2]" +# expect: Result of ${VAR:M[2]} is "2" .if ${VAR:M[2]} # ModifyWord_Match .endif -.if ${VAR:N[2]} # ModifyWord_NoMatch (no debug output) +# expect: Pattern for ':N' is "[2]" +# expect: Result of ${VAR:N[2]} is "1 3" +.if ${VAR:N[2]} # ModifyWord_NoMatch .endif .if ${VAR:S,2,two,} # ParseModifierPart .endif +# expect: Result of ${VAR:Q} is "1\ 2\ 3" .if ${VAR:Q} # VarQuote .endif @@ -34,13 +48,16 @@ VAR+= 3 .endif # ApplyModifiers, "Got ..." +# expect: Result of ${:Mvalu[e]} is "value" (eval-defined, defined) .if ${:Uvalue:${:UM*e}:Mvalu[e]} .endif +# expect: Global: delete VAR .undef ${:UVAR} # Var_Delete # When ApplyModifiers results in an error, this appears in the debug log # as "is error", without surrounding quotes. +# expect: Result of ${:unknown} is error (eval-defined, defined) # expect+2: Malformed conditional (${:Uvariable:unknown}) # expect+1: Unknown modifier "unknown" .if ${:Uvariable:unknown} @@ -59,9 +76,7 @@ VAR+= 3 # By default, .SHELL is not defined and thus can be set. As soon as it is # accessed, it is initialized in the command line scope (during VarFind), # where it is set to read-only. Assigning to it is ignored. +# expect: Command: ignoring '.SHELL = overwritten' as it is read-only .MAKEFLAGS: .SHELL=overwritten .MAKEFLAGS: -d0 - -all: - @: