summaryrefslogtreecommitdiff
path: root/serde_dhall/tests
diff options
context:
space:
mode:
authorNadrieril2020-10-28 23:21:19 +0000
committerNadrieril2020-10-28 23:21:19 +0000
commit93ed3cf67c49bf7016b8b1780d873cfdffcb84c5 (patch)
treeef2890f1cd079acbb1e559ab9d4ba887ff39ce0b /serde_dhall/tests
parent48bb9c03b0ace9efa33315e06c47a868e5c4ed36 (diff)
Implement SimpleValue serialization
Diffstat (limited to 'serde_dhall/tests')
-rw-r--r--serde_dhall/tests/simple_value.rs31
1 files changed, 16 insertions, 15 deletions
diff --git a/serde_dhall/tests/simple_value.rs b/serde_dhall/tests/simple_value.rs
index d2792d4..3bd9d64 100644
--- a/serde_dhall/tests/simple_value.rs
+++ b/serde_dhall/tests/simple_value.rs
@@ -31,27 +31,28 @@ mod simple_value {
fn test_serde() {
let bool_true = SimpleValue::Num(NumKind::Bool(true));
// https://github.com/Nadrieril/dhall-rust/issues/184
- // assert_serde("[ True ]", vec![bool_true.clone()]);
+ assert_serde("[True]", vec![bool_true.clone()]);
+
assert_de("< Foo >.Foo", SimpleValue::Union("Foo".into(), None));
assert_de(
"< Foo: Bool >.Foo True",
SimpleValue::Union("Foo".into(), Some(Box::new(bool_true.clone()))),
);
- // assert_eq!(
- // serialize(&SimpleValue::Optional(None)).to_string().map_err(|e| e.to_string()),
- // Err("cannot serialize value without a type annotation: Optional(None)".to_string())
- // );
+ assert_eq!(
+ serialize(&SimpleValue::Union("Foo".into(), None)).to_string().map_err(|e| e.to_string()),
+ Err("cannot serialize value without a type annotation: Union(\"Foo\", None)".to_string())
+ );
- // #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
- // struct Foo {
- // foo: SimpleValue,
- // }
- // assert_serde(
- // "{ foo = True }",
- // Foo {
- // foo: bool_true.clone(),
- // },
- // );
+ #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+ struct Foo {
+ foo: SimpleValue,
+ }
+ assert_serde(
+ "{ foo = True }",
+ Foo {
+ foo: bool_true.clone(),
+ },
+ );
}
}