mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
29 lines
647 B
Rust
29 lines
647 B
Rust
#[allow(dead_code)]
|
|
#[rustversion::attr(stable(1.84.0), test)]
|
|
fn props_macro() {
|
|
let t = trybuild::TestCases::new();
|
|
t.pass("tests/props_macro/*-pass.rs");
|
|
t.compile_fail("tests/props_macro/*-fail.rs");
|
|
}
|
|
|
|
#[test]
|
|
fn props_order() {
|
|
#[derive(yew::Properties, PartialEq)]
|
|
struct Props {
|
|
first: usize,
|
|
second: usize,
|
|
last: usize,
|
|
}
|
|
|
|
let mut g = 1..=3;
|
|
let props = yew::props!(Props {
|
|
first: g.next().unwrap(),
|
|
second: g.next().unwrap(),
|
|
last: g.next().unwrap()
|
|
});
|
|
|
|
assert_eq!(props.first, 1);
|
|
assert_eq!(props.second, 2);
|
|
assert_eq!(props.last, 3);
|
|
}
|