mirror of
https://github.com/go-task/task.git
synced 2026-06-30 16:14:19 +00:00
test(scoped-includes): add tests for variable isolation
Tests verify: - Legacy mode: vars merged globally (A sees B's VAR, can access UNIQUE_B) - Scoped mode: vars isolated (A sees own VAR, cannot access UNIQUE_B) - Inheritance: includes can still access root vars (ROOT_VAR) Test structure: - testdata/scoped_includes/ with main Taskfile and two includes - inc_a and inc_b both define VAR with different values - Cross-include test shows A trying to access B's UNIQUE_B
This commit is contained in:
18
testdata/scoped_includes/inc_a/Taskfile.yml
vendored
Normal file
18
testdata/scoped_includes/inc_a/Taskfile.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
VAR: value_from_a
|
||||
UNIQUE_A: only_in_a
|
||||
|
||||
tasks:
|
||||
print:
|
||||
desc: Print vars from include A
|
||||
cmds:
|
||||
- echo "A:VAR={{.VAR}}"
|
||||
- echo "A:UNIQUE_A={{.UNIQUE_A}}"
|
||||
- echo "A:ROOT_VAR={{.ROOT_VAR}}"
|
||||
|
||||
try-access-b:
|
||||
desc: Try to access B's unique var (should fail in scoped mode)
|
||||
cmds:
|
||||
- echo "A:UNIQUE_B={{.UNIQUE_B}}"
|
||||
Reference in New Issue
Block a user