summaryrefslogtreecommitdiff
path: root/dhall/tests
diff options
context:
space:
mode:
authorNadrieril2019-03-21 22:08:23 +0100
committerNadrieril2019-03-21 22:08:23 +0100
commit4b99a3fb46191a83fa8551f21b98cff689bbb338 (patch)
tree0d07b39dbcf794c9fe1174aeb6fb4923df2fd9b7 /dhall/tests
parentea08d2528d2ee46446ac8981e72af5c610e43ce1 (diff)
Improve import handling in parser
Diffstat (limited to '')
-rw-r--r--dhall/tests/common/mod.rs13
-rw-r--r--dhall/tests/parser.rs2
2 files changed, 10 insertions, 5 deletions
diff --git a/dhall/tests/common/mod.rs b/dhall/tests/common/mod.rs
index ffc6d06..6b893e0 100644
--- a/dhall/tests/common/mod.rs
+++ b/dhall/tests/common/mod.rs
@@ -46,6 +46,12 @@ pub fn read_dhall_file<'i>(file_path: &str) -> Result<Expr<X, X>, DhallError> {
load_dhall_file(&PathBuf::from(file_path), true)
}
+pub fn read_dhall_file_no_resolve_imports<'i>(
+ file_path: &str,
+) -> Result<ParsedExpr, DhallError> {
+ load_dhall_file_no_resolve_imports(&PathBuf::from(file_path))
+}
+
pub fn run_test(base_path: &str, feature: Feature) {
use self::Feature::*;
let base_path_prefix = match feature {
@@ -61,7 +67,7 @@ pub fn run_test(base_path: &str, feature: Feature) {
ParserSuccess => {
let expr_file_path = base_path.clone() + "A.dhall";
let expected_file_path = base_path + "B.dhallb";
- let expr = read_dhall_file(&expr_file_path)
+ let expr = read_dhall_file_no_resolve_imports(&expr_file_path)
.map_err(|e| println!("{}", e))
.unwrap();
@@ -71,18 +77,17 @@ pub fn run_test(base_path: &str, feature: Feature) {
let mut data = Vec::new();
file.read_to_end(&mut data).unwrap();
let expected = dhall::binary::decode(&data).unwrap();
- let expected = dhall::imports::panic_imports(&expected);
assert_eq_pretty!(expr, expected);
// Round-trip pretty-printer
let expr = parse_expr(&expr.to_string()).unwrap();
- let expr = dhall::imports::panic_imports(&expr);
assert_eq!(expr, expected);
}
ParserFailure => {
let file_path = base_path + ".dhall";
- let err = read_dhall_file(&file_path).unwrap_err();
+ let err =
+ read_dhall_file_no_resolve_imports(&file_path).unwrap_err();
match err {
DhallError::ParseError(_) => {}
e => panic!("Expected parse error, got: {:?}", e),
diff --git a/dhall/tests/parser.rs b/dhall/tests/parser.rs
index 4fa0ff7..79a059d 100644
--- a/dhall/tests/parser.rs
+++ b/dhall/tests/parser.rs
@@ -17,7 +17,7 @@ parser_success!(spec_parser_success_annotations, "annotations");
// parser_success!(spec_parser_success_asText, "asText");
parser_success!(spec_parser_success_blockComment, "blockComment");
parser_success!(spec_parser_success_builtins, "builtins");
-// parser_success!(spec_parser_success_collectionImportType, "collectionImportType");
+parser_success!(spec_parser_success_collectionImportType, "collectionImportType");
parser_success!(spec_parser_success_double, "double");
parser_success!(spec_parser_success_doubleQuotedString, "doubleQuotedString");
// parser_success!(spec_parser_success_environmentVariables, "environmentVariables");