writers/test: Refactor

It now also checks the executable bit.

+2 -8
+2 -8
pkgs/build-support/writers/test.nix
··· 7 , python3Packages 8 , pypy3Packages 9 , runCommand 10 , writers 11 , writeText 12 }: ··· 36 let 37 expectedFile = writeText "${file.name}-expected" expected; 38 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 - ''; 47 in 48 lib.recurseIntoAttrs { 49 bin = lib.recurseIntoAttrs {
··· 7 , python3Packages 8 , pypy3Packages 9 , runCommand 10 + , testers 11 , writers 12 , writeText 13 }: ··· 37 let 38 expectedFile = writeText "${file.name}-expected" expected; 39 in 40 + testers.testEqualContents { expected = expectedFile; actual = file; assertion = "${file.name} matches"; }; 41 in 42 lib.recurseIntoAttrs { 43 bin = lib.recurseIntoAttrs {