sloth-flake.nvim/tests/default.nix

33 lines
856 B
Nix

{
perSystem = {pkgs, ...}: let
lua = import ../lib/lua.nix {inherit pkgs;};
diffFiles = actual: expected:
pkgs.runCommandWith {
name = "diffFiles";
derivationArgs.nativeBuildInputs = [pkgs.diffutils];
}
''
diff -u ${expected} ${actual}
echo "Comparaison successful."
touch $out
'';
in {
checks.luaRender =
diffFiles ./luaRender.lua
<| lua.writeLua "debug.lua" {
a.b.c = 42;
list = [42 4.2 true false null];
fn = lua.lambda [] <| lua.raw "print('hello world')";
math.succ = lua.function "" ["n"] <| lua.return <| lua.raw "n + 1";
non-var-name = 42;
multilineFunc =
lua.function "" []
<| lua.raw ''
print("hello world")
print("goodbye world")
'';
};
};
}