From dfb108f6c7abbdeba832d3568d77153fc8c5a3a6 Mon Sep 17 00:00:00 2001 From: ame Date: Sun, 1 Sep 2024 20:18:34 -0500 Subject: clean --- tests/match.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/match.lua b/tests/match.lua index d9c1533..000b1e7 100644 --- a/tests/match.lua +++ b/tests/match.lua @@ -2,13 +2,17 @@ llb = require "lullaby" function test(a, b, match, expect) res, out = llb.test._match(a, b) + + if res == 0 and res == match then return end - if res ~= match then - return llb.io.error("res != match") + if res ~= match then + return llb.io.error(a..":"..b.." res("..res..") != expected") end - if res == 0 then return end - + if res == 0 then + return llb.io.error(a..":"..b.." res == match") + end + if llb.array.len(out) ~= llb.array.len(expect) then return llb.io.error("out != expect") end @@ -18,10 +22,10 @@ function test(a, b, match, expect) return llb.io.error("out != expect") end end - llb.io.pprint(out) end test("/{test}/","/name/", 1, {test="name"}) +test("/", "/wawawawawawaw", 0) test("*","/wdejowe/wde", 1, {}) test("/*/{hello}/{meow}/end","/blah/blah/hii/end", 1, {hello="blah", meow="hii"}) test("/*/*/{test}/*/*/end/*/real","/a/b/testing/d/e/end/f/real", 1, {test="testing"}) @@ -31,7 +35,8 @@ test("{meow}", "owo", 1, {meow="owo"}) test("/{meow}", "/owo", 1, {meow="owo"}) test("{meow}", "/", 0) test("/{meow}", "/", 0) - - - +test("/*/", "/test", 0) +test("/{meow}/", "/aw", 0) +--i dont know if this should be valid, but idc +test("/{meow}/", "//", 1, {meow=""}) -- cgit v1.2.3