summaryrefslogtreecommitdiff
path: root/usr.bin/make/unit-tests/check-expect.lua
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2022-01-29 00:52:53 +0000
committerrillig <rillig@NetBSD.org>2022-01-29 00:52:53 +0000
commitadc42d44162900a586e6e15c876fcc85be30d2c7 (patch)
treee048af18260c2bf880c4f768c65fc377e6fcaad7 /usr.bin/make/unit-tests/check-expect.lua
parentaf96a6cf7d6a707fc70490b0f35669dfeaf5a3ab (diff)
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.
Diffstat (limited to 'usr.bin/make/unit-tests/check-expect.lua')
-rw-r--r--usr.bin/make/unit-tests/check-expect.lua5
1 files changed, 4 insertions, 1 deletions
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