···64expectSuccess "pathType $PWD/regular" '"regular"'
65expectSuccess "pathType $PWD/symlink" '"symlink"'
66expectSuccess "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)"
0000006970expectSuccess "pathIsDirectory /." "true"
71expectSuccess "pathIsDirectory $PWD/directory" "true"
···64expectSuccess "pathType $PWD/regular" '"regular"'
65expectSuccess "pathType $PWD/symlink" '"symlink"'
66expectSuccess "pathType $PWD/fifo" '"unknown"'
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
7576expectSuccess "pathIsDirectory /." "true"
77expectSuccess "pathIsDirectory $PWD/directory" "true"