From b63136687006c38e1cc5ea9c57a9466379eea9f1 Mon Sep 17 00:00:00 2001 From: Ivan Trubach Date: Thu, 18 Jul 2024 16:28:33 +0300 Subject: [PATCH] test.testers: add failing tests for testers.testEqualContents This change adds tests for tests.testEqualContents to demonstrate that the current implementation is failing in some cases. --- pkgs/build-support/testers/test/default.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/testers/test/default.nix b/pkgs/build-support/testers/test/default.nix index a815fe63e416..ae7bbe810fa9 100644 --- a/pkgs/build-support/testers/test/default.nix +++ b/pkgs/build-support/testers/test/default.nix @@ -99,19 +99,35 @@ lib.recurseIntoAttrs { }; testEqualContents = lib.recurseIntoAttrs { - happy = testers.testEqualContents { + equalDir = testers.testEqualContents { assertion = "The same directory contents at different paths are recognized as equal"; expected = runCommand "expected" {} '' mkdir -p $out/c echo a >$out/a echo b >$out/b echo d >$out/c/d + echo e >$out/e + chmod a+x $out/e ''; actual = runCommand "actual" {} '' mkdir -p $out/c echo a >$out/a echo b >$out/b echo d >$out/c/d + echo e >$out/e + chmod a+x $out/e + ''; + }; + + equalExe = testers.testEqualContents { + assertion = "The same executable file contents at different paths are recognized as equal"; + expected = runCommand "expected" { } '' + echo test >$out + chmod a+x $out + ''; + actual = runCommand "actual" { } '' + echo test >$out + chmod a+x $out ''; };