mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2025-12-12 02:00:18 +01:00
chore: initial prototype
This commit is contained in:
commit
c1c19c324d
16 changed files with 1099 additions and 0 deletions
31
lib/default.nix
Normal file
31
lib/default.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{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
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue