Skip to content

Commit

Permalink
Add more tests for luacheck.get_message
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeterv committed Nov 18, 2016
1 parent 3f0fa5e commit 1aa3239
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/luacheck_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -494,16 +494,38 @@ describe("get_message", function()
code = "212",
name = "bar"
}))

assert.equal("shadowing definition of loop variable 'foo' on line 1", luacheck.get_message({
code = "423",
name = "foo",
line = 2,
prev_line = 1
}))

assert.equal("unused label 'fail'", luacheck.get_message({
code = "521",
name = "unrelated",
label = "fail"
}))

assert.equal("value assigned to field 'actual' is unused", luacheck.get_message({
code = "314",
name = "unrelated",
field = "actual"
}))

assert.equal("value assigned to index '42' is unused", luacheck.get_message({
code = "314",
name = "11037",
field = "42",
index = true
}))

assert.equal("message goes here", luacheck.get_message({
code = "011",
msg = "message goes here"
}))

assert.equal("unexpected character near '%'", luacheck.get_message({
code = "011",
msg = "unexpected character near '%'"
Expand Down

0 comments on commit 1aa3239

Please sign in to comment.