diff options
Diffstat (limited to 'tests/parsing-crates')
-rw-r--r-- | tests/parsing-crates/.gitignore | 1 | ||||
-rw-r--r-- | tests/parsing-crates/Cargo.lock | 131 | ||||
-rw-r--r-- | tests/parsing-crates/Cargo.toml | 17 | ||||
-rw-r--r-- | tests/parsing-crates/mail_parser.rs | 73 | ||||
-rw-r--r-- | tests/parsing-crates/main.rs | 6 |
5 files changed, 228 insertions, 0 deletions
diff --git a/tests/parsing-crates/.gitignore b/tests/parsing-crates/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/tests/parsing-crates/.gitignore @@ -0,0 +1 @@ +target diff --git a/tests/parsing-crates/Cargo.lock b/tests/parsing-crates/Cargo.lock new file mode 100644 index 0000000..4c47568 --- /dev/null +++ b/tests/parsing-crates/Cargo.lock @@ -0,0 +1,131 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "encoding_rs" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "mail-parser" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c46a841ae5276aba5218ade7bb76896358f9f95a925c7b3deea6a0ec0fb8e2a7" +dependencies = [ + "encoding_rs", + "serde", +] + +[[package]] +name = "mail-parser" +version = "0.4.8" +source = "git+https://github.com/superboum/mail-parser?branch=feature/no_decode#0fe5fe071f25016d9c1232eb452c0c4bbfa8a445" +dependencies = [ + "encoding_rs", + "serde", +] + +[[package]] +name = "mail-parser" +version = "0.4.8" +source = "git+https://github.com/superboum/mail-parser?rev=db61a03#db61a0364c00d3cf115f20c6d195bfa4594c53ff" +dependencies = [ + "encoding_rs", + "serde", +] + +[[package]] +name = "mail-parser" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e25e9e9cd1360538e0ca33499f12fd180f3611d7a8e1a50b7e4e43a4c5dd4b7" +dependencies = [ + "encoding_rs", + "serde", +] + +[[package]] +name = "mail-parser" +version = "0.5.0" +source = "git+https://github.com/stalwartlabs/mail-parser?branch=main#bb0e3366daabec8d2f94afd22c661394f9ba7cbe" +dependencies = [ + "encoding_rs", + "serde", +] + +[[package]] +name = "parsing-crates" +version = "0.1.0" +dependencies = [ + "mail-parser 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mail-parser 0.4.8 (git+https://github.com/superboum/mail-parser?branch=feature/no_decode)", + "mail-parser 0.4.8 (git+https://github.com/superboum/mail-parser?rev=db61a03)", + "mail-parser 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "mail-parser 0.5.0 (git+https://github.com/stalwartlabs/mail-parser?branch=main)", +] + +[[package]] +name = "proc-macro2" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "syn" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" diff --git a/tests/parsing-crates/Cargo.toml b/tests/parsing-crates/Cargo.toml new file mode 100644 index 0000000..3971a75 --- /dev/null +++ b/tests/parsing-crates/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "parsing-crates" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[[bin]] +name = "parsing-crates-teste" +path = "main.rs" + +[dependencies] +mail-parser-05 = { package = "mail-parser", version = "0.5" } +mail-parser-048 = { package = "mail-parser", version = "0.4.8" } +mail-parser-main = { package = "mail-parser", git = "https://github.com/stalwartlabs/mail-parser", branch = "main" } +mail-parser-superboum = { package = "mail-parser", git = "https://github.com/superboum/mail-parser", branch = "feature/no_decode" } +mail-parser-db61a03 = { package = "mail-parser", git = "https://github.com/superboum/mail-parser", rev = "db61a03" } diff --git a/tests/parsing-crates/mail_parser.rs b/tests/parsing-crates/mail_parser.rs new file mode 100644 index 0000000..165bace --- /dev/null +++ b/tests/parsing-crates/mail_parser.rs @@ -0,0 +1,73 @@ +use mail_parser_superboum::Message; // FAIL +//use mail_parser_048::Message; // PASS +//use mail_parser_05::Message; // PASS +//use mail_parser_main::Message; // PASS +//use mail_parser_db61a03::Message; // PASS + + +#[test] +fn test1() { + let input = br#"Content-Type: multipart/mixed; boundary="1234567890123456789012345678901234567890123456789012345678901234567890123456789012" + +--1234567890123456789012345678901234567890123456789012345678901234567890123456789012 +Content-Type: multipart/mixed; boundary="123456789012345678901234567890123456789012345678901234567890123456789012345678901" + +--123456789012345678901234567890123456789012345678901234567890123456789012345678901 +Content-Type: multipart/mixed; boundary="12345678901234567890123456789012345678901234567890123456789012345678901234567890" + +--12345678901234567890123456789012345678901234567890123456789012345678901234567890 +Content-Type: text/plain + +1 +--1234567890123456789012345678901234567890123456789012345678901234567890123456789012 +Content-Type: text/plain + +22 +--123456789012345678901234567890123456789012345678901234567890123456789012345678901 +Content-Type: text/plain + +333 +--12345678901234567890123456789012345678901234567890123456789012345678901234567890 +Content-Type: text/plain + +4444 +"#; + + let message = Message::parse(input); + dbg!(message); +} + + +#[test] +fn test2() { + let input = br#"Content-Type: message/rfc822 + +Content-Type: message/rfc822 + +Content-Type: text/plain + +1"#; + + let message = Message::parse(input); + dbg!(message); +} + +#[test] +fn test3() { +let input = br#"Content-Type: multipart/mixed; boundary=":foo" + +--:foo +--:foo +Content-Type: text/plain +--:foo +Content-Type: text/plain +--:foo +Content-Type: text/html +--:foo-- + + +"#; + + let message = Message::parse(input); + dbg!(message); +} diff --git a/tests/parsing-crates/main.rs b/tests/parsing-crates/main.rs new file mode 100644 index 0000000..84bd57d --- /dev/null +++ b/tests/parsing-crates/main.rs @@ -0,0 +1,6 @@ +#[cfg(test)] +mod mail_parser; + +fn main() { + println!("Hello, world!"); +} |