Skip to content

Commit

Permalink
test: fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 23, 2023
1 parent a802477 commit 3e15c6e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tests/spec_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ describe("parses specs", function()
local tests = {
{
input = "foo",
output = { fields = { "foo" }, sort = { { field = "foo" } } },
output = { fields = { "foo" }, format = "{foo}" },
},
{
input = "-foo",
output = { fields = { "foo" }, sort = { { field = "foo", desc = true } } },
output = { fields = { "foo" }, format = "{foo}" },
},
{
input = { "foo", "-bar" },
output = { fields = { "foo", "bar" }, sort = { { field = "foo" }, { field = "bar", desc = true } } },
output = { fields = { "foo", "bar" }, format = "{foo} {bar}" },
},
{
input = { "foo", "-bar", sort = "baz" },
output = { fields = { "foo", "bar" }, sort = { { field = "baz" } } },
input = { "foo", "-bar" },
output = { fields = { "foo", "bar" }, format = "{foo} {bar}" },
},
{
input = { "foo", "-bar", sort = "-baz" },
output = { fields = { "foo", "bar" }, sort = { { field = "baz", desc = true } } },
input = { "foo", "-bar" },
output = { fields = { "foo", "bar" }, format = "{foo} {bar}" },
},
}

Expand All @@ -68,9 +68,10 @@ describe("parses specs", function()
}
local output = {
source = "diagnostics",
groups = { { fields = { "filename" }, sort = { { field = "filename" } } } },
groups = { { fields = { "filename" }, format = "{filename}" } },
sort = { { field = "filename" }, { field = "pos" } },
filter = { severity = 1 },
format = "{filename} {pos}",
}
assert.same(output, Spec.section(input))
end)
Expand Down

0 comments on commit 3e15c6e

Please sign in to comment.