forked from jonstoler/lua-toml
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IMPLEMENTED jonstoler#11 - read multiple data chunks - NOTE : source …
…line report temporary removed; error reporting not tested.
- Loading branch information
user
committed
Nov 30, 2018
1 parent
85c3301
commit 404fa4b
Showing
2 changed files
with
79 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
describe("multi step parsing", function() | ||
setup(function() | ||
TOML = require "toml" | ||
end) | ||
|
||
it("split the input in two chunks", function() | ||
local parse = TOML.multistep_parser() | ||
parse [=[ | ||
a = "a" | ||
]=] | ||
parse [=[ | ||
b = "b"]=] | ||
local obj = parse() | ||
local sol = { | ||
a = "a", | ||
b = "b", | ||
} | ||
|
||
assert.same(sol, obj) | ||
end) | ||
|
||
it("in middle of string split", function() | ||
local parse = TOML.multistep_parser() | ||
parse [=[ | ||
a = "a]=] | ||
parse [=[ | ||
" | ||
b = "b"]=] | ||
local obj = parse() | ||
local sol = { | ||
a = "a", | ||
b = "b", | ||
} | ||
|
||
assert.same(sol, obj) | ||
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