From d3f54e5536cc4d2ba46b6e4e88b7218da1b797ee Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 8 Aug 2019 23:09:37 +0200 Subject: Remove dhall::expr!() macro It's a lot of hassle for not a lot of benefit --- dhall/tests/traits.rs | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'dhall/tests') diff --git a/dhall/tests/traits.rs b/dhall/tests/traits.rs index 75eaf75..0f75553 100644 --- a/dhall/tests/traits.rs +++ b/dhall/tests/traits.rs @@ -1,23 +1,18 @@ #![feature(proc_macro_hygiene)] -use dhall::de::{StaticType, Type}; -use dhall_proc_macros::subexpr; -use dhall_syntax::{SubExpr, X}; +use dhall::de::{from_str, StaticType, Type}; #[test] fn test_static_type() { - fn mktype(x: SubExpr) -> Type { - Type::from_normalized_expr(x) + fn parse(s: &str) -> Type { + from_str(s, None).unwrap() } - assert_eq!(bool::static_type(), mktype(subexpr!(Bool))); - assert_eq!(String::static_type(), mktype(subexpr!(Text))); - assert_eq!( - >::static_type(), - mktype(subexpr!(Optional Bool)) - ); + assert_eq!(bool::static_type(), parse("Bool")); + assert_eq!(String::static_type(), parse("Text")); + assert_eq!(>::static_type(), parse("Optional Bool")); assert_eq!( <(bool, Vec)>::static_type(), - mktype(subexpr!({ _1: Bool, _2: List Text })) + parse("{ _1: Bool, _2: List Text }") ); #[derive(dhall::de::StaticType)] @@ -28,7 +23,7 @@ fn test_static_type() { } assert_eq!( ::static_type(), - mktype(subexpr!({ field1: Bool, field2: Optional Bool })) + parse("{ field1: Bool, field2: Optional Bool }") ); #[derive(StaticType)] @@ -52,7 +47,7 @@ fn test_static_type() { struct D(); assert_eq!( >::static_type(), - mktype(subexpr!({ _1: {}, _2: Optional Text })) + parse("{ _1: {}, _2: Optional Text }") ); #[derive(StaticType)] @@ -61,10 +56,7 @@ fn test_static_type() { A(T), B(String), }; - assert_eq!( - >::static_type(), - mktype(subexpr!(< A: Bool | B: Text >)) - ); + assert_eq!(>::static_type(), parse("< A: Bool | B: Text >")); #[derive(StaticType)] #[allow(dead_code)] @@ -72,5 +64,5 @@ fn test_static_type() { A, B(bool), }; - assert_eq!(F::static_type(), mktype(subexpr!(< A | B: Bool >))); + assert_eq!(F::static_type(), parse("< A | B: Bool >")); } -- cgit v1.2.3