add config file validation #2

Merged
luna merged 7 commits from config-validation into mistress 2022-12-07 18:50:30 +00:00
Showing only changes of commit d0fba27097 - Show all commits

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