convert string to raw in the pipe join
This commit is contained in:
parent
65d4a061a4
commit
6a096bf9a2
2 changed files with 10 additions and 1 deletions
2
lib.nix
2
lib.nix
|
@ -59,7 +59,7 @@ let
|
||||||
else validationError expr "is not supported for a join type";
|
else validationError expr "is not supported for a join type";
|
||||||
|
|
||||||
concat = join "";
|
concat = join "";
|
||||||
pipe = join ".";
|
pipe = args: join "." (map (a: if isString a then raw a else a) args);
|
||||||
pipe1 = lft: rgt: pipe [ lft rgt ];
|
pipe1 = lft: rgt: pipe [ lft rgt ];
|
||||||
spaceBetween = join " ";
|
spaceBetween = join " ";
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,15 @@ with nix2lua; pkgs.lib.runTests {
|
||||||
]);
|
]);
|
||||||
expected = "require(\"nvim-treesitter.parsers\").get_parser_configs()";
|
expected = "require(\"nvim-treesitter.parsers\").get_parser_configs()";
|
||||||
};
|
};
|
||||||
|
"test returns a pipe that convert string to var" = {
|
||||||
|
expr = toLua (pipe [
|
||||||
|
(require "nvim-tree.api")
|
||||||
|
"config"
|
||||||
|
"mappings"
|
||||||
|
(call "default_on_attach" (var "bufnr"))
|
||||||
|
]);
|
||||||
|
expected = "require(\"nvim-tree.api\").config.mappings.default_on_attach(bufnr)";
|
||||||
|
};
|
||||||
"test returns lua with setting value to the variable" = {
|
"test returns lua with setting value to the variable" = {
|
||||||
expr = toLua (set "parser_config.d2" { });
|
expr = toLua (set "parser_config.d2" { });
|
||||||
expected = "parser_config.d2 = { }";
|
expected = "parser_config.d2 = { }";
|
||||||
|
|
Loading…
Reference in a new issue