mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-21 18:10:42 -04:00
FIX: use field_name instead of name to avoid colliding with the name field.
This commit is contained in:
parent
524f85102f
commit
7846c631d0
@ -101,9 +101,9 @@ let shaped = module {
|
||||
},
|
||||
};
|
||||
|
||||
let shape_tuple_handler = func (acc, name, value) => acc{
|
||||
ok = select (name) in acc.val, false, {
|
||||
true = schema.shaped{val=value, shape=acc.val.(name), partial=false},
|
||||
let shape_tuple_handler = func (acc, field_name, value) => acc{
|
||||
ok = select (field_name) in acc.val, false, {
|
||||
true = schema.shaped{val=value, shape=acc.val.(field_name), partial=false},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -92,7 +92,7 @@ assert t.ok{
|
||||
};
|
||||
|
||||
assert t.ok{
|
||||
test = schema.shaped{val={foo="bar", count=1}, shape={foo=""}},
|
||||
test = schema.shaped{val={foo="bar", count=1, fuzzy={bear="claws"}}, shape={foo=""}},
|
||||
desc = "shaped for partial tuples works",
|
||||
};
|
||||
|
||||
@ -169,4 +169,11 @@ assert t.ok{
|
||||
assert t.not_ok{
|
||||
test = schema.all{val={foo="bar", baz="quux"}, types=[{foo=""}, {baz=""}, {quux=""}]},
|
||||
desc = "all enforces that all of the valid shapes must be partial matches (fail)",
|
||||
};
|
||||
|
||||
assert t.ok{
|
||||
test = schema.shaped{val={
|
||||
name = "simple",
|
||||
}, shape={name="",}, partial=true},
|
||||
desc = "partial shapes match okay",
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user