Properly print null edn values as "nil", to allow for isomorphic write/parse

Signed-off-by: Victor Porof <vporof@mozilla.com>
This commit is contained in:
Victor Porof 2017-02-03 09:02:18 +01:00
parent 816a85f0a3
commit 611fbe2eef

View file

@ -50,7 +50,7 @@ impl Display for Value {
// See https://github.com/mozilla/mentat/issues/232
fn fmt(&self, f: &mut Formatter) -> ::std::fmt::Result {
match *self {
Nil => write!(f, "null"),
Nil => write!(f, "nil"),
Boolean(v) => write!(f, "{}", v),
Integer(v) => write!(f, "{}", v),
BigInteger(ref v) => write!(f, "{}N", v),
@ -280,7 +280,7 @@ mod test {
#[test]
fn test_print_edn() {
assert_eq!("[ 1 2 ( 3.14 ) #{ 4N } { :foo/bar 42 } [ ] :five :six/seven eight nine/ten true false null ]",
assert_eq!("[ 1 2 ( 3.14 ) #{ 4N } { :foo/bar 42 } [ ] :five :six/seven eight nine/ten true false nil ]",
Value::Vector(vec![
Value::Integer(1),
Value::Integer(2),