From adc42d44162900a586e6e15c876fcc85be30d2c7 Mon Sep 17 00:00:00 2001 From: rillig Date: Sat, 29 Jan 2022 00:52:53 +0000 Subject: tests/make: extend and isolate tests for target-local variables Reusing the target var-scope-local.o for several tests made the test more difficult to understand than necessary. The test names '2' and '3' didn't convey any meaning. Instead, add more test targets that are named after what they test. Add tests for each of the 5 variable assignment operators, to demonstrate an inconsistency between '+=' and '?='. Add tests for the built-in target-local variables as well and explain the general concepts, in particular the exact point where target-local expressions are expanded. The lines in the expected output file are not generated in the same order as they appear in the makefile, so allow the 'expect' lines in non-linear order, in check-expect.lua. --- usr.bin/make/unit-tests/check-expect.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'usr.bin/make/unit-tests/check-expect.lua') diff --git a/usr.bin/make/unit-tests/check-expect.lua b/usr.bin/make/unit-tests/check-expect.lua index 2aaf31f9a6d..44c867dd321 100644 --- a/usr.bin/make/unit-tests/check-expect.lua +++ b/usr.bin/make/unit-tests/check-expect.lua @@ -1,5 +1,5 @@ #! /usr/bin/lua --- $NetBSD: check-expect.lua,v 1.1 2022/01/15 12:35:18 rillig Exp $ +-- $NetBSD: check-expect.lua,v 1.2 2022/01/29 00:52:53 rillig Exp $ --[[ @@ -82,6 +82,9 @@ local function check_mk(mk_fname) mk_fname, mk_lineno, exp_fname, prev_expect_line + 1, text) end end + if mk_line:match("^#%s*expect%-reset$") then + prev_expect_line = 0 + end ---@param text string for offset, text in mk_line:gmatch("#%s*expect([+%-]%d+):%s*(.*)") do -- cgit