feat: switch from flake-parts & devenv to rensa + add nixtest

This commit is contained in:
technofab 2025-12-18 13:32:38 +01:00
parent 6af83809f7
commit 012a3afb2d
Signed by: technofab
SSH key fingerprint: SHA256:bV4h88OqS/AxjbPn66uUdvK9JsgIW4tv3vwJQ8tpMqQ
18 changed files with 553 additions and 611 deletions

47
tests/lib_test.nix Normal file
View file

@ -0,0 +1,47 @@
{
pkgs,
ntlib,
nixlet-lib,
...
}: {
suites."Lib Tests" = {
pos = __curPos;
tests = let
nixlet = nixlet-lib.mkNixlet ./fixtures/example;
in [
{
name = "mkNixlet fail on nonexistant nixlet.nix";
expected = {
success = false;
value = false;
};
actual = builtins.tryEval (nixlet-lib.mkNixlet "/nonexistant").name;
}
{
name = "mkNixlet success";
expected = {
name = "example";
version = "0.0.1";
description = "hello world";
};
actual = {inherit (nixlet) name description version;};
}
{
name = "Nixlet mkDocs";
type = "script";
script = let
docs = nixlet.mkDocs {};
in
# sh
''
${ntlib.helpers.path [pkgs.gnugrep]}
${ntlib.helpers.scriptHelpers}
assert "-f ${docs}" "generated the file"
assert_file_contains "${docs}" '`example`'
assert_file_contains "${docs}" "Some description."
assert_file_contains "${docs}" '"Hello world!"'
'';
}
];
};
}