1
0
Fork 0
mirror of https://github.com/numtide/flake-utils.git synced 2024-12-14 11:47:31 +00:00

check-utils: use the same success derivation (#75)

A successful check doesn't need reporting, so we use the same derivation
to reduce building jobs.
This commit is contained in:
oxalica 2022-07-04 18:00:14 +08:00 committed by GitHub
parent bee6a7250d
commit 7e2a3b3dfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,16 +34,18 @@ let
builder = "/bin/sh"; builder = "/bin/sh";
args = [ "-c" command ]; args = [ "-c" command ];
}; };
success = test "SUCCESS" "echo success > $out";
in in
{ {
isEqual = a: b: isEqual = a: b:
if a == b if a == b
then test "SUCCESS__${str a}__IS_EQUAL__${str b}" "echo success > $out" then success
else test "FAILURE__${str a}__NOT_EQUAL__${str b}" "exit 1"; else test "FAILURE__${str a}__NOT_EQUAL__${str b}" "exit 1";
hasKey = attrset: key: hasKey = attrset: key:
if attrset ? ${str key} if attrset ? ${str key}
then test "SUCCESS__${str key}__EXISTS_IN_ATTRSET" "echo success > $out" then success
else test "FAILURE__${str key}__DOES_NOT_EXISTS_IN_ATTRSET_SIZE_${str(length (attrNames attrset))}" "exit 1"; else test "FAILURE__${str key}__DOES_NOT_EXISTS_IN_ATTRSET_SIZE_${str(length (attrNames attrset))}" "exit 1";
} }