mirror of
https://codeberg.org/icewind/flakelight-php.git
synced 2026-06-03 18:04:10 +02:00
initial version
This commit is contained in:
commit
1eceb2ce73
8 changed files with 428 additions and 0 deletions
27
nix-tests.nix
Normal file
27
nix-tests.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
pkgs: tests: let
|
||||
formatValue = val:
|
||||
if (builtins.isList val || builtins.isAttrs val)
|
||||
then builtins.toJSON val
|
||||
else builtins.toString val;
|
||||
resultToString = {
|
||||
name,
|
||||
expected,
|
||||
result,
|
||||
}: ''
|
||||
${name} failed: expected ${formatValue expected}, but got ${
|
||||
formatValue result
|
||||
}
|
||||
'';
|
||||
results = pkgs.lib.runTests (tests pkgs);
|
||||
in
|
||||
if results != []
|
||||
then builtins.throw (builtins.concatStringsSep "\n" (map resultToString results))
|
||||
## TODO: The derivation below is preferable but "nix flake check" hangs with it:
|
||||
## (it's preferable because "examples/many-failures" would then show all errors.)
|
||||
# pkgs.runCommand "nix-flake-tests-failure" { } ''
|
||||
# cat <<EOF
|
||||
# ${builtins.concatStringsSep "\n" (map resultToString results)}
|
||||
# EOF
|
||||
# exit 1
|
||||
# ''
|
||||
else pkgs.runCommand "nix-flake-tests-success" {} "echo > $out"
|
||||
Loading…
Add table
Add a link
Reference in a new issue