tests: cleanup tests to better use callTest pattern

e.g. Prefer taking `pkgs.*` attrs directly as function arguments.
This commit is contained in:
Matt Sturgeon 2024-08-28 09:48:10 +01:00
parent 4a508ceee2
commit 036e11665f
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
7 changed files with 33 additions and 20 deletions

View file

@ -1,9 +1,10 @@
# For shorter test iterations run the following in the root of the repo:
# `echo ':b checks.${builtins.currentSystem}.lib-tests' | nix repl .`
{
lib,
pkgs,
helpers,
lib,
runCommandNoCCLocal,
writeText,
}:
let
luaNames = {
@ -45,9 +46,9 @@ let
];
};
drv = pkgs.writeText "example-derivation" "hello, world!";
drv = writeText "example-derivation" "hello, world!";
results = pkgs.lib.runTests {
results = lib.runTests {
testToLuaObject = {
expr = helpers.toLuaObject {
foo = "bar";
@ -412,11 +413,11 @@ let
};
in
if results == [ ] then
pkgs.runCommand "lib-tests-success" { } "touch $out"
runCommandNoCCLocal "lib-tests-success" { } "touch $out"
else
pkgs.runCommand "lib-tests-failure"
runCommandNoCCLocal "lib-tests-failure"
{
results = pkgs.lib.concatStringsSep "\n" (
results = lib.concatStringsSep "\n" (
builtins.map (result: ''
${result.name}:
expected: ${lib.generators.toPretty { } result.expected}