Added unit tests for new username/hostname parsing.
This commit is contained in:
parent
a03e09264e
commit
595e75f1e0
1 changed files with 16 additions and 0 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue