mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-23 20:25:08 +02:00
lib/utils: add nestedLiteral
and nestedLiteralLua
`nestedLiteral` converts a `literalExpression` into a `toPretty` style pretty-printer. `nestedLiteralLua` composes `nestedLiteral` and `literalLua` together.
This commit is contained in:
parent
eb76e62a9b
commit
da6e3499d4
3 changed files with 88 additions and 0 deletions
|
@ -331,6 +331,34 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
# Integration test for nestedLiteral and renderOptionValue
|
||||
testNestedLiteral_withRenderOptionValue = {
|
||||
expr =
|
||||
builtins.mapAttrs
|
||||
(
|
||||
_: v:
|
||||
(lib.options.renderOptionValue {
|
||||
literal = helpers.nestedLiteral v;
|
||||
}).text
|
||||
)
|
||||
{
|
||||
empty = "";
|
||||
sum = "1 + 1";
|
||||
print = ''lib.mkRaw "print('hi')"'';
|
||||
};
|
||||
expected =
|
||||
builtins.mapAttrs
|
||||
(_: literal: ''
|
||||
{
|
||||
literal = ${literal};
|
||||
}'')
|
||||
{
|
||||
empty = "";
|
||||
sum = "1 + 1";
|
||||
print = ''lib.mkRaw "print('hi')"'';
|
||||
};
|
||||
};
|
||||
|
||||
testUpperFirstChar = {
|
||||
expr = map helpers.upperFirstChar [
|
||||
"foo"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue