Skip to content

Commit

Permalink
Adjust ron-rs#465 tests to lossless Value::Number
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed Aug 20, 2023
1 parent 22797ac commit c3af695
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions tests/465_r_name_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ fn value_deserialises_r_name() {
assert_eq!(ron::from_str("r()"), Ok(ron::Value::Seq(vec![])));
assert_eq!(
ron::from_str("r(42)"),
Ok(ron::Value::Seq(vec![ron::Value::Number(42.into())]))
Ok(ron::Value::Seq(vec![ron::Value::Number(
ron::value::Number::U8(42)
)]))
);
assert_eq!(
ron::from_str("r(a:42)"),
Ok(ron::Value::Map(
[(
ron::Value::String(String::from("a")),
ron::Value::Number(42.into())
ron::Value::Number(ron::value::Number::U8(42))
)]
.into_iter()
.collect()
Expand Down
8 changes: 4 additions & 4 deletions tests/465_unwrap_some_newtype_variant_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn deserialise_value_with_unwrap_some_newtype_variant() {
Ok(ron::Value::Option(Some(Box::new(ron::Value::Map(
[(
ron::Value::String(String::from("a")),
ron::Value::Number(42.into())
ron::Value::Number(ron::value::Number::U8(42))
)]
.into_iter()
.collect()
Expand All @@ -21,14 +21,14 @@ fn deserialise_value_with_unwrap_some_newtype_variant() {
assert_eq!(
ron::from_str("#![enable(unwrap_variant_newtypes)] Some(42, true)"),
Ok(ron::Value::Option(Some(Box::new(ron::Value::Seq(vec![
ron::Value::Number(42.into()),
ron::Value::Number(ron::value::Number::U8(42)),
ron::Value::Bool(true)
]))))),
);
assert_eq!(
ron::from_str("#![enable(unwrap_variant_newtypes)] Some(42,)"),
Ok(ron::Value::Option(Some(Box::new(ron::Value::Seq(vec![
ron::Value::Number(42.into())
ron::Value::Number(ron::value::Number::U8(42))
]))))),
);
assert_eq!(
Expand All @@ -38,7 +38,7 @@ fn deserialise_value_with_unwrap_some_newtype_variant() {
assert_eq!(
ron::from_str("#![enable(unwrap_variant_newtypes)] Some(42)"),
Ok(ron::Value::Option(Some(Box::new(ron::Value::Number(
42.into()
ron::value::Number::U8(42)
))))),
);
}

0 comments on commit c3af695

Please sign in to comment.