Skip to content

Commit

Permalink
🔥 Invalid macro temporarily removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
langyo committed Nov 9, 2023
1 parent 23d6a1e commit 77a7e3d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 94 deletions.
72 changes: 36 additions & 36 deletions packages/proto-macros/tests/genereate_app.rs
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
#[cfg(test)]
mod test {
use hikari_proto::generate_app;
// use hikari_proto::generate_app;

fn generate() {
generate_app! {
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum Route {
#[at("/")]
Portal { recommend_list: Vec<String> }

#[at("/u/:id")]
Personal { id: String, name: String, email: String }

#[at("/t/:id")]
Thread { id: String, title: String, content: String, comments: Vec<String> }

#[not_found]
#[at("/404")]
NotFound
}

#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
pub struct Theme {
pub primary_color: String,
pub secondary_color: String,
}

#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
pub struct UserToken {
pub token: String,
}
}
// generate_app! {
// #[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
// pub enum Route {
// #[at("/")]
// Portal { recommend_list: Vec<String> }

// #[at("/u/:id")]
// Personal { id: String, name: String, email: String }

// #[at("/t/:id")]
// Thread { id: String, title: String, content: String, comments: Vec<String> }

// #[not_found]
// #[at("/404")]
// NotFound
// }

// #[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
// pub struct Theme {
// pub primary_color: String,
// pub secondary_color: String,
// }

// #[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
// pub struct UserToken {
// pub token: String,
// }
// }
}

#[test]
fn render_at_client() {
generate().hydrate(web_sys::window()?.document()?.get_element_by_id("_root")?);
// generate().hydrate(web_sys::window()?.document()?.get_element_by_id("_root")?);
}

#[test]
fn render_at_server() {
generate().render_to_string(Route::Personal {
id: "114514",
name: "homo",
email: "[email protected]",
});
// generate().render_to_string(Route::Personal {
// id: "114514",
// name: "homo",
// email: "[email protected]",
// });

let stream = generate().render_to_stream();
// let stream = generate().render_to_stream();
}
}
1 change: 0 additions & 1 deletion packages/proto/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
mod macros;

pub use macros::generate_app::*;
pub use macros::register_routes::*;
56 changes: 0 additions & 56 deletions packages/proto/src/macros/generate_app.rs

This file was deleted.

1 change: 0 additions & 1 deletion packages/proto/src/macros/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub mod generate_app;
pub mod register_routes;

0 comments on commit 77a7e3d

Please sign in to comment.