From 42d0f8100462f8a17a3ba1b86664310cdb71dfdc Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 6 Apr 2019 17:55:43 +0200 Subject: Rename some modules --- dhall/tests/dhall_type.rs | 53 ----------------------------------------------- dhall/tests/traits.rs | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 53 deletions(-) delete mode 100644 dhall/tests/dhall_type.rs create mode 100644 dhall/tests/traits.rs (limited to 'dhall/tests') diff --git a/dhall/tests/dhall_type.rs b/dhall/tests/dhall_type.rs deleted file mode 100644 index ac6b5e6..0000000 --- a/dhall/tests/dhall_type.rs +++ /dev/null @@ -1,53 +0,0 @@ -#![feature(proc_macro_hygiene)] -use dhall::StaticType; -use dhall_generator::dhall_expr; - -#[test] -fn test_dhall_type() { - assert_eq!(bool::get_type(), dhall_expr!(Bool)); - assert_eq!(String::get_type(), dhall_expr!(Text)); - assert_eq!( - <(bool, Option)>::get_type(), - dhall_expr!({ _1: Bool, _2: Optional Text }) - ); - - #[derive(dhall::StaticType)] - #[allow(dead_code)] - struct A { - field1: bool, - field2: Option, - } - assert_eq!( - ::get_type(), - dhall_expr!({ field1: Bool, field2: Optional Bool }) - ); - - #[derive(StaticType)] - #[allow(dead_code)] - struct B<'a, T: 'a> { - field1: &'a T, - field2: Option, - } - assert_eq!(>::get_type(), A::get_type()); - - #[derive(StaticType)] - #[allow(dead_code)] - struct C(T, Option); - assert_eq!(>::get_type(), <(bool, Option)>::get_type()); - - #[derive(StaticType)] - #[allow(dead_code)] - struct D(); - assert_eq!( - >::get_type(), - dhall_expr!({ _1: {}, _2: Optional Text }) - ); - - #[derive(StaticType)] - #[allow(dead_code)] - enum E { - A(T), - B(String), - }; - assert_eq!(>::get_type(), dhall_expr!(< A: Bool | B: Text >)); -} diff --git a/dhall/tests/traits.rs b/dhall/tests/traits.rs new file mode 100644 index 0000000..ac6b5e6 --- /dev/null +++ b/dhall/tests/traits.rs @@ -0,0 +1,53 @@ +#![feature(proc_macro_hygiene)] +use dhall::StaticType; +use dhall_generator::dhall_expr; + +#[test] +fn test_dhall_type() { + assert_eq!(bool::get_type(), dhall_expr!(Bool)); + assert_eq!(String::get_type(), dhall_expr!(Text)); + assert_eq!( + <(bool, Option)>::get_type(), + dhall_expr!({ _1: Bool, _2: Optional Text }) + ); + + #[derive(dhall::StaticType)] + #[allow(dead_code)] + struct A { + field1: bool, + field2: Option, + } + assert_eq!( + ::get_type(), + dhall_expr!({ field1: Bool, field2: Optional Bool }) + ); + + #[derive(StaticType)] + #[allow(dead_code)] + struct B<'a, T: 'a> { + field1: &'a T, + field2: Option, + } + assert_eq!(>::get_type(), A::get_type()); + + #[derive(StaticType)] + #[allow(dead_code)] + struct C(T, Option); + assert_eq!(>::get_type(), <(bool, Option)>::get_type()); + + #[derive(StaticType)] + #[allow(dead_code)] + struct D(); + assert_eq!( + >::get_type(), + dhall_expr!({ _1: {}, _2: Optional Text }) + ); + + #[derive(StaticType)] + #[allow(dead_code)] + enum E { + A(T), + B(String), + }; + assert_eq!(>::get_type(), dhall_expr!(< A: Bool | B: Text >)); +} -- cgit v1.2.3