Fix the router and stub out a number of crates to get compiling

This commit is contained in:
Jonathan Kelley committed 2024-01-13 20:51:37 -08:00
1 parent 4c6e515da4
commit fae0b08e61
226 files changed
+1057 -1482

No files matched your search

+38 -38
View File
@@ -279,7 +279,7 @@ mod tests {
#[test]
fn test_no_hooks() {
let contents = indoc! {r#"
fn App(cx: Scope) -> Element {
fn App() -> Element {
rsx! {
p { "Hello World" }
}
@@ -294,8 +294,8 @@ mod tests {
#[test]
fn test_hook_correctly_used_inside_component() {
let contents = indoc! {r#"
fn App(cx: Scope) -> Element {
let count = use_state(cx, || 0);
fn App() -> Element {
let count = use_state(|| 0);
rsx! {
p { "Hello World: {count}" }
}
@@ -310,8 +310,8 @@ mod tests {
#[test]
fn test_hook_correctly_used_inside_hook_fn() {
let contents = indoc! {r#"
fn use_thing(cx: Scope) -> UseState<i32> {
use_state(cx, || 0)
fn use_thing() -> UseState<i32> {
use_state(|| 0)
}
"#};
@@ -323,9 +323,9 @@ mod tests {
#[test]
fn test_hook_correctly_used_inside_hook_closure() {
let contents = indoc! {r#"
fn App(cx: Scope) -> Element {
fn App() -> Element {
let use_thing = || {
use_state(cx, || 0)
use_state(|| 0)
};
let count = use_thing();
rsx! {
@@ -342,9 +342,9 @@ mod tests {
#[test]
fn test_conditional_hook_if() {
let contents = indoc! {r#"
fn App(cx: Scope) -> Element {
fn App() -> Element {
if you_are_happy && you_know_it {
let something = use_state(cx, || "hands");
let something = use_state(|| "hands");
println!("clap your {something}")
}
}
@@ -357,7 +357,7 @@ mod tests {
vec![Issue::HookInsideConditional(
HookInfo::new(
Span::new_from_str(
r#"use_state(cx, || "hands")"#,
r#"use_state(|| "hands")"#,
LineColumn { line: 3, column: 24 },
),
Span::new_from_str(
@@ -368,7 +368,7 @@ mod tests {
),
ConditionalInfo::If(IfInfo::new(
Span::new_from_str(
"if you_are_happy && you_know_it {\n let something = use_state(cx, || \"hands\");\n println!(\"clap your {something}\")\n }",
"if you_are_happy && you_know_it {\n let something = use_state(|| \"hands\");\n println!(\"clap your {something}\")\n }",
LineColumn { line: 2, column: 4 },
),
Span::new_from_str(
@@ -383,10 +383,10 @@ mod tests {
#[test]
fn test_conditional_hook_match() {
let contents = indoc! {r#"
fn App(cx: Scope) -> Element {
fn App() -> Element {
match you_are_happy && you_know_it {
true => {
let something = use_state(cx, || "hands");
let something = use_state(|| "hands");
println!("clap your {something}")
}
false => {}
@@ -400,13 +400,13 @@ mod tests {
report.issues,
vec![Issue::HookInsideConditional(
HookInfo::new(
Span::new_from_str(r#"use_state(cx, || "hands")"#, LineColumn { line: 4, column: 28 }),
Span::new_from_str(r#"use_state(|| "hands")"#, LineColumn { line: 4, column: 28 }),
Span::new_from_str(r#"use_state"#, LineColumn { line: 4, column: 28 }),
"use_state".to_string()
),
ConditionalInfo::Match(MatchInfo::new(
Span::new_from_str(
"match you_are_happy && you_know_it {\n true => {\n let something = use_state(cx, || \"hands\");\n println!(\"clap your {something}\")\n }\n false => {}\n }",
"match you_are_happy && you_know_it {\n true => {\n let something = use_state(|| \"hands\");\n println!(\"clap your {something}\")\n }\n false => {}\n }",
LineColumn { line: 2, column: 4 },
),
Span::new_from_str("match you_are_happy && you_know_it", LineColumn { line: 2, column: 4 })
@@ -418,9 +418,9 @@ mod tests {
#[test]
fn test_for_loop_hook() {
let contents = indoc! {r#"
fn App(cx: Scope) -> Element {
fn App() -> Element {
for _name in &names {
let is_selected = use_state(cx, || false);
let is_selected = use_state(|| false);
println!("selected: {is_selected}");
}
}
@@ -433,7 +433,7 @@ mod tests {
vec![Issue::HookInsideLoop(
HookInfo::new(
Span::new_from_str(
"use_state(cx, || false)",
"use_state(|| false)",
LineColumn { line: 3, column: 26 },
),
Span::new_from_str(
@@ -444,7 +444,7 @@ mod tests {
),
AnyLoopInfo::For(ForInfo::new(
Span::new_from_str(
"for _name in &names {\n let is_selected = use_state(cx, || false);\n println!(\"selected: {is_selected}\");\n }",
"for _name in &names {\n let is_selected = use_state(|| false);\n println!(\"selected: {is_selected}\");\n }",
LineColumn { line: 2, column: 4 },
),
Span::new_from_str(
@@ -459,9 +459,9 @@ mod tests {
#[test]
fn test_while_loop_hook() {
let contents = indoc! {r#"
fn App(cx: Scope) -> Element {
fn App() -> Element {
while true {
let something = use_state(cx, || "hands");
let something = use_state(|| "hands");
println!("clap your {something}")
}
}
@@ -474,7 +474,7 @@ mod tests {
vec![Issue::HookInsideLoop(
HookInfo::new(
Span::new_from_str(
r#"use_state(cx, || "hands")"#,
r#"use_state(|| "hands")"#,
LineColumn { line: 3, column: 24 },
),
Span::new_from_str(
@@ -485,7 +485,7 @@ mod tests {
),
AnyLoopInfo::While(WhileInfo::new(
Span::new_from_str(
"while true {\n let something = use_state(cx, || \"hands\");\n println!(\"clap your {something}\")\n }",
"while true {\n let something = use_state(|| \"hands\");\n println!(\"clap your {something}\")\n }",
LineColumn { line: 2, column: 4 },
),
Span::new_from_str(
@@ -500,9 +500,9 @@ mod tests {
#[test]
fn test_loop_hook() {
let contents = indoc! {r#"
fn App(cx: Scope) -> Element {
fn App() -> Element {
loop {
let something = use_state(cx, || "hands");
let something = use_state(|| "hands");
println!("clap your {something}")
}
}
@@ -515,7 +515,7 @@ mod tests {
vec![Issue::HookInsideLoop(
HookInfo::new(
Span::new_from_str(
r#"use_state(cx, || "hands")"#,
r#"use_state(|| "hands")"#,
LineColumn { line: 3, column: 24 },
),
Span::new_from_str(
@@ -525,7 +525,7 @@ mod tests {
"use_state".to_string()
),
AnyLoopInfo::Loop(LoopInfo::new(Span::new_from_str(
"loop {\n let something = use_state(cx, || \"hands\");\n println!(\"clap your {something}\")\n }",
"loop {\n let something = use_state(|| \"hands\");\n println!(\"clap your {something}\")\n }",
LineColumn { line: 2, column: 4 },
)))
)],
@@ -535,8 +535,8 @@ mod tests {
#[test]
fn test_conditional_okay() {
let contents = indoc! {r#"
fn App(cx: Scope) -> Element {
let something = use_state(cx, || "hands");
fn App() -> Element {
let something = use_state(|| "hands");
if you_are_happy && you_know_it {
println!("clap your {something}")
}
@@ -551,9 +551,9 @@ mod tests {
#[test]
fn test_closure_hook() {
let contents = indoc! {r#"
fn App(cx: Scope) -> Element {
fn App() -> Element {
let _a = || {
let b = use_state(cx, || 0);
let b = use_state(|| 0);
b.get()
};
}
@@ -566,7 +566,7 @@ mod tests {
vec![Issue::HookInsideClosure(
HookInfo::new(
Span::new_from_str(
"use_state(cx, || 0)",
"use_state(|| 0)",
LineColumn {
line: 3,
column: 16
@@ -582,7 +582,7 @@ mod tests {
"use_state".to_string()
),
ClosureInfo::new(Span::new_from_str(
"|| {\n let b = use_state(cx, || 0);\n b.get()\n }",
"|| {\n let b = use_state(|| 0);\n b.get()\n }",
LineColumn {
line: 2,
column: 13
@@ -595,8 +595,8 @@ mod tests {
#[test]
fn test_hook_outside_component() {
let contents = indoc! {r#"
fn not_component_or_hook(cx: Scope) {
let _a = use_state(cx, || 0);
fn not_component_or_hook() {
let _a = use_state(|| 0);
}
"#};
@@ -606,7 +606,7 @@ mod tests {
report.issues,
vec![Issue::HookOutsideComponent(HookInfo::new(
Span::new_from_str(
"use_state(cx, || 0)",
"use_state(|| 0)",
LineColumn {
line: 2,
column: 13
@@ -627,8 +627,8 @@ mod tests {
#[test]
fn test_hook_inside_hook() {
let contents = indoc! {r#"
fn use_thing(cx: Scope) {
let _a = use_state(cx, || 0);
fn use_thing() {
let _a = use_state(|| 0);
}
"#};