From 46156529f2682412b8867f7bc40b32b350a00bd9 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 4 Apr 2022 14:08:21 +0200 Subject: [PATCH] tests.pkgs-lib.formats: Allow strings with context in test runner --- pkgs/pkgs-lib/tests/formats.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/pkgs-lib/tests/formats.nix b/pkgs/pkgs-lib/tests/formats.nix index 99b88d36ec3c..25327acfe7a4 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