Skip to content

Commit

Permalink
Add unit test for Debug trait
Browse files Browse the repository at this point in the history
  • Loading branch information
nbigaouette committed Dec 8, 2016
1 parent 0482034 commit 35e37aa
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/gitlab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,26 @@ mod tests {
}
}

#[test]
fn impl_debug_for_gitlab() {
let gl = GitLab::new("gitlab.com", "XXXXXXXXXXXXXXXXXXXX").unwrap();

let debug = format!("{:?}", gl);
assert_eq!("GitLab { scheme: https, domain: gitlab.com, port: no port provided, private_token: XXXXXXXXXXXXXXXXXXXX, pagination: None }", debug);

let gl = gl.scheme("http").port(80);
let debug = format!("{:?}", gl);
assert_eq!("GitLab { scheme: http, domain: gitlab.com, port: no port provided, private_token: XXXXXXXXXXXXXXXXXXXX, pagination: None }", debug);

let mut gl = gl.port(81);
let debug = format!("{:?}", gl);
assert_eq!("GitLab { scheme: http, domain: gitlab.com, port: 81, private_token: XXXXXXXXXXXXXXXXXXXX, pagination: None }", debug);

gl.set_pagination(Pagination {page: 2, per_page: 5});
let debug = format!("{:?}", gl);
assert_eq!("GitLab { scheme: http, domain: gitlab.com, port: 81, private_token: XXXXXXXXXXXXXXXXXXXX, pagination: Some(Pagination { page: 2, per_page: 5 }) }", debug);
}


#[test]
fn new_valid() {
Expand Down

0 comments on commit 35e37aa

Please sign in to comment.