summaryrefslogtreecommitdiff
path: root/dhall/src/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/tests.rs')
-rw-r--r--dhall/src/tests.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs
index 482f9ae..3649f8d 100644
--- a/dhall/src/tests.rs
+++ b/dhall/src/tests.rs
@@ -80,7 +80,7 @@ impl TestFile {
match self {
TestFile::Source(path)
| TestFile::Binary(path)
- | TestFile::UI(path) => PathBuf::from(path),
+ | TestFile::UI(path) => PathBuf::from("dhall").join(path),
}
}
@@ -243,6 +243,11 @@ fn run_test_stringy_error(test: Test) -> std::result::Result<(), String> {
fn run_test(test: Test) -> Result<()> {
use self::Test::*;
+ // Setup current directory to the root of the repository. Important for import tests.
+ env::set_current_dir(
+ PathBuf::from(env!("CARGO_MANIFEST_DIR")).parent().unwrap(),
+ )?;
+
match test {
ParserSuccess(expr, expected) => {
let expr = expr.parse()?;
@@ -302,6 +307,7 @@ fn run_test(test: Test) -> Result<()> {
expected.compare(expr)?;
}
}
+
Ok(())
}