diff --git a/DIAGNOSTIC_TESTS.yaml b/DIAGNOSTIC_TESTS.yaml index c7f71e3..21188d6 100644 --- a/DIAGNOSTIC_TESTS.yaml +++ b/DIAGNOSTIC_TESTS.yaml @@ -363,7 +363,7 @@ input: "{{> footer }}" should: warn expected: | first -3 is equivalent to last 3 - --> /home/spencer/github.com/sbrow.github.io/thor/mustache/fixtures/layouts/partials/footer.html:11:78 + --> fixtures/layouts/partials/footer.html:11:78 | 9 | href="https://edwardtufte.github.io/tufte-css/">Tufte CSS 10 |

diff --git a/flake.nix b/flake.nix index f90ade1..b4072e1 100644 --- a/flake.nix +++ b/flake.nix @@ -162,6 +162,7 @@ # IDE unstable.helix + claude-code typescript-language-server vscode-langservers-extracted ]); diff --git a/mustache/diagnostic_test.odin b/mustache/diagnostic_test.odin index 6aa15ca..c3920c4 100644 --- a/mustache/diagnostic_test.odin +++ b/mustache/diagnostic_test.odin @@ -513,7 +513,18 @@ diag_ctx :: proc() -> Diag_Context { diag_partials :: proc() -> map[string]Template { dirs := [?]string{#directory, "fixtures/layouts/partials"} partials_dir, _ := filepath.join(dirs[:], context.temp_allocator) - return load_partials(partials_dir, allocator = context.temp_allocator) + partials := load_partials(partials_dir, allocator = context.temp_allocator) + // #directory expands to an absolute, build-environment-specific path (e.g. + // /build/... inside the nix sandbox vs a local checkout). Strip it so + // partial diagnostics reference a stable path across environments, keeping + // the golden expected output deterministic. + for key, tmpl in partials { + t := tmpl + rel := strings.trim_prefix(t.path, #directory) + t.path = strings.trim_left(rel, "/") + partials[key] = t + } + return partials } diag_slug :: proc(name: string) -> string {