Skip to content

Commit

Permalink
Feature(value): displaying ext values.
Browse files Browse the repository at this point in the history
This commit partially resolves #46.
  • Loading branch information
3Hren committed Sep 18, 2015
1 parent a511b0f commit 0cdc4f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rmp/src/value.rs
Expand Up @@ -77,7 +77,9 @@ impl ::std::fmt::Display for Value {

write!(f, "}}")
}
_ => unimplemented!()
Value::Ext(ty, ref data) => {
write!(f, "[{}, {:?}]", ty, data)
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions rmp/tests/value.rs
Expand Up @@ -51,3 +51,10 @@ fn display_map() {
assert_eq!("{nil: nil, true: false}", format!("{}", Value::Map(vec![(Value::Nil, Value::Nil),
(Value::Boolean(true), Value::Boolean(false))])));
}

#[test]
fn display_ext() {
assert_eq!("[1, []]", format!("{}", Value::Ext(1, vec![])));
assert_eq!("[1, [100]]", format!("{}", Value::Ext(1, vec![100])));
assert_eq!("[1, [100, 42]]", format!("{}", Value::Ext(1, vec![100, 42])));
}

0 comments on commit 0cdc4f9

Please sign in to comment.