summaryrefslogtreecommitdiff
path: root/dhall/tests
diff options
context:
space:
mode:
authorNadrieril2019-03-06 00:51:20 +0100
committerNadrieril2019-03-06 00:51:20 +0100
commit5b32c5bdea80a0bdf19240f3cc2b8e2ae251d51a (patch)
treef537653914e5221103fcd45214087f58e10dfe34 /dhall/tests
parentdf245c316029f5b3037c14514bd3535613f26222 (diff)
rustfmt
Diffstat (limited to 'dhall/tests')
-rw-r--r--dhall/tests/macros.rs55
1 files changed, 35 insertions, 20 deletions
diff --git a/dhall/tests/macros.rs b/dhall/tests/macros.rs
index 131683b..66b9dbf 100644
--- a/dhall/tests/macros.rs
+++ b/dhall/tests/macros.rs
@@ -1,27 +1,34 @@
#[macro_export]
macro_rules! include_test_str {
- ($x:expr) => { include_str!(concat!("../../dhall-lang/tests/", $x, ".dhall")) };
+ ($x:expr) => {
+ include_str!(concat!("../../dhall-lang/tests/", $x, ".dhall"))
+ };
}
#[macro_export]
macro_rules! include_test_strs_ab {
- ($x:expr) => { (include_test_str!(concat!($x, "A")), include_test_str!(concat!($x, "B"))) };
+ ($x:expr) => {
+ (
+ include_test_str!(concat!($x, "A")),
+ include_test_str!(concat!($x, "B")),
+ )
+ };
}
#[macro_export]
macro_rules! parse_str {
- ($str:expr) => {
- {
- let pest_expr = parser::parse_expr_pest(&$str).map_err(|e| println!("{}", e)).unwrap();
- // // Check with old parser
- // match parser::parse_expr_lalrpop(&$str) {
- // Ok(larlpop_expr) => assert_eq!(pest_expr, larlpop_expr),
- // Err(_) => {},
- // };
- // panic!("{:?}", pest_expr);
- pest_expr
- }
- };
+ ($str:expr) => {{
+ let pest_expr = parser::parse_expr_pest(&$str)
+ .map_err(|e| println!("{}", e))
+ .unwrap();
+ // // Check with old parser
+ // match parser::parse_expr_lalrpop(&$str) {
+ // Ok(larlpop_expr) => assert_eq!(pest_expr, larlpop_expr),
+ // Err(_) => {},
+ // };
+ // panic!("{:?}", pest_expr);
+ pest_expr
+ }};
}
#[macro_export]
@@ -60,7 +67,10 @@ macro_rules! run_spec_test {
let (expr_str, expected_str) = include_test_strs_ab!($path);
let expr = parse_str!(expr_str);
let expected = parse_str!(expected_str);
- assert_eq_!(normalize::<_, X, _>(&expr), normalize::<_, X, _>(&expected));
+ assert_eq_!(
+ normalize::<_, X, _>(&expr),
+ normalize::<_, X, _>(&expected)
+ );
};
(parser, $path:expr) => {
let expr_str = include_test_str!(concat!($path, "A"));
@@ -79,13 +89,18 @@ macro_rules! make_spec_test {
#[allow(non_snake_case)]
#[allow(unused_variables)]
#[allow(unused_imports)]
- fn $name(){
- use std::thread;
+ fn $name() {
use dhall::*;
+ use std::thread;
- thread::Builder::new().stack_size(16 * 1024 * 1024).spawn(move || {
- run_spec_test!($type, $path);
- }).unwrap().join().unwrap();
+ thread::Builder::new()
+ .stack_size(16 * 1024 * 1024)
+ .spawn(move || {
+ run_spec_test!($type, $path);
+ })
+ .unwrap()
+ .join()
+ .unwrap();
}
};
}