convert string to raw in the pipe join

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-10 15:28:03 +03:00
parent 65d4a061a4
commit 6a096bf9a2
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
2 changed files with 10 additions and 1 deletions

View file

@ -59,7 +59,7 @@ let
else validationError expr "is not supported for a join type";
concat = join "";
pipe = join ".";
pipe = args: join "." (map (a: if isString a then raw a else a) args);
pipe1 = lft: rgt: pipe [ lft rgt ];
spaceBetween = join " ";

View file

@ -153,6 +153,15 @@ with nix2lua; pkgs.lib.runTests {
]);
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" = {
expr = toLua (set "parser_config.d2" { });
expected = "parser_config.d2 = { }";