mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-14 16:47:19 +00:00
21a6551ce6
* Allow slice! macro to index tuples * Undo changes to component tests --------- Co-authored-by: Greg Johnston <greg.johnston@gmail.com>
35 lines
727 B
Rust
35 lines
727 B
Rust
use leptos::{create_runtime, create_rw_signal};
|
|
use leptos_macro::slice;
|
|
|
|
#[derive(Default)]
|
|
pub struct OuterState {
|
|
count: i32,
|
|
inner: InnerState,
|
|
}
|
|
|
|
#[derive(Clone, PartialEq, Default)]
|
|
pub struct InnerState {
|
|
inner_count: i32,
|
|
inner_tuple: InnerTuple,
|
|
}
|
|
|
|
#[derive(Clone, PartialEq, Default)]
|
|
pub struct InnerTuple(String);
|
|
|
|
#[test]
|
|
fn green() {
|
|
let _ = create_runtime();
|
|
|
|
let outer_signal = create_rw_signal(OuterState::default());
|
|
|
|
let (_, _) = slice!(outer_signal.count);
|
|
|
|
let (_, _) = slice!(outer_signal.inner.inner_count);
|
|
let (_, _) = slice!(outer_signal.inner.inner_tuple.0);
|
|
}
|
|
|
|
#[test]
|
|
fn red() {
|
|
let t = trybuild::TestCases::new();
|
|
t.compile_fail("tests/slice/red.rs")
|
|
}
|