forked from peposso/lua-tinyyaml
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix parsing of numbers in tinyyaml.lua (#38)
- Loading branch information
1 parent
31b9a5c
commit 197632c
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
local busted = require('busted') | ||
local assert = require('luassert') | ||
local yaml = require('tinyyaml') | ||
|
||
busted.describe("numbers in nested seq:", function () | ||
local parsed_yaml = yaml.parse('case: [["status", "==", 302]]') | ||
local parsed_yaml2 = yaml.parse('case: [["status", "==", "302"]]') | ||
busted.it("numbers", function () | ||
assert.same( | ||
{ | ||
case = {{"status", "==", 302}} | ||
}, | ||
yaml.parse([[ | ||
case: | ||
- - "status" | ||
- "==" | ||
- 302 | ||
]] | ||
) | ||
) | ||
end) | ||
|
||
busted.it("numbers in inline nested seq:", function () | ||
assert.same( | ||
{ | ||
case = {{"status", "==", 302}} | ||
}, | ||
yaml.parse([[ | ||
case: | ||
- | ||
- "status" | ||
- "==" | ||
- 302 | ||
]] | ||
) | ||
) | ||
end) | ||
|
||
busted.it("number inside [] brackets", function () | ||
assert.same( | ||
{ | ||
case = {{"status", "==", 302}} | ||
}, parsed_yaml | ||
) | ||
end) | ||
|
||
busted.it("number inside [] brackets in double quotes", function () | ||
assert.same( | ||
{ | ||
case = {{"status", "==", "302"}} | ||
}, parsed_yaml2 | ||
) | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters