Merge pull request #264860 from tweag/filesystem-error-test

lib.filesystem: Don't test Nix-specific error messages

authored by Eelco Dolstra and committed by GitHub 9ec80ed6 c4b91d02

+8 -2
+8 -2
lib/tests/filesystem.sh
··· 64 64 expectSuccess "pathType $PWD/regular" '"regular"' 65 65 expectSuccess "pathType $PWD/symlink" '"symlink"' 66 66 expectSuccess "pathType $PWD/fifo" '"unknown"' 67 - # Different errors depending on whether the builtins.readFilePath primop is available or not 68 - expectFailure "pathType $PWD/non-existent" "error: (evaluation aborted with the following error message: 'lib.filesystem.pathType: Path $PWD/non-existent does not exist.'|getting status of '$PWD/non-existent': No such file or directory)" 67 + 68 + # Only check error message when a Nixpkgs-specified error is thrown, 69 + # which is only the case when `readFileType` is not available 70 + # and the fallback implementation needs to be used. 71 + if [[ "$(nix-instantiate --eval --expr 'builtins ? readFileType')" == false ]]; then 72 + expectFailure "pathType $PWD/non-existent" \ 73 + "error: evaluation aborted with the following error message: 'lib.filesystem.pathType: Path $PWD/non-existent does not exist.'" 74 + fi 69 75 70 76 expectSuccess "pathIsDirectory /." "true" 71 77 expectSuccess "pathIsDirectory $PWD/directory" "true"