writers/test: Refactor

It now also checks the executable bit.

+2 -8
+2 -8
pkgs/build-support/writers/test.nix
··· 7 7 , python3Packages 8 8 , pypy3Packages 9 9 , runCommand 10 + , testers 10 11 , writers 11 12 , writeText 12 13 }: ··· 36 37 let 37 38 expectedFile = writeText "${file.name}-expected" expected; 38 39 in 39 - runCommand "run-${file.name}" {} '' 40 - if ! diff -u ${file} ${expectedFile}; then 41 - echo 'test ${file.name} failed' 42 - exit 1 43 - fi 44 - 45 - touch $out 46 - ''; 40 + testers.testEqualContents { expected = expectedFile; actual = file; assertion = "${file.name} matches"; }; 47 41 in 48 42 lib.recurseIntoAttrs { 49 43 bin = lib.recurseIntoAttrs {