Skip to content

Commit

Permalink
add unit tests to head_refs #700
Browse files Browse the repository at this point in the history
  • Loading branch information
o2sh committed Aug 15, 2022
1 parent 8fe3e42 commit 0b7111a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/info/head_refs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,20 @@ impl Serialize for HeadRefs {
state.end()
}
}

#[cfg(test)]
mod test {
use super::*;

#[test]
fn test_head_refs() {
let head = HeadRefs::new("be561d5".into(), vec!["main".into(), "origin/main".into()]);
assert_eq!(format!("{}", head), "be561d5 (main, origin/main)")
}

#[test]
fn test_head_refs_with_no_refs() {
let head = HeadRefs::new("be561d5".into(), vec![]);
assert_eq!(format!("{}", head), "be561d5")
}
}

0 comments on commit 0b7111a

Please sign in to comment.