fix fuzzing test
This commit is contained in:
1 parent
eb15014b9d
commit
d5b7a6d15e
2 files changed
+23
-6
No files matched your search
@@ -20,6 +20,7 @@ fn app(cx: Scope) -> Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
fn Component<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> {
|
fn Component<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> {
|
||||||
render! {
|
render! {
|
||||||
audio {
|
audio {
|
||||||
|
|||||||
@@ -204,6 +204,20 @@ fn create_random_dynamic_node(cx: &ScopeState, depth: usize) -> DynamicNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn create_random_dynamic_mounted_attr(cx: &ScopeState) -> MountedAttribute {
|
||||||
|
match rand::random::<u8>() % 2 {
|
||||||
|
0 => MountedAttribute::from(
|
||||||
|
&*cx.bump().alloc(
|
||||||
|
(0..(rand::random::<u8>() % 3) as usize)
|
||||||
|
.map(|_| create_random_dynamic_attr(cx))
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
1 => MountedAttribute::from(create_random_dynamic_attr(cx)),
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute {
|
fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute {
|
||||||
let value = match rand::random::<u8>() % 6 {
|
let value = match rand::random::<u8>() % 6 {
|
||||||
0 => AttributeValue::Text(Box::leak(
|
0 => AttributeValue::Text(Box::leak(
|
||||||
@@ -214,7 +228,6 @@ fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute {
|
|||||||
3 => AttributeValue::Bool(rand::random()),
|
3 => AttributeValue::Bool(rand::random()),
|
||||||
4 => cx.any_value(rand::random::<usize>()),
|
4 => cx.any_value(rand::random::<usize>()),
|
||||||
5 => AttributeValue::None,
|
5 => AttributeValue::None,
|
||||||
// Listener(RefCell<Option<ListenerCb<'a>>>),
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
Attribute::new(
|
Attribute::new(
|
||||||
@@ -273,11 +286,14 @@ fn create_random_element(cx: Scope<DepthProps>) -> Element {
|
|||||||
.collect();
|
.collect();
|
||||||
cx.bump().alloc(dynamic_nodes)
|
cx.bump().alloc(dynamic_nodes)
|
||||||
},
|
},
|
||||||
dynamic_attrs: cx.bump().alloc(
|
dynamic_attrs: cx
|
||||||
(0..template.attr_paths.len())
|
.bump()
|
||||||
.map(|_| create_random_dynamic_attr(cx))
|
.alloc(
|
||||||
.collect::<Vec<_>>(),
|
(0..template.attr_paths.len())
|
||||||
),
|
.map(|_| create_random_dynamic_mounted_attr(cx))
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
)
|
||||||
|
.as_slice(),
|
||||||
};
|
};
|
||||||
Some(node)
|
Some(node)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user