1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
use imap_types::{
command::{Command, CommandBody},
core::{AString, Atom, Literal, Tag},
secret::Secret,
};
#[test]
fn test_readme() {
Command::new("A1", CommandBody::login("alice", "password").unwrap()).unwrap();
Command::new(
"A1",
CommandBody::login("alice\"", b"\xCA\xFE".as_ref()).unwrap(),
)
.unwrap();
Command::new(
"A1",
CommandBody::login(Literal::try_from("alice").unwrap(), "password").unwrap(),
)
.unwrap();
let tag = Tag::try_from("A1").unwrap();
let _ = Command {
tag,
body: CommandBody::Login {
username: AString::from(Atom::unvalidated("alice")),
password: Secret::new(AString::from(Atom::unvalidated("password"))),
},
};
}
#[test]
#[should_panic]
fn test_readme_failing() {
Command::new("A1", CommandBody::login("alice\x00", "password").unwrap()).unwrap();
}
|