Skip to content

Commit 0b7111a

Browse files
committed
add unit tests to head_refs #700
1 parent 8fe3e42 commit 0b7111a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/info/head_refs.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,20 @@ impl Serialize for HeadRefs {
4242
state.end()
4343
}
4444
}
45+
46+
#[cfg(test)]
47+
mod test {
48+
use super::*;
49+
50+
#[test]
51+
fn test_head_refs() {
52+
let head = HeadRefs::new("be561d5".into(), vec!["main".into(), "origin/main".into()]);
53+
assert_eq!(format!("{}", head), "be561d5 (main, origin/main)")
54+
}
55+
56+
#[test]
57+
fn test_head_refs_with_no_refs() {
58+
let head = HeadRefs::new("be561d5".into(), vec![]);
59+
assert_eq!(format!("{}", head), "be561d5")
60+
}
61+
}

0 commit comments

Comments
 (0)