mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2025-12-12 02:00:18 +01:00
31 lines
684 B
Nix
31 lines
684 B
Nix
{pkgs, ...}: {
|
|
mkTest = {
|
|
type ? "unit",
|
|
name,
|
|
description ? "",
|
|
expected ? null,
|
|
actual ? null,
|
|
actualDrv ? null,
|
|
pos ? null,
|
|
}: {
|
|
inherit type name description expected actual;
|
|
actualDrv = actualDrv.drvPath or "";
|
|
pos =
|
|
if pos == null
|
|
then ""
|
|
else "${pos.file}:${toString pos.line}:${toString pos.column}";
|
|
};
|
|
mkSuite = name: tests: {
|
|
inherit name tests;
|
|
};
|
|
exportSuites = suites: let
|
|
suitesList =
|
|
if builtins.isList suites
|
|
then suites
|
|
else [suites];
|
|
testsMapped = builtins.toJSON suitesList;
|
|
in
|
|
pkgs.runCommand "tests.json" {} ''
|
|
echo '${testsMapped}' > $out
|
|
'';
|
|
}
|