diff options
author | Nadrieril | 2020-10-28 21:45:42 +0000 |
---|---|---|
committer | Nadrieril | 2020-10-28 22:52:41 +0000 |
commit | 3b728aff86a086f71f013b77a715c33748d9f6a8 (patch) | |
tree | 7c1ceba27495481b766b4ea84601d7381530f5c2 /serde_dhall/tests/de.rs | |
parent | e070270c3f1f10d46281ed7751ff95e15092e7f4 (diff) |
Make type annotation optional to allow serializing SimpleValue
Diffstat (limited to 'serde_dhall/tests/de.rs')
-rw-r--r-- | serde_dhall/tests/de.rs | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/serde_dhall/tests/de.rs b/serde_dhall/tests/de.rs index 0b43de2..f49bee4 100644 --- a/serde_dhall/tests/de.rs +++ b/serde_dhall/tests/de.rs @@ -1,5 +1,5 @@ use serde::Deserialize; -use serde_dhall::{from_str, FromDhall, NumKind, SimpleValue}; +use serde_dhall::{from_str, FromDhall}; #[test] fn test_de_untyped() { @@ -57,37 +57,5 @@ fn test_de_untyped() { assert!(from_str("List/length [True, 42]").parse::<bool>().is_err()); } -#[test] -fn test_de_simplevalue() { - let bool_true = SimpleValue::Num(NumKind::Bool(true)); - // https://github.com/Nadrieril/dhall-rust/issues/184 - assert_eq!( - from_str("[ True ]").parse::<Vec<SimpleValue>>().unwrap(), - vec![bool_true.clone()] - ); - - assert_eq!( - from_str("< Foo >.Foo").parse::<SimpleValue>().unwrap(), - SimpleValue::Union("Foo".into(), None) - ); - assert_eq!( - from_str("< Foo: Bool >.Foo True") - .parse::<SimpleValue>() - .unwrap(), - SimpleValue::Union("Foo".into(), Some(Box::new(bool_true.clone()))) - ); - - #[derive(Debug, PartialEq, Eq, Deserialize)] - struct Foo { - foo: SimpleValue, - } - assert_eq!( - from_str("{ foo = True }").parse::<Foo>().unwrap(), - Foo { - foo: bool_true.clone() - }, - ); -} - // TODO: test various builder configurations // In particular test cloning and reusing builder |