add tests to cover lset and requireTo aliases
This commit is contained in:
parent
b447430d99
commit
da13688260
1 changed files with 8 additions and 0 deletions
|
@ -178,6 +178,10 @@ with nix2lua; pkgs.lib.runTests {
|
||||||
expr = toLua (local (set "parser_config.d2" { }));
|
expr = toLua (local (set "parser_config.d2" { }));
|
||||||
expected = "local parser_config.d2 = { }";
|
expected = "local parser_config.d2 = { }";
|
||||||
};
|
};
|
||||||
|
"test returns a short variant of setting a value to the local variable" = {
|
||||||
|
expr = toLua (lset "parser_config.d2" { });
|
||||||
|
expected = "local parser_config.d2 = { }";
|
||||||
|
};
|
||||||
"test returns all operations" = {
|
"test returns all operations" = {
|
||||||
expr = toLua (spaceBetween [
|
expr = toLua (spaceBetween [
|
||||||
(set "a" (eq (mul (add 1 2) (sub 2 1)) 3))
|
(set "a" (eq (mul (add 1 2) (sub 2 1)) 3))
|
||||||
|
@ -235,4 +239,8 @@ with nix2lua; pkgs.lib.runTests {
|
||||||
expr = toLua (ifelse (eq 10 10) return_void (return 10));
|
expr = toLua (ifelse (eq 10 10) return_void (return 10));
|
||||||
expected = ''if (10 == 10) then return else return 10 end'';
|
expected = ''if (10 == 10) then return else return 10 end'';
|
||||||
};
|
};
|
||||||
|
"test returns a definition of a variable with require function" = {
|
||||||
|
expr = toLua (requireTo "ls" "luasnip");
|
||||||
|
expected = ''local ls = require("luasnip")'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue