local structured = require "structured" local s = structured.new { a = structured.NUMBER + structured.NIL } assert(s:check { a = 1 }) s = structured.BOOLEAN assert(s:check(true)) s = structured.NIL assert(s:check(nil)) s = structured.NUMBER assert(s:check(1)) s = structured.FUNCTION assert(s:check(function()end)) s = structured.STRING assert(s:check("")) s = structured.TABLE assert(s:check({})) s = structured.new {} assert(s:check({})) local s = structured.new { probes = { path = structured.STRING, matcher = structured.STRING + structured.FUNCTION, }, matches = { s = 1, } } assert(s:check { probes = { path = '', matcher = function() end }, matches = { s = 1 } } ) local s = structured.new { [structured.new "probes" + structured.BOOLEAN] = { { path = structured.STRING, matcher = structured.STRING / function(...) print("MATCHERSTRING", ...) return true end + structured.FUNCTION, }, }, matches = { s = 1, } } assert(s:check { probes = { {path = '', matcher = function() end}, }, matches = { s = 1 }, } ) --assert(s:check { probes = 1 }) --assert(s:check { prosbes = { {path = '', matcher = function() end}, }, matches = { s = 1 }, } ) assert(s:check { matches = { s = 1 }, } )