summaryrefslogtreecommitdiff
path: root/dhall/build.rs
diff options
context:
space:
mode:
authorNadrieril Feneanar2020-03-05 16:20:07 +0000
committerGitHub2020-03-05 16:20:07 +0000
commit3f9194f47185fe30c9e410aa7c5e651df9694b3f (patch)
tree6d24b2e824822134da4976b65b413dc09ca4e567 /dhall/build.rs
parent2ca97e97f1718141d826a78ab3da8197b2d55c69 (diff)
parent8e6b020ba1426c215382a81395b809b688fa7726 (diff)
Merge pull request #139 from Nadrieril/missing-features
Implement a bunch of missing features
Diffstat (limited to 'dhall/build.rs')
-rw-r--r--dhall/build.rs89
1 files changed, 47 insertions, 42 deletions
diff --git a/dhall/build.rs b/dhall/build.rs
index d9bceeb..4b6e52b 100644
--- a/dhall/build.rs
+++ b/dhall/build.rs
@@ -77,8 +77,10 @@ struct TestFeature {
directory: &'static str,
/// Relevant variant of `dhall::tests::Test`
variant: &'static str,
+ /// Given a file name, whether to only include it in release tests
+ too_slow_path: Box<dyn FnMut(&str) -> bool>,
/// Given a file name, whether to exclude it
- path_filter: Box<dyn FnMut(&str) -> bool>,
+ exclude_path: Box<dyn FnMut(&str) -> bool>,
/// Type of the input file
input_type: FileType,
/// Type of the output file, if any
@@ -98,9 +100,12 @@ fn make_test_module(
for (name, path) in
dhall_files_in_dir(&tests_dir, take_ab_suffix, feature.input_type)
{
- if (feature.path_filter)(&path) {
+ if (feature.exclude_path)(&path) {
continue;
}
+ if (feature.too_slow_path)(&path) {
+ writeln!(w, "#[cfg(not(debug_assertions))]")?;
+ }
let path = tests_dir.join(path);
let path = path.to_string_lossy();
let test = match feature.output_type {
@@ -152,10 +157,9 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "parser_success",
directory: "parser/success/",
variant: "ParserSuccess",
- path_filter: Box::new(|path: &str| {
+ too_slow_path: Box::new(|path: &str| path == "largeExpression"),
+ exclude_path: Box::new(|path: &str| {
false
- // Too slow in debug mode
- || path == "largeExpression"
// Pretty sure the test is incorrect
|| path == "unit/import/urls/quotedPathFakeUrlEncode"
// TODO: RFC3986 URLs
@@ -171,7 +175,8 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "parser_failure",
directory: "parser/failure/",
variant: "ParserFailure",
- path_filter: Box::new(|_path: &str| false),
+ too_slow_path: Box::new(|_path: &str| false),
+ exclude_path: Box::new(|_path: &str| false),
input_type: FileType::Text,
output_type: Some(FileType::UI),
},
@@ -179,10 +184,9 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "printer",
directory: "parser/success/",
variant: "Printer",
- path_filter: Box::new(|path: &str| {
+ too_slow_path: Box::new(|path: &str| path == "largeExpression"),
+ exclude_path: Box::new(|path: &str| {
false
- // Too slow in debug mode
- || path == "largeExpression"
// TODO: RFC3986 URLs
|| path == "unit/import/urls/emptyPath0"
|| path == "unit/import/urls/emptyPath1"
@@ -196,10 +200,9 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "binary_encoding",
directory: "parser/success/",
variant: "BinaryEncoding",
- path_filter: Box::new(|path: &str| {
+ too_slow_path: Box::new(|path: &str| path == "largeExpression"),
+ exclude_path: Box::new(|path: &str| {
false
- // Too slow in debug mode
- || path == "largeExpression"
// Pretty sure the test is incorrect
|| path == "unit/import/urls/quotedPathFakeUrlEncode"
// See https://github.com/pyfisch/cbor/issues/109
@@ -219,7 +222,8 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "binary_decoding_success",
directory: "binary-decode/success/",
variant: "BinaryDecodingSuccess",
- path_filter: Box::new(|path: &str| {
+ too_slow_path: Box::new(|_path: &str| false),
+ exclude_path: Box::new(|path: &str| {
false
// We don't support bignums
|| path == "unit/IntegerBigNegative"
@@ -233,7 +237,8 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "binary_decoding_failure",
directory: "binary-decode/failure/",
variant: "BinaryDecodingFailure",
- path_filter: Box::new(|_path: &str| false),
+ too_slow_path: Box::new(|_path: &str| false),
+ exclude_path: Box::new(|_path: &str| false),
input_type: FileType::Binary,
output_type: Some(FileType::UI),
},
@@ -241,15 +246,19 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "import_success",
directory: "import/success/",
variant: "ImportSuccess",
- path_filter: Box::new(|path: &str| {
+ too_slow_path: Box::new(|_path: &str| false),
+ exclude_path: Box::new(|path: &str| {
false
- || path == "alternativeEnvNatural"
- || path == "alternativeEnvSimple"
+ // TODO: import hash
|| path == "alternativeHashMismatch"
+ || path == "hashFromCache"
+ || path == "unit/AlternativeHashMismatch"
+ // TODO: This test is wrong
|| path == "asLocation"
- || path == "asText"
+ // TODO: the standard does not respect https://tools.ietf.org/html/rfc3986#section-5.2
+ || path == "unit/asLocation/RemoteCanonicalize4"
+ // TODO: import headers
|| path == "customHeaders"
- || path == "hashFromCache"
|| path == "headerForwarding"
|| path == "noHeaderForwarding"
}),
@@ -260,13 +269,12 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "import_failure",
directory: "import/failure/",
variant: "ImportFailure",
- path_filter: Box::new(|path: &str| {
+ too_slow_path: Box::new(|_path: &str| false),
+ exclude_path: Box::new(|path: &str| {
false
- || path == "alternativeEnv"
- || path == "alternativeEnvMissing"
+ // TODO: import hash
|| path == "hashMismatch"
- || path == "missing"
- || path == "referentiallyInsane"
+ // TODO: import headers
|| path == "customHeadersUsingBoundVariable"
}),
input_type: FileType::Text,
@@ -276,25 +284,18 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "beta_normalize",
directory: "normalization/success/",
variant: "Normalization",
- path_filter: Box::new(|path: &str| {
- // We don't support bignums
- path == "simple/integerToDouble"
- // Too slow
- || path == "remoteSystems"
+ too_slow_path: Box::new(|path: &str| path == "remoteSystems"),
+ exclude_path: Box::new(|path: &str| {
+ false
+ // We don't support bignums
+ || path == "simple/integerToDouble"
// TODO: fix Double/show
|| path == "prelude/JSON/number/1"
// TODO: doesn't typecheck
|| path == "unit/RightBiasedRecordMergeWithinRecordProjection"
|| path == "unit/Sort"
- // // TODO: Further record simplifications
- || path == "simplifications/rightBiasedMergeWithinRecordProjectionWithinFieldSelection0"
- || path == "simplifications/rightBiasedMergeWithinRecordProjectionWithinFieldSelection1"
- || path == "simplifications/rightBiasedMergeWithinRecursiveRecordMergeWithinFieldselection"
+ // TODO: Further record simplifications
|| path == "simplifications/issue661"
- || path == "unit/RecursiveRecordMergeWithinFieldSelection0"
- || path == "unit/RecursiveRecordMergeWithinFieldSelection1"
- || path == "unit/RecursiveRecordMergeWithinFieldSelection2"
- || path == "unit/RecursiveRecordMergeWithinFieldSelection3"
}),
input_type: FileType::Text,
output_type: Some(FileType::Text),
@@ -303,8 +304,9 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "alpha_normalize",
directory: "alpha-normalization/success/",
variant: "AlphaNormalization",
- path_filter: Box::new(|path: &str| {
- // This test doesn't typecheck
+ too_slow_path: Box::new(|_path: &str| false),
+ exclude_path: Box::new(|path: &str| {
+ // This test is designed to not typecheck
path == "unit/FunctionNestedBindingXXFree"
}),
input_type: FileType::Text,
@@ -314,9 +316,11 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "type_inference_success",
directory: "type-inference/success/",
variant: "TypeInferenceSuccess",
- path_filter: Box::new(|path: &str| {
+ too_slow_path: Box::new(|_path: &str| false),
+ exclude_path: Box::new(|path: &str| {
false
- // Too slow
+ // Too slow, but also not all features implemented
+ // For now needs support for hashed imports
|| path == "prelude"
}),
input_type: FileType::Text,
@@ -326,7 +330,8 @@ fn generate_tests() -> std::io::Result<()> {
module_name: "type_inference_failure",
directory: "type-inference/failure/",
variant: "TypeInferenceFailure",
- path_filter: Box::new(|path: &str| {
+ too_slow_path: Box::new(|_path: &str| false),
+ exclude_path: Box::new(|path: &str| {
false
// TODO: enable free variable checking
|| path == "unit/MergeHandlerFreeVar"