Skip to content

Commit 9a11664

Browse files
joewizclaude
andcommitted
[test] binary-nested-in-map: move fixture creation into %test:setUp
Per review feedback on PR #6507: the fixture setup (create the test directory and write the .env fixture) now lives in a %test:setUp function, symmetric with the existing %test:tearDown, instead of inline in the test body. helper:get-test-directory embeds a fresh uuid on every call, so the directory is computed once in a module variable ($bnm:directory) shared by setUp and the test, rather than recomputed per function (which would land the fixture and the read in different directories). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent be7e255 commit 9a11664

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

extensions/modules/file/src/test/xquery/modules/file/binary-nested-in-map.xqm

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ declare namespace test="http://exist-db.org/xquery/xqsuite";
4141

4242
declare variable $bnm:suite := "binary-nested-in-map";
4343

44+
(: One directory per run, shared by setUp and the test (helper:get-test-directory embeds a fresh uuid
45+
: on each call, so it must be computed once here rather than recomputed in each function). :)
46+
declare variable $bnm:directory := helper:get-test-directory($bnm:suite);
47+
48+
declare
49+
%test:setUp
50+
function bnm:set-up() as empty-sequence() {
51+
let $_ := helper:setup-fs-extra($bnm:directory)
52+
return ()
53+
};
54+
4455
declare
4556
%test:tearDown
4657
function bnm:tear-down() as empty-sequence() {
@@ -61,7 +72,5 @@ function bnm:make-nested($path as xs:string) {
6172
declare
6273
%test:assertEquals("SERVER_SECRET=123!")
6374
function bnm:binary-nested-in-map-survives-function-return() {
64-
let $directory := helper:get-test-directory($bnm:suite)
65-
let $_ := helper:setup-fs-extra($directory)
66-
return util:binary-to-string(bnm:make-nested(concat($directory, "/.env"))[1]?data)
75+
util:binary-to-string(bnm:make-nested(concat($bnm:directory, "/.env"))[1]?data)
6776
};

0 commit comments

Comments
 (0)