summaryrefslogtreecommitdiff
path: root/dhall/src
diff options
context:
space:
mode:
authorNadrieril2020-03-01 15:36:44 +0000
committerNadrieril2020-03-05 15:58:54 +0000
commite277fb2f7316fef5c20e7c485eeba1f14328d621 (patch)
treeb98f98219709bb0f72157ba489da9225707e04a8 /dhall/src
parent81ce30dde067ca0067fda32b1e0ade1dbdfbdf58 (diff)
Run tests from repo root as specified in spec
Diffstat (limited to 'dhall/src')
-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(())
}