From 67a7bd0b03b555ecd94818a36ee06b5a3a10572b Mon Sep 17 00:00:00 2001 From: nmccready Date: Mon, 13 Apr 2026 13:50:46 -0400 Subject: [PATCH] test: add fixtures for dynamic Fn::Include filename via env var Covers the FILE_NAME=two cfn-include --enable eval,env one.json flow where one.json includes ./$FILE_NAME.json and resolves to a sibling two.json. Adds a CLI-level case in t/tests/cli.json and an API-level case in t/tests/location.json using inject + doEnv. Co-Authored-By: Claude Opus 4.6 (1M context) --- t/includes/one.json | 3 +++ t/includes/two.json | 3 +++ t/tests/cli.json | 11 +++++++++++ t/tests/location.json | 11 +++++++++++ 4 files changed, 28 insertions(+) create mode 100644 t/includes/one.json create mode 100644 t/includes/two.json diff --git a/t/includes/one.json b/t/includes/one.json new file mode 100644 index 0000000..955c956 --- /dev/null +++ b/t/includes/one.json @@ -0,0 +1,3 @@ +{ + "Fn::Include": "./$FILE_NAME.json" +} diff --git a/t/includes/two.json b/t/includes/two.json new file mode 100644 index 0000000..c8c4105 --- /dev/null +++ b/t/includes/two.json @@ -0,0 +1,3 @@ +{ + "foo": "bar" +} diff --git a/t/tests/cli.json b/t/tests/cli.json index 43f5040..a076aa6 100644 --- a/t/tests/cli.json +++ b/t/tests/cli.json @@ -116,6 +116,17 @@ "exitCode": 1, "errorMessage": "missed comma" }, + { + "name": "dynamic filename via env var", + "template": "t/includes/one.json", + "args": ["--enable", "eval,env"], + "env": { + "FILE_NAME": "two" + }, + "output": { + "foo": "bar" + } + }, { "name": "ifEval", "env": { diff --git a/t/tests/location.json b/t/tests/location.json index 40abeea..3b6cf47 100644 --- a/t/tests/location.json +++ b/t/tests/location.json @@ -129,6 +129,17 @@ "Mappings": null } }, + { + "name": "dynamic filename via env var ($FILE_NAME)", + "doEnv": true, + "inject": { "FILE_NAME": "two" }, + "template": { + "Fn::Include": "includes/one.json" + }, + "output": { + "foo": "bar" + } + }, { "name": "deep nested w/ query dev", "doEnv": true,