Add rust parser test (#1924)

* Add rust parser test

Signed-off-by: Dude so hot <djohn@fbi.gov>

* Update cargo lock

Signed-off-by: Dude so hot <djohn@fbi.gov>

---------

Signed-off-by: Dude so hot <djohn@fbi.gov>
Co-authored-by: Dude so hot <djohn@fbi.gov>
This commit is contained in:
renovate[bot]andDude so hot authored and GitHub committed 2024-11-12 08:31:49 +00:00
1 parent dd1bbf1226
commit ec8bd2fc14
5 files changed
+1181 -9

No files matched your search

+1159 -7
View File
File diff suppressed because it is too large. Load diff
+4
View File
@@ -26,6 +26,10 @@ image = { default-features = false, version = "0.25" }
rxing = { default-features = false, version = "0.6" }
ndk = { version = "0.9", optional = true }
[dev-dependencies]
reqwest = "0.12"
tokio = { version = "1", features = ["macros"] }
[profile.release]
panic = "abort"
strip = true
+1
View File
@@ -2,4 +2,5 @@ pub mod config;
pub mod fav;
pub mod home;
pub mod list;
mod test_parser;
pub mod torrent;
+2 -2
View File
@@ -10,7 +10,7 @@ use std::borrow::Cow;
use std::ops::Index;
use tl::{Node, Parser, VDom};
#[derive(Serialize)]
#[derive(Serialize, Debug)]
#[allow(non_snake_case)]
struct BaseGalleryInfo {
gid: i64,
@@ -34,7 +34,7 @@ struct BaseGalleryInfo {
favoriteNote: Option<String>,
}
#[derive(Serialize)]
#[derive(Serialize, Debug)]
#[allow(non_snake_case)]
pub struct GalleryListResult {
prev: Option<String>,
@@ -0,0 +1,15 @@
#[cfg(test)]
mod tests {
use crate::parser::list::parse_info_list;
use reqwest::get;
use tl::ParserOptions;
#[tokio::test]
async fn test_parse_info() {
let resp = get("https://e-hentai.org/").await.expect("Failed to get!");
let body = resp.text().await.expect("Failed to receive!");
let dom = tl::parse(&body, ParserOptions::default()).expect("Failed to parse html");
let result = parse_info_list(&dom, dom.parser(), &body).expect("Failed to parse info list");
dbg!(result);
}
}