tests for loading test json files

This commit is contained in:
debris
2016-03-15 19:32:07 +01:00
parent b4849d1c58
commit 196c6e8ecc
7 changed files with 215 additions and 12 deletions

View File

@@ -47,8 +47,12 @@ impl Visitor for UintVisitor {
let value = match value.len() {
0 => U256::from(0),
2 if value.starts_with("0x") => U256::from(0),
_ if value.starts_with("0x") => try!(U256::from_str(&value[2..]).map_err(|_| Error::custom("invalid hex value."))),
_ => try!(U256::from_dec_str(value).map_err(|_| Error::custom("invalid decimal value.")))
_ if value.starts_with("0x") => try!(U256::from_str(&value[2..]).map_err(|_| {
Error::custom(format!("Invalid hex value {}.", value).as_ref())
})),
_ => try!(U256::from_dec_str(value).map_err(|_| {
Error::custom(format!("Invalid decimal value {}.", value).as_ref())
}))
};
Ok(Uint(value))