From 958259c3fb8c49db32ec3fa2711c06e8dbd57102 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Fri, 1 May 2026 13:43:42 +0200 Subject: [PATCH] treefmt: use structuredAttrs instead of passAsFile in test --- pkgs/by-name/tr/treefmt/tests.nix | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/tr/treefmt/tests.nix b/pkgs/by-name/tr/treefmt/tests.nix index c13b26b67b0f..57bcfda45cd3 100644 --- a/pkgs/by-name/tr/treefmt/tests.nix +++ b/pkgs/by-name/tr/treefmt/tests.nix @@ -72,10 +72,6 @@ in runCommand "run-nixfmt-example" { nativeBuildInputs = [ nixfmtExamplePackage ]; - passAsFile = [ - "input" - "expected" - ]; input = '' { foo="bar"; @@ -90,18 +86,19 @@ in list = [ ]; } ''; + __structuredAttrs = true; } '' export XDG_CACHE_HOME=$(mktemp -d) # The example config assumes the tree root has a .git/index file mkdir .git && touch .git/index - # Copy the input file, then format it using the wrapped treefmt - cp $inputPath input.nix + # Create the input file, then format it using the wrapped treefmt + printf "%s" "$input" > input.nix treefmt # Assert that input.nix now matches expected - if diff -u $expectedPath input.nix; then + if diff -u <(printf "%s" "$expected") input.nix; then touch $out else echo