mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-16 12:14:32 +02:00
treewide: Reformat with nixfmt
This commit is contained in:
parent
c6281260dc
commit
62f32bfc71
459 changed files with 28139 additions and 26377 deletions
|
@ -4,20 +4,23 @@
|
|||
lib,
|
||||
pkgs,
|
||||
helpers,
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
results = pkgs.lib.runTests {
|
||||
testToLuaObject = {
|
||||
expr = helpers.toLuaObject {
|
||||
foo = "bar";
|
||||
qux = [1 2 3];
|
||||
qux = [
|
||||
1
|
||||
2
|
||||
3
|
||||
];
|
||||
};
|
||||
expected = ''{["foo"] = "bar",["qux"] = {1,2,3}}'';
|
||||
};
|
||||
|
||||
testToLuaObjectRawLua = {
|
||||
expr = helpers.toLuaObject {
|
||||
__raw = "<lua code>";
|
||||
};
|
||||
expr = helpers.toLuaObject { __raw = "<lua code>"; };
|
||||
expected = "<lua code>";
|
||||
};
|
||||
|
||||
|
@ -34,14 +37,28 @@
|
|||
a = {
|
||||
b = 1;
|
||||
c = 2;
|
||||
d = {e = 3;};
|
||||
d = {
|
||||
e = 3;
|
||||
};
|
||||
};
|
||||
};
|
||||
expected = ''{["a"] = {["b"] = 1,["c"] = 2,["d"] = {["e"] = 3}}}'';
|
||||
};
|
||||
|
||||
testToLuaObjectNestedList = {
|
||||
expr = helpers.toLuaObject [1 2 [3 4 [5 6]] 7];
|
||||
expr = helpers.toLuaObject [
|
||||
1
|
||||
2
|
||||
[
|
||||
3
|
||||
4
|
||||
[
|
||||
5
|
||||
6
|
||||
]
|
||||
]
|
||||
7
|
||||
];
|
||||
expected = "{1,2,{3,4,{5,6}},7}";
|
||||
};
|
||||
|
||||
|
@ -71,11 +88,11 @@
|
|||
testToLuaObjectFilters = {
|
||||
expr = helpers.toLuaObject {
|
||||
a = null;
|
||||
b = {};
|
||||
c = [];
|
||||
b = { };
|
||||
c = [ ];
|
||||
d = {
|
||||
e = null;
|
||||
f = {};
|
||||
f = { };
|
||||
};
|
||||
};
|
||||
expected = ''{}'';
|
||||
|
@ -84,11 +101,13 @@
|
|||
testToLuaObjectEmptyTable = {
|
||||
expr = helpers.toLuaObject {
|
||||
a = null;
|
||||
b = {};
|
||||
c = {__empty = null;};
|
||||
b = { };
|
||||
c = {
|
||||
__empty = null;
|
||||
};
|
||||
d = {
|
||||
e = null;
|
||||
f = {};
|
||||
f = { };
|
||||
g = helpers.emptyTable;
|
||||
};
|
||||
};
|
||||
|
@ -96,19 +115,20 @@
|
|||
};
|
||||
};
|
||||
in
|
||||
if results == []
|
||||
then pkgs.runCommand "lib-tests-success" {} "touch $out"
|
||||
else
|
||||
pkgs.runCommand "lib-tests-failure" {
|
||||
if results == [ ] then
|
||||
pkgs.runCommand "lib-tests-success" { } "touch $out"
|
||||
else
|
||||
pkgs.runCommand "lib-tests-failure"
|
||||
{
|
||||
results = pkgs.lib.concatStringsSep "\n" (
|
||||
builtins.map (result: ''
|
||||
${result.name}:
|
||||
expected: ${result.expected}
|
||||
result: ${result.result}
|
||||
'')
|
||||
results
|
||||
'') results
|
||||
);
|
||||
} ''
|
||||
}
|
||||
''
|
||||
echo -e "Tests failed:\\n\\n$results" >&2
|
||||
exit 1
|
||||
''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue