summaryrefslogtreecommitdiff
path: root/dhall/tests
diff options
context:
space:
mode:
authorNadrieril2019-08-08 23:09:37 +0200
committerNadrieril2019-08-10 23:15:47 +0200
commitd3f54e5536cc4d2ba46b6e4e88b7218da1b797ee (patch)
tree6f8e826b21983a897e5bc89ab0e3b060c5dc7b61 /dhall/tests
parent5e790ea6bafcf6c77165bdd580814783991acb7f (diff)
Remove dhall::expr!() macro
It's a lot of hassle for not a lot of benefit
Diffstat (limited to 'dhall/tests')
-rw-r--r--dhall/tests/traits.rs30
1 files changed, 11 insertions, 19 deletions
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<X, X>) -> 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!(
- <Option<bool>>::static_type(),
- mktype(subexpr!(Optional Bool))
- );
+ assert_eq!(bool::static_type(), parse("Bool"));
+ assert_eq!(String::static_type(), parse("Text"));
+ assert_eq!(<Option<bool>>::static_type(), parse("Optional Bool"));
assert_eq!(
<(bool, Vec<String>)>::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!(
<A as dhall::de::StaticType>::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!(
<C<D>>::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!(
- <E<bool>>::static_type(),
- mktype(subexpr!(< A: Bool | B: Text >))
- );
+ assert_eq!(<E<bool>>::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 >"));
}