Added unit tests for new username/hostname parsing.

This commit is contained in:
Aaron Weiss 2015-06-05 22:25:49 -04:00
parent a03e09264e
commit 595e75f1e0

View file

@ -272,6 +272,22 @@ mod test {
assert_eq!(user.get_nickname(), "owner");
}
#[test]
fn get_username() {
let user = User::new("user!username@hostname");
assert_eq!(user.get_username(), Some("username"));
let user = User::new("user");
assert_eq!(user.get_username(), None);
}
#[test]
fn get_hostname() {
let user = User::new("user!username@hostname");
assert_eq!(user.get_hostname(), Some("hostname"));
let user = User::new("user");
assert_eq!(user.get_hostname(), None);
}
#[test]
fn access_level() {
let user = User::new("~owner");