Skip to content

Commit d207008

Browse files
committed
failing test for json array tables
1 parent dd9391d commit d207008

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

spec/util_spec.moon

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,28 @@ tests = {
155155
'{"nothing":null}'
156156
}
157157

158+
{ -- encoding empty array with array_mt
159+
->
160+
util.to_json {
161+
items: setmetatable {}, json.array_mt
162+
}
163+
'{"items":[]}'
164+
}
165+
166+
{ -- encoding non-empty array with array_mt
167+
->
168+
util.to_json {
169+
items: setmetatable {1, 2, 3}, json.array_mt
170+
}
171+
'{"items":[1,2,3]}'
172+
}
173+
174+
{ -- encoding top-level empty array with array_mt
175+
->
176+
util.to_json setmetatable({}, json.array_mt)
177+
'[]'
178+
}
179+
158180
{
159181
->
160182
util.build_url {

0 commit comments

Comments
 (0)