Skip to content

Commit 53a9599

Browse files
committed
lib/lua: pad table , with a space
Makes toLuaObject's output a little more readable.
1 parent 00ce71f commit 53a9599

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/to-lua.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ rec {
4343
"{ }"
4444
else
4545
"{"
46-
+ (concatStringsSep "," (
46+
+ (concatStringsSep ", " (
4747
mapAttrsToList (
4848
n: v:
4949
let
@@ -63,7 +63,7 @@ rec {
6363
))
6464
+ "}"
6565
else if builtins.isList args then
66-
"{" + concatMapStringsSep "," toLuaObject args + "}"
66+
"{" + concatMapStringsSep ", " toLuaObject args + "}"
6767
else if builtins.isString args then
6868
# This should be enough!
6969
builtins.toJSON args

tests/lib-tests.nix

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ let
5555
3
5656
];
5757
};
58-
expected = ''{foo = "bar",qux = {1,2,3}}'';
58+
expected = ''{foo = "bar", qux = {1, 2, 3}}'';
5959
};
6060

6161
testToLuaObjectRawLua = {
@@ -68,7 +68,7 @@ let
6868
"__unkeyed...." = "foo";
6969
bar = "baz";
7070
};
71-
expected = ''{"foo",bar = "baz"}'';
71+
expected = ''{"foo", bar = "baz"}'';
7272
};
7373

7474
testToLuaObjectNestedAttrs = {
@@ -81,7 +81,7 @@ let
8181
};
8282
};
8383
};
84-
expected = ''{a = {b = 1,c = 2,d = {e = 3}}}'';
84+
expected = ''{a = {b = 1, c = 2, d = {e = 3}}}'';
8585
};
8686

8787
testToLuaObjectNestedList = {
@@ -98,7 +98,7 @@ let
9898
]
9999
7
100100
];
101-
expected = "{1,2,{3,4,{5,6}},7}";
101+
expected = "{1, 2, {3, 4, {5, 6}}, 7}";
102102
};
103103

104104
testToLuaObjectNonStringPrims = {
@@ -109,7 +109,7 @@ let
109109
d = false;
110110
e = null;
111111
};
112-
expected = ''{a = 1.000000,b = 2,c = true,d = false}'';
112+
expected = ''{a = 1.000000, b = 2, c = true, d = false}'';
113113
};
114114

115115
testToLuaObjectNilPrim = {
@@ -150,7 +150,7 @@ let
150150
g = helpers.emptyTable;
151151
};
152152
};
153-
expected = ''{c = { },d = {g = { }}}'';
153+
expected = ''{c = { }, d = {g = { }}}'';
154154
};
155155

156156
testToLuaObjectQuotedKeys = {
@@ -160,7 +160,7 @@ let
160160
c = "c";
161161
d-d = "d";
162162
};
163-
expected = ''{["1_a"] = "a",_b = "b",c = "c",["d-d"] = "d"}'';
163+
expected = ''{["1_a"] = "a", _b = "b", c = "c", ["d-d"] = "d"}'';
164164
};
165165

166166
testIsLuaKeyword = {

0 commit comments

Comments
 (0)