mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-13 00:51:02 +00:00
Docs, json::Value::U64, and bring many of the rust-serialize fns to Value
This commit is contained in:
@@ -15,12 +15,12 @@ fn test_array_builder() {
|
||||
.push(2)
|
||||
.push(3)
|
||||
.unwrap();
|
||||
assert_eq!(value, Value::Array(vec!(Value::I64(1), Value::I64(2), Value::I64(3))));
|
||||
assert_eq!(value, Value::Array(vec!(Value::U64(1), Value::U64(2), Value::U64(3))));
|
||||
|
||||
let value = ArrayBuilder::new()
|
||||
.push_array(|bld| bld.push(1).push(2).push(3))
|
||||
.unwrap();
|
||||
assert_eq!(value, Value::Array(vec!(Value::Array(vec!(Value::I64(1), Value::I64(2), Value::I64(3))))));
|
||||
assert_eq!(value, Value::Array(vec!(Value::Array(vec!(Value::U64(1), Value::U64(2), Value::U64(3))))));
|
||||
|
||||
let value = ArrayBuilder::new()
|
||||
.push_object(|bld|
|
||||
@@ -30,8 +30,8 @@ fn test_array_builder() {
|
||||
.unwrap();
|
||||
|
||||
let mut map = BTreeMap::new();
|
||||
map.insert("a".to_string(), Value::I64(1));
|
||||
map.insert("b".to_string(), Value::I64(2));
|
||||
map.insert("a".to_string(), Value::U64(1));
|
||||
map.insert("b".to_string(), Value::U64(2));
|
||||
assert_eq!(value, Value::Array(vec!(Value::Object(map))));
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ fn test_object_builder() {
|
||||
.unwrap();
|
||||
|
||||
let mut map = BTreeMap::new();
|
||||
map.insert("a".to_string(), Value::I64(1));
|
||||
map.insert("b".to_string(), Value::I64(2));
|
||||
map.insert("a".to_string(), Value::U64(1));
|
||||
map.insert("b".to_string(), Value::U64(2));
|
||||
assert_eq!(value, Value::Object(map));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user