diff options
author | Nadrieril | 2019-04-06 20:04:04 +0200 |
---|---|---|
committer | Nadrieril | 2019-04-06 20:13:22 +0200 |
commit | 396ec334bac1e8d10a2d2b2d683c93e3b2ff4d8d (patch) | |
tree | 53503ab8fa9fa90cfc440ff06f4942bc74ade27f /dhall/tests | |
parent | 366bc783e62682c9597e8caba1dac56638d34fa9 (diff) |
Massage import loading into new API
Closes #9
Diffstat (limited to 'dhall/tests')
-rw-r--r-- | dhall/tests/common/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/dhall/tests/common/mod.rs b/dhall/tests/common/mod.rs index e748cf0..70b7d81 100644 --- a/dhall/tests/common/mod.rs +++ b/dhall/tests/common/mod.rs @@ -54,6 +54,12 @@ pub fn read_dhall_file_no_resolve_imports<'i>( load_dhall_file_no_resolve_imports(&PathBuf::from(file_path)) } +pub fn load_from_file_str<'i>( + file_path: &str, +) -> Result<dhall::Parsed, ImportError> { + load_from_file(&PathBuf::from(file_path)) +} + pub fn run_test(base_path: &str, feature: Feature) { use self::Feature::*; let base_path_prefix = match feature { @@ -90,8 +96,7 @@ pub fn run_test(base_path: &str, feature: Feature) { } ParserFailure => { let file_path = base_path + ".dhall"; - let err = - read_dhall_file_no_resolve_imports(&file_path).unwrap_err(); + let err = load_from_file_str(&file_path).unwrap_err(); match err { ImportError::ParseError(_) => {} e => panic!("Expected parse error, got: {:?}", e), |