summary refs log tree commit diff
path: root/pkgs/pkgs-lib
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-04-04 14:08:21 +0200
committerRobert Hensing <robert@roberthensing.nl>2022-04-04 14:22:22 +0200
commit46156529f2682412b8867f7bc40b32b350a00bd9 (patch)
treeebdc8d2d13dd26a796d330f56111114ab58170b0 /pkgs/pkgs-lib
parent08660ae7c55df02744bd1c0c2d26c3ec666ccba8 (diff)
tests.pkgs-lib.formats: Allow strings with context in test runner
Diffstat (limited to 'pkgs/pkgs-lib')
-rw-r--r--pkgs/pkgs-lib/tests/formats.nix7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkgs/pkgs-lib/tests/formats.nix b/pkgs/pkgs-lib/tests/formats.nix
index 99b88d36ec3c3..25327acfe7a4b 100644
--- a/pkgs/pkgs-lib/tests/formats.nix
+++ b/pkgs/pkgs-lib/tests/formats.nix
@@ -18,8 +18,11 @@ let
       }) [ def ]);
     in formatSet.generate "test-format-file" config;
 
-  runBuildTest = name: { drv, expected }: pkgs.runCommand name {} ''
-    if diff -u '${builtins.toFile "expected" expected}' '${drv}'; then
+  runBuildTest = name: { drv, expected }: pkgs.runCommand name {
+    passAsFile = ["expected"];
+    inherit expected drv;
+  } ''
+    if diff -u "$expectedPath" "$drv"; then
       touch "$out"
     else
       echo