add config file validation #2
1 changed files with 13 additions and 3 deletions
|
@ -43,8 +43,7 @@ function TestSchemaValidator:testList()
|
|||
end
|
||||
|
||||
function TestSchemaValidator:testTable()
|
||||
local errors = config.validateSchema(
|
||||
{
|
||||
local TEST_SCHEMA = {
|
||||
a={
|
||||
type='table',
|
||||
schema={
|
||||
|
@ -53,10 +52,21 @@ function TestSchemaValidator:testTable()
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
local errors = config.validateSchema(
|
||||
TEST_SCHEMA,
|
||||
{a=
|
||||
{b=2}
|
||||
}
|
||||
)
|
||||
lu.assertIs(len(errors), 0)
|
||||
|
||||
local errors = config.validateSchema(
|
||||
TEST_SCHEMA,
|
||||
{a=
|
||||
{b='sex'}
|
||||
}
|
||||
)
|
||||
lu.assertIs(len(errors), 1)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue