[types] Test for displaying empty Pair
This commit is contained in:
parent
fc1f3acfa2
commit
d10c72711b
2 changed files with 12 additions and 0 deletions
|
@ -39,6 +39,7 @@ impl Obj {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn take(&mut self) -> Obj {
|
pub fn take(&mut self) -> Obj {
|
||||||
|
// Stole Option's implementation of this. Handy. :D
|
||||||
mem::replace(self, Obj::Null)
|
mem::replace(self, Obj::Null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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, "(())");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue