mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-28 23:07:55 +00:00
Start fixing the json tests
This commit is contained in:
@@ -104,12 +104,6 @@ impl ser::Visitor for Serializer {
|
||||
type Value = ();
|
||||
type Error = ();
|
||||
|
||||
#[inline]
|
||||
fn visit_unit(&mut self) -> Result<(), ()> {
|
||||
self.state.push(State::Value(Value::Null));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_bool(&mut self, value: bool) -> Result<(), ()> {
|
||||
self.state.push(State::Value(Value::Bool(value)));
|
||||
@@ -158,6 +152,22 @@ impl ser::Visitor for Serializer {
|
||||
value.visit(self)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_unit(&mut self) -> Result<(), ()> {
|
||||
self.state.push(State::Value(Value::Null));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_unit(&mut self, _name: &str, variant: &str) -> Result<(), ()> {
|
||||
let mut values = BTreeMap::new();
|
||||
values.insert(variant.to_string(), Value::Array(vec![]));
|
||||
|
||||
self.state.push(State::Value(Value::Object(values)));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_seq<V>(&mut self, mut visitor: V) -> Result<(), ()>
|
||||
where V: ser::SeqVisitor,
|
||||
|
||||
@@ -346,7 +346,6 @@ fn test_write_tuple() {
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
#[test]
|
||||
fn test_write_enum() {
|
||||
test_encode_ok(&[
|
||||
@@ -408,6 +407,7 @@ fn test_write_enum() {
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
#[test]
|
||||
fn test_write_option() {
|
||||
test_encode_ok(&[
|
||||
|
||||
Reference in New Issue
Block a user