[types] Test for displaying empty Pair

This commit is contained in:
Eryn Wells 2018-08-25 08:33:39 -07:00
parent fc1f3acfa2
commit d10c72711b
2 changed files with 12 additions and 0 deletions

View file

@ -39,6 +39,7 @@ impl Obj {
}
pub fn take(&mut self) -> Obj {
// Stole Option's implementation of this. Handy. :D
mem::replace(self, Obj::Null)
}

View file

@ -49,3 +49,14 @@ impl fmt::Display for Pair {
}
}
#[cfg(test)]
mod tests {
use super::Pair;
#[test]
fn display_empty_pair() {
let empty = Pair::empty();
let disp = format!("{}", empty);
assert_eq!(disp, "(())");
}
}