feat: miri passing

This commit is contained in:
Jonathan Kelley committed 2022-12-05 13:03:52 -08:00
1 parent a61daf220d
commit b0cccce60a
10 files changed
+79 -96

No files matched your search

+2 -2
View File
@@ -20,9 +20,9 @@ fn app(cx: Scope) -> Element {
fn it_goes() {
let mut dom = VirtualDom::new(app);
let edits = dom.rebuild().santize();
let _edits = dom.rebuild().santize();
dom.mark_dirty(ScopeId(0));
dom.render_immediate();
_ = dom.render_immediate();
}
+2 -2
View File
@@ -29,11 +29,11 @@ fn state_shares() {
dom.mark_dirty(ScopeId(0));
_ = dom.render_immediate();
assert_eq!(dom.base_scope().consume_context::<i32>().unwrap(), 1);
assert_eq!(dom.base_scope().consume_context::<i32>().unwrap(), &1);
dom.mark_dirty(ScopeId(0));
_ = dom.render_immediate();
assert_eq!(dom.base_scope().consume_context::<i32>().unwrap(), 2);
assert_eq!(dom.base_scope().consume_context::<i32>().unwrap(), &2);
dom.mark_dirty(ScopeId(2));
assert_eq!(
+5 -5
View File
@@ -8,16 +8,16 @@ fn miri_rollover() {
_ = dom.rebuild();
for x in 0..3 {
for _ in 0..3 {
dom.handle_event("click", Rc::new(MouseData::default()), ElementId(2), true);
dom.process_events();
dom.render_immediate();
_ = dom.render_immediate();
}
}
fn app(cx: Scope) -> Element {
let mut idx = use_state(cx, || 0);
let onhover = |h| println!("go!");
let onhover = |_| println!("go!");
cx.render(rsx! {
div {
@@ -31,7 +31,7 @@ fn app(cx: Scope) -> Element {
button { onclick: move |_| idx -= 1, "-" }
ul {
(0..**idx).map(|i| rsx! {
Child { i: i, onhover: onhover }
child_example { i: i, onhover: onhover }
})
}
}
@@ -39,7 +39,7 @@ fn app(cx: Scope) -> Element {
}
#[inline_props]
fn Child<'a>(cx: Scope<'a>, i: i32, onhover: EventHandler<'a, MouseEvent>) -> Element {
fn child_example<'a>(cx: Scope<'a>, i: i32, onhover: EventHandler<'a, MouseEvent>) -> Element {
cx.render(rsx! {
li {
onmouseover: move |e| onhover.call(e),
+1 -1
View File
@@ -97,7 +97,7 @@ fn memo_works_properly() {
let mut dom = VirtualDom::new(app);
dom.rebuild();
_ = dom.rebuild();
todo!()
// dom.hard_diff(ScopeId(0));
// dom.hard_diff(ScopeId(0));
+4 -3
View File
@@ -1,9 +1,8 @@
use dioxus::core::ElementId;
use dioxus::core::{Mutation::*, SuspenseContext};
use dioxus::prelude::*;
use dioxus_core::SuspenseContext;
use std::future::IntoFuture;
use std::{rc::Rc, time::Duration};
use std::time::Duration;
#[tokio::test]
async fn it_works() {
@@ -51,7 +50,9 @@ fn app(cx: Scope) -> Element {
}
fn suspense_boundary(cx: Scope) -> Element {
cx.use_hook(|| cx.provide_context(Rc::new(SuspenseContext::new(cx.scope_id()))));
cx.use_hook(|| {
cx.provide_context(SuspenseContext::new(cx.scope_id()));
});
// Ensure the right types are found
cx.has_context::<SuspenseContext>().unwrap();