summaryrefslogtreecommitdiff
path: root/dhall/tests
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/tests')
-rw-r--r--dhall/tests/dhall_type.rs37
1 files changed, 27 insertions, 10 deletions
diff --git a/dhall/tests/dhall_type.rs b/dhall/tests/dhall_type.rs
index cbb71a4..0e27ad0 100644
--- a/dhall/tests/dhall_type.rs
+++ b/dhall/tests/dhall_type.rs
@@ -1,15 +1,32 @@
#![feature(proc_macro_hygiene)]
-use dhall_core::*;
+use dhall::*;
use dhall_generator::*;
-#[derive(DhallType)]
-struct A {
- _field1: bool,
- // field2: Option<bool>,
-}
-
#[test]
-fn test_dhall_type_a() {
- assert_eq!(A::dhall_type(), dhall_expr!(False));
- // assert_eq!(A::dhall_type(), dhall_expr!({ field1: Bool }));
+fn test_dhall_type() {
+ assert_eq!(bool::dhall_type(), dhall_expr!(Bool));
+ assert_eq!(String::dhall_type(), dhall_expr!(Text));
+ assert_eq!(
+ <(bool, Option<String>)>::dhall_type(),
+ dhall_expr!({ _1: Bool, _2: Optional Text })
+ );
+
+ #[derive(DhallType)]
+ #[allow(dead_code)]
+ struct A {
+ field1: bool,
+ field2: Option<bool>,
+ }
+ assert_eq!(
+ A::dhall_type(),
+ dhall_expr!({ field1: Bool, field2: Optional Bool })
+ );
+
+ #[derive(DhallType)]
+ #[allow(dead_code)]
+ struct B<'a, T: 'a> {
+ field1: &'a T,
+ field2: Option<T>,
+ }
+ assert_eq!(<B<'static, bool>>::dhall_type(), A::dhall_type());
}