From 173e0eb15b33342ec7c3523be0f913a962e7b85a Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 26 Mar 2019 23:28:34 +0100 Subject: Derive DhallType for anonymous structs and enums --- dhall/tests/dhall_type.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'dhall/tests') 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, } assert_eq!(>::dhall_type(), A::dhall_type()); + + #[derive(DhallType)] + #[allow(dead_code)] + struct C(T, Option); + assert_eq!( + >::dhall_type(), + <(bool, Option)>::dhall_type() + ); + + #[derive(DhallType)] + #[allow(dead_code)] + struct D(); + assert_eq!( + >::dhall_type(), + dhall_expr!({ _1: {}, _2: Optional Text }) + ); + + #[derive(DhallType)] + #[allow(dead_code)] + enum E { + A(T), + B(String), + }; + assert_eq!(>::dhall_type(), dhall_expr!(< A: Bool | B: Text >)); } -- cgit v1.2.3