Fix indentation

This commit is contained in:
Brandon Dyck 2024-07-18 02:24:41 -06:00
parent cabf230f3c
commit 05b6180c92

View File

@ -4,44 +4,44 @@ local serialize, parse = csexp.serialize, csexp.parse
local describe, it, expect = lester.describe, lester.it, lester.expect local describe, it, expect = lester.describe, lester.it, lester.expect
describe("csexp", function() describe("csexp", function()
describe("serialize", function() describe("serialize", function()
it("handles empty string", function() it("handles empty string", function()
expect.equal(serialize"", "0:") expect.equal(serialize"", "0:")
end) end)
it("handles nonempty string", function() it("handles nonempty string", function()
expect.equal(serialize"abcd", "4:abcd") expect.equal(serialize"abcd", "4:abcd")
end) end)
it("handles empty list", function() it("handles empty list", function()
expect.equal(serialize{}, "()") expect.equal(serialize{}, "()")
end) end)
it("converts non-string values", function() it("converts non-string values", function()
expect.equal(serialize(12345), "5:12345") expect.equal(serialize(12345), "5:12345")
end) end)
it("inverts parse", function() it("inverts parse", function()
local original = "(10:abcdefghij(5:hello(5:world)7:goodbye))" local original = "(10:abcdefghij(5:hello(5:world)7:goodbye))"
local obj = parse(original) local obj = parse(original)
local serialized = serialize(obj) local serialized = serialize(obj)
expect.equal(serialized, original) expect.equal(serialized, original)
end) end)
end) end)
describe("parse", function() describe("parse", function()
local rejects = { local rejects = {
["malformed lists"] = "(5:hello5:world", ["malformed lists"] = "(5:hello5:world",
["early eof in strings"] = "5:1234", ["early eof in strings"] = "5:1234",
["extra chars in strings"] = "5:123456", ["extra chars in strings"] = "5:123456",
["extra chars after list"] = "()0:" ["extra chars after list"] = "()0:"
} }
for description, value in pairs(rejects) do for description, value in pairs(rejects) do
it("rejects "..description, function() it("rejects "..description, function()
expect.fail(function() expect.fail(function()
parse(value) parse(value)
end) end)
end) end)
end end
end) end)
end) end)