diff --git a/types/src/object.rs b/types/src/object.rs index 6a2c109..3356605 100644 --- a/types/src/object.rs +++ b/types/src/object.rs @@ -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) } diff --git a/types/src/pair.rs b/types/src/pair.rs index 56b439d..ce2c55f 100644 --- a/types/src/pair.rs +++ b/types/src/pair.rs @@ -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, "(())"); + } +}