summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
authorNadrieril2019-03-26 23:28:34 +0100
committerNadrieril2019-03-26 23:56:26 +0100
commit173e0eb15b33342ec7c3523be0f913a962e7b85a (patch)
treea54201bd6fa01d045e73954510b0f3f2b060009f /dhall
parent23e12ffc4421414abbd089759dab9c50aefeac0c (diff)
Derive DhallType for anonymous structs and enums
Diffstat (limited to 'dhall')
-rw-r--r--dhall/tests/dhall_type.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/dhall/tests/dhall_type.rs b/dhall/tests/dhall_type.rs
index 0e27ad0..633d7c6 100644
--- a/dhall/tests/dhall_type.rs
+++ b/dhall/tests/dhall_type.rs
@@ -29,4 +29,28 @@ fn test_dhall_type() {
field2: Option<T>,
}
assert_eq!(<B<'static, bool>>::dhall_type(), A::dhall_type());
+
+ #[derive(DhallType)]
+ #[allow(dead_code)]
+ struct C<T>(T, Option<String>);
+ assert_eq!(
+ <C<bool>>::dhall_type(),
+ <(bool, Option<String>)>::dhall_type()
+ );
+
+ #[derive(DhallType)]
+ #[allow(dead_code)]
+ struct D();
+ assert_eq!(
+ <C<D>>::dhall_type(),
+ dhall_expr!({ _1: {}, _2: Optional Text })
+ );
+
+ #[derive(DhallType)]
+ #[allow(dead_code)]
+ enum E<T> {
+ A(T),
+ B(String),
+ };
+ assert_eq!(<E<bool>>::dhall_type(), dhall_expr!(< A: Bool | B: Text >));
}