tests for loading test json files
This commit is contained in:
@@ -46,8 +46,12 @@ impl Visitor for BytesVisitor {
|
||||
let v = match value.len() {
|
||||
0 => vec![],
|
||||
2 if value.starts_with("0x") => vec![],
|
||||
_ if value.starts_with("0x") => try!(FromHex::from_hex(&value[2..]).map_err(|_| Error::custom("Invalid hex value."))),
|
||||
_ => try!(FromHex::from_hex(value).map_err(|_| Error::custom("Invalid hex value")))
|
||||
_ if value.starts_with("0x") => try!(FromHex::from_hex(&value[2..]).map_err(|_| {
|
||||
Error::custom(format!("Invalid hex value {}.", value).as_ref())
|
||||
})),
|
||||
_ => try!(FromHex::from_hex(value).map_err(|_| {
|
||||
Error::custom(format!("Invalid hex value {}.", value).as_ref())
|
||||
}))
|
||||
};
|
||||
Ok(Bytes(v))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user