summaryrefslogtreecommitdiff
path: root/dhall/src
diff options
context:
space:
mode:
authorNadrieril2019-04-13 19:31:50 +0200
committerNadrieril2019-04-13 19:31:50 +0200
commitbbc09d65ce206d78ac7b8cfc32cc5ed4dec5fbfe (patch)
treeb3f55579ba8d627ce17cabd45045ba5cfdd6f7ce /dhall/src
parent99f379f6bc319f1055a72521493caa554d515e65 (diff)
Improve error display on test failure
Diffstat (limited to '')
-rw-r--r--dhall/src/tests.rs30
1 files changed, 20 insertions, 10 deletions
diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs
index 57d3deb..4343341 100644
--- a/dhall/src/tests.rs
+++ b/dhall/src/tests.rs
@@ -24,16 +24,7 @@ macro_rules! make_spec_test {
#[allow(non_snake_case)]
fn $name() {
use crate::tests::*;
- // Many tests stack overflow in debug mode
- std::thread::Builder::new()
- .stack_size(4 * 1024 * 1024)
- .spawn(|| {
- run_test($path, Feature::$type, Status::$status)
- .map_err(|e| println!("{}", e))
- .unwrap();
- })
- .unwrap()
- .join()
+ run_test_with_bigger_stack($path, Feature::$type, Status::$status)
.unwrap();
}
};
@@ -66,6 +57,25 @@ fn parse_binary_file_str<'i>(file_path: &str) -> Result<Parsed> {
Parsed::parse_binary_file(&PathBuf::from(file_path))
}
+pub fn run_test_with_bigger_stack(
+ base_path: &str,
+ feature: Feature,
+ status: Status,
+) -> std::result::Result<(), String> {
+ // Many tests stack overflow in debug mode
+ let base_path: String = base_path.to_string();
+ std::thread::Builder::new()
+ .stack_size(4 * 1024 * 1024)
+ .spawn(move || {
+ run_test(&base_path, feature, status)
+ .map_err(|e| e.to_string())
+ .map(|_| ())
+ })
+ .unwrap()
+ .join()
+ .unwrap()
+}
+
pub fn run_test(
base_path: &str,
feature: Feature,