summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
Diffstat (limited to 'dhall')
-rw-r--r--dhall/build.rs42
-rw-r--r--dhall/src/lib.rs1
-rw-r--r--dhall/src/phase/resolve.rs47
-rw-r--r--dhall/src/tests.rs31
4 files changed, 57 insertions, 64 deletions
diff --git a/dhall/build.rs b/dhall/build.rs
index b7ed6ca..c7d339c 100644
--- a/dhall/build.rs
+++ b/dhall/build.rs
@@ -241,6 +241,48 @@ fn main() -> std::io::Result<()> {
make_test_module(
&mut file,
TestFeature {
+ module_name: "import_success",
+ directory: spec_tests_dir.join("import/success/"),
+ variant: "ImportSuccess",
+ path_filter: |path: &str| {
+ false
+ || path == "alternativeEnvNatural"
+ || path == "alternativeEnvSimple"
+ || path == "alternativeHashMismatch"
+ || path == "asLocation"
+ || path == "asText"
+ || path == "customHeaders"
+ || path == "hashFromCache"
+ || path == "headerForwarding"
+ || path == "noHeaderForwarding"
+ },
+ input_type: FileType::Text,
+ output_type: Some(FileType::Text),
+ },
+ )?;
+
+ make_test_module(
+ &mut file,
+ TestFeature {
+ module_name: "import_failure",
+ directory: spec_tests_dir.join("import/failure/"),
+ variant: "ImportFailure",
+ path_filter: |path: &str| {
+ false
+ || path == "alternativeEnv"
+ || path == "alternativeEnvMissing"
+ || path == "hashMismatch"
+ || path == "missing"
+ || path == "referentiallyInsane"
+ },
+ input_type: FileType::Text,
+ output_type: None,
+ },
+ )?;
+
+ make_test_module(
+ &mut file,
+ TestFeature {
module_name: "beta_normalize",
directory: spec_tests_dir.join("normalization/success/"),
variant: "Normalization",
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs
index 0a430e4..9656612 100644
--- a/dhall/src/lib.rs
+++ b/dhall/src/lib.rs
@@ -11,7 +11,6 @@
clippy::ptr_arg
)]
-#[macro_use]
mod tests;
pub mod core;
diff --git a/dhall/src/phase/resolve.rs b/dhall/src/phase/resolve.rs
index c5f2ac8..c302bfa 100644
--- a/dhall/src/phase/resolve.rs
+++ b/dhall/src/phase/resolve.rs
@@ -178,50 +178,3 @@ impl<SE: Copy> Canonicalize for ImportLocation<SE> {
}
}
}
-
-#[cfg(test)]
-#[rustfmt::skip]
-mod spec_tests {
- macro_rules! import_success {
- ($name:ident, $path:expr) => {
- make_spec_test!(
- ImportSuccess(
- &("../dhall-lang/tests/import/success/".to_owned() + $path + "A.dhall"),
- &("../dhall-lang/tests/import/success/".to_owned() + $path + "B.dhall")
- ),
- $name
- );
- };
- }
-
- // macro_rules! import_failure {
- // ($name:ident, $path:expr) => {
- // make_spec_test!(
- // ImportFailure(&("../dhall-lang/tests/import/failure/".to_owned() + $path + ".dhall")),
- // $name
- // );
- // };
- // }
-
- // import_success!(success_alternativeEnvNatural, "alternativeEnvNatural");
- // import_success!(success_alternativeEnvSimple, "alternativeEnvSimple");
- // import_success!(success_alternativeHashMismatch, "alternativeHashMismatch");
- import_success!(success_alternativeNatural, "alternativeNatural");
- import_success!(success_alternativeParseError, "alternativeParseError");
- import_success!(success_alternativeTypeError, "alternativeTypeError");
- // import_success!(success_asLocation, "asLocation");
- // import_success!(success_asText, "asText");
- // import_success!(success_customHeaders, "customHeaders");
- import_success!(success_fieldOrder, "fieldOrder");
- // note: this one needs special setup with env variables
- // import_success!(success_hashFromCache, "hashFromCache");
- // import_success!(success_headerForwarding, "headerForwarding");
- // import_success!(success_nestedHash, "nestedHash");
- // import_success!(success_noHeaderForwarding, "noHeaderForwarding");
- // import_failure!(failure_alternativeEnv, "alternativeEnv");
- // import_failure!(failure_alternativeEnvMissing, "alternativeEnvMissing");
- // import_failure!(failure_cycle, "cycle");
- // import_failure!(failure_hashMismatch, "hashMismatch");
- // import_failure!(failure_missing, "missing");
- // import_failure!(failure_referentiallyInsane, "referentiallyInsane");
-}
diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs
index 80994d1..b98489f 100644
--- a/dhall/src/tests.rs
+++ b/dhall/src/tests.rs
@@ -20,22 +20,6 @@ right: `{}`"#,
}};
}
-#[macro_export]
-macro_rules! make_spec_test {
- ($type:expr, $name:ident) => {
- #[test]
- #[allow(non_snake_case)]
- fn $name() {
- use crate::tests::Test::*;
- use crate::tests::*;
- match run_test_stringy_error($type) {
- Ok(_) => {}
- Err(s) => panic!(s),
- }
- }
- };
-}
-
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
@@ -200,6 +184,21 @@ pub fn run_test(test: Test<'_>) -> Result<()> {
#[cfg(test)]
mod spec {
+ macro_rules! make_spec_test {
+ ($type:expr, $name:ident) => {
+ #[test]
+ #[allow(non_snake_case)]
+ fn $name() {
+ use crate::tests::Test::*;
+ use crate::tests::*;
+ match run_test_stringy_error($type) {
+ Ok(_) => {}
+ Err(s) => panic!(s),
+ }
+ }
+ };
+ }
+
// See build.rs
include!(concat!(env!("OUT_DIR"), "/spec_tests.rs"));
}