diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2019-04-06 21:38:10 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2019-04-06 21:38:10 -0300 |
commit | d50ad877944ae9bc28d366ff1f3a30b3cc853748 (patch) | |
tree | 12af4b3e0b7e83e789b3d7590c7b6cbe2f700fd5 /test.lua | |
parent | 0118cdcb80c8a299eb156ee669463b84fa44f51d (diff) |
Lots of todos still
Diffstat (limited to 'test.lua')
-rw-r--r-- | test.lua | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test.lua b/test.lua index 283b566..8672903 100644 --- a/test.lua +++ b/test.lua @@ -159,3 +159,76 @@ do -- even more lua tokens assert(table.remove(state, 1) == "\253\191\191\191\191\191") end end -- lua tokens + +do -- simple lua tokens + local luatokens = require "luatokens" + local tokens = luatokens.defs + local state, err, etoken, estate = parser.parse(tokens, [[[""]]) + local case = case() + if not state then + print(case, "---- IN TOKENS ----") + print(case, err, etoken) + for i,v in pairs(estate) do + print(case, i, v) + end + print(case, "---- OUT TOKENS ----") + else + assert(table.remove(state, 1) == "[") + assert(table.remove(state, 1) == luatokens.tokens.TK_STRING) + assert(table.remove(state, 1) == "") + end +end -- lua tokens + +do -- simple long string + local luatokens = require "luatokens" + local tokens = luatokens.defs + local state, err, etoken, estate = parser.parse(tokens, [=[[[]]]=]) + local case = case() + if not state then + print(case, "---- IN TOKENS ----") + print(case, err, etoken) + for i,v in pairs(estate) do + print(case, i, v) + end + print(case, "---- OUT TOKENS ----") + else + assert(table.remove(state, 1) == luatokens.tokens.TK_STRING) + assert(table.remove(state, 1) == "") + end +end -- lua tokens + +do -- long string with depth 1 + local luatokens = require "luatokens" + local tokens = luatokens.defs + local state, err, etoken, estate = parser.parse(tokens, [==[[=[]=]]==]) + local case = case() + if not state then + print(case, "---- IN TOKENS ----") + print(case, err, etoken) + for i,v in pairs(estate) do + print(case, i, v) + end + print(case, "---- OUT TOKENS ----") + else + assert(table.remove(state, 1) == luatokens.tokens.TK_STRING) + assert(table.remove(state, 1) == "") + end +end -- lua tokens + +do -- long string with "nested" long string + local luatokens = require "luatokens" + local tokens = luatokens.defs + local state, err, etoken, estate = parser.parse(tokens, [==[[=[[[]]]=]]==]) + local case = case() + if not state then + print(case, "---- IN TOKENS ----") + print(case, err, etoken) + for i,v in pairs(estate) do + print(case, i, v) + end + print(case, "---- OUT TOKENS ----") + else + assert(table.remove(state, 1) == luatokens.tokens.TK_STRING) + assert(table.remove(state, 1) == "[[]]") + end +end -- lua tokens |