lib/utils: add mkWarnings

This commit is contained in:
Gaetan Lepage 2025-01-17 16:14:52 +01:00 committed by nix-infra-bot
parent 1036b8f8b6
commit 02e16b2a76
3 changed files with 56 additions and 0 deletions

View file

@ -490,6 +490,30 @@ let
"mkAfter list".foo.bar = lib.mkAfter "Hello!";
};
};
testMkWarnings = {
expr =
(lib.nixvim.mkWarnings "foo-bar" [
{
when = true;
message = "This is the message";
}
{
when = false;
message = "This should not be included";
}
"This is an unconditional warning"
])
++ (lib.nixvim.mkWarnings "single-element") {
when = true;
message = "Hello";
};
expected = [
"Nixvim (foo-bar): This is the message"
"Nixvim (foo-bar): This is an unconditional warning"
"Nixvim (single-element): Hello"
];
};
};
in
if results == [ ] then