treewide: Reformat with nixfmt

This commit is contained in:
traxys 2024-05-05 19:39:35 +02:00
parent c6281260dc
commit 62f32bfc71
459 changed files with 28139 additions and 26377 deletions

View file

@ -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
''