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:
Aaron Smith 2023-08-14 11:42:16 +01:00
parent ddb88cfdf8
commit a769139136
5 changed files with 125 additions and 29 deletions

View file

@ -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()