mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Update property nesting
Deeper nested properties guaranteed to be processed after shallower nested properties. Also added strict mode checks for duplicate nested properties.
This commit is contained in:
parent
ddb88cfdf8
commit
a769139136
5 changed files with 125 additions and 29 deletions
|
|
@ -596,6 +596,20 @@ TEST("create()", function()
|
|||
CHECK(text.Text == "test")
|
||||
end
|
||||
|
||||
do CASE "nested precedence"
|
||||
local text = create "TextLabel" {
|
||||
Group = {
|
||||
Text = "1",
|
||||
|
||||
{
|
||||
Text = "2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(text.Text == "2")
|
||||
end
|
||||
|
||||
do CASE "independent"
|
||||
local frame = create "Frame"
|
||||
CHECK(frame {} ~= frame {})
|
||||
|
|
@ -1153,6 +1167,7 @@ end)
|
|||
TEST("strict", function()
|
||||
vide.strict = true
|
||||
|
||||
local create = vide.create
|
||||
local source = vide.source
|
||||
local derive = vide.derive
|
||||
local watch = vide.watch
|
||||
|
|
@ -1231,6 +1246,34 @@ TEST("strict", function()
|
|||
|
||||
CHECK(not ok)
|
||||
end
|
||||
|
||||
do CASE "duplicate properties"
|
||||
local ok = pcall(function()
|
||||
create "TextLabel" {
|
||||
{
|
||||
Name = "foo"
|
||||
},
|
||||
{
|
||||
Name = "bar"
|
||||
}
|
||||
}
|
||||
end)
|
||||
|
||||
CHECK(not ok)
|
||||
|
||||
ok = pcall(function()
|
||||
create "TextLabel" {
|
||||
{
|
||||
Name = "foo",
|
||||
{
|
||||
Name = "bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
end)
|
||||
|
||||
CHECK(ok)
|
||||
end
|
||||
end)
|
||||
|
||||
local ok = FINISH()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue