add test for incorrect table schema

This commit is contained in:
Luna 2022-12-07 15:13:33 -03:00
parent 48917659ca
commit d0fba27097
1 changed files with 13 additions and 3 deletions

View File

@ -43,8 +43,7 @@ function TestSchemaValidator:testList()
end end
function TestSchemaValidator:testTable() function TestSchemaValidator:testTable()
local errors = config.validateSchema( local TEST_SCHEMA = {
{
a={ a={
type='table', type='table',
schema={ schema={
@ -53,10 +52,21 @@ function TestSchemaValidator:testTable()
} }
} }
} }
}, }
local errors = config.validateSchema(
TEST_SCHEMA,
{a= {a=
{b=2} {b=2}
} }
) )
lu.assertIs(len(errors), 0) lu.assertIs(len(errors), 0)
local errors = config.validateSchema(
TEST_SCHEMA,
{a=
{b='sex'}
}
)
lu.assertIs(len(errors), 1)
end end