diff options
Diffstat (limited to 'dhall/tests')
-rw-r--r-- | dhall/tests/dhall_type.rs | 24 |
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 >)); } |