diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | dhall/build.rs | 104 | ||||
-rw-r--r-- | dhall/src/phase/normalize.rs | 361 | ||||
-rw-r--r-- | dhall/src/phase/parse.rs | 7 | ||||
-rw-r--r-- | dhall/src/tests.rs | 5 |
5 files changed, 85 insertions, 394 deletions
@@ -15,7 +15,7 @@ This is still quite unstable so use at your own risk. Documentation is severely - Parsing: 100% - Imports: 10% -- Normalization: 99% +- Normalization: 100% - Typechecking: 83% You can see what's missing from the commented out tests in `dhall/src/normalize.rs` and `dhall/src/typecheck.rs`. diff --git a/dhall/build.rs b/dhall/build.rs index c258315..aa8cc92 100644 --- a/dhall/build.rs +++ b/dhall/build.rs @@ -5,7 +5,10 @@ use std::io::Write; use std::path::Path; use walkdir::WalkDir; -fn dhall_files_in_dir<'a>(dir: &'a Path) -> impl Iterator<Item = String> + 'a { +fn dhall_files_in_dir<'a>( + dir: &'a Path, + take_a_suffix: bool, +) -> impl Iterator<Item = (String, String)> + 'a { WalkDir::new(dir) .into_iter() .filter_map(|e| e.ok()) @@ -16,11 +19,53 @@ fn dhall_files_in_dir<'a>(dir: &'a Path) -> impl Iterator<Item = String> + 'a { return None; } let path = path.to_string_lossy(); - let path = path[..path.len() - 6].to_owned(); - Some(path) + let path = &path[..path.len() - 6]; + let path = if take_a_suffix { + if &path[path.len() - 1..] != "A" { + return None; + } else { + path[..path.len() - 1].to_owned() + } + } else { + path.to_owned() + }; + let name = path.replace("/", "_").replace("-", "_"); + Some((name, path)) }) } +fn make_test_module( + w: &mut impl Write, + mod_name: &str, + dir: &Path, + feature: &str, + mut exclude: impl FnMut(&str) -> bool, +) -> std::io::Result<()> { + writeln!(w, "mod {} {{", mod_name)?; + for (name, path) in dhall_files_in_dir(&dir.join("success/"), true) { + if exclude(&path) { + continue; + } + writeln!( + w, + r#"make_spec_test!({}, Success, success_{}, "{}");"#, + feature, name, path + )?; + } + for (name, path) in dhall_files_in_dir(&dir.join("failure/"), false) { + if exclude(&path) { + continue; + } + writeln!( + w, + r#"make_spec_test!({}, Failure, failure_{}, "{}");"#, + feature, name, path + )?; + } + writeln!(w, "}}")?; + Ok(()) +} + fn main() -> std::io::Result<()> { println!("cargo:rerun-if-changed=../dhall-lang/.git"); println!( @@ -29,31 +74,40 @@ fn main() -> std::io::Result<()> { let out_dir = env::var("OUT_DIR").unwrap(); let tests_dir = Path::new("../dhall-lang/tests/"); - let parser_tests_path = Path::new(&out_dir).join("parser_tests.rs"); + let parser_tests_path = Path::new(&out_dir).join("spec_tests.rs"); let mut file = File::create(parser_tests_path)?; - for path in dhall_files_in_dir(&tests_dir.join("parser/success/")) { - let path = &path[..path.len() - 1]; - let name = path.replace("/", "_"); - // Skip this test; parser is way too slow indebug mode - if name == "largeExpression" { - continue; - } - writeln!( - file, - r#"make_spec_test!(Parser, Success, success_{}, "{}");"#, - name, path - )?; - } + make_test_module( + &mut file, + "parse", + &tests_dir.join("parser/"), + "Parser", + |path| { + // Too slow in debug mode + path == "largeExpression" + }, + )?; - for path in dhall_files_in_dir(&tests_dir.join("parser/failure/")) { - let name = path.replace("/", "_"); - writeln!( - file, - r#"make_spec_test!(Parser, Failure, failure_{}, "{}");"#, - name, path - )?; - } + make_test_module( + &mut file, + "beta_normalize", + &tests_dir.join("normalization/"), + "Normalization", + |path| { + // We don't support bignums + path == "simple/integerToDouble" + // Too slow + || path == "remoteSystems" + }, + )?; + + make_test_module( + &mut file, + "alpha_normalize", + &tests_dir.join("alpha-normalization/"), + "AlphaNormalization", + |_| false, + )?; Ok(()) } diff --git a/dhall/src/phase/normalize.rs b/dhall/src/phase/normalize.rs index 589ec00..e4d4d57 100644 --- a/dhall/src/phase/normalize.rs +++ b/dhall/src/phase/normalize.rs @@ -693,364 +693,3 @@ pub(crate) fn normalize_one_layer(expr: ExprF<Thunk, Label, X>) -> Value { RetExpr(expr) => Value::PartialExpr(expr), } } - -#[cfg(test)] -mod spec_tests { - #![rustfmt::skip] - - macro_rules! norm { - ($name:ident, $path:expr) => { - make_spec_test!(Normalization, Success, $name, $path); - }; - } - - macro_rules! alpha_norm { - ($name:ident, $path:expr) => { - make_spec_test!(AlphaNormalization, Success, $name, $path); - }; - } - - norm!(success_haskell_tutorial_access_0, "haskell-tutorial/access/0"); - norm!(success_haskell_tutorial_access_1, "haskell-tutorial/access/1"); - norm!(success_haskell_tutorial_combineTypes_0, "haskell-tutorial/combineTypes/0"); - norm!(success_haskell_tutorial_combineTypes_1, "haskell-tutorial/combineTypes/1"); - norm!(success_haskell_tutorial_prefer_0, "haskell-tutorial/prefer/0"); - norm!(success_haskell_tutorial_projection_0, "haskell-tutorial/projection/0"); - - norm!(success_prelude_Bool_and_0, "prelude/Bool/and/0"); - norm!(success_prelude_Bool_and_1, "prelude/Bool/and/1"); - norm!(success_prelude_Bool_build_0, "prelude/Bool/build/0"); - norm!(success_prelude_Bool_build_1, "prelude/Bool/build/1"); - norm!(success_prelude_Bool_even_0, "prelude/Bool/even/0"); - norm!(success_prelude_Bool_even_1, "prelude/Bool/even/1"); - norm!(success_prelude_Bool_even_2, "prelude/Bool/even/2"); - norm!(success_prelude_Bool_even_3, "prelude/Bool/even/3"); - norm!(success_prelude_Bool_fold_0, "prelude/Bool/fold/0"); - norm!(success_prelude_Bool_fold_1, "prelude/Bool/fold/1"); - norm!(success_prelude_Bool_not_0, "prelude/Bool/not/0"); - norm!(success_prelude_Bool_not_1, "prelude/Bool/not/1"); - norm!(success_prelude_Bool_odd_0, "prelude/Bool/odd/0"); - norm!(success_prelude_Bool_odd_1, "prelude/Bool/odd/1"); - norm!(success_prelude_Bool_odd_2, "prelude/Bool/odd/2"); - norm!(success_prelude_Bool_odd_3, "prelude/Bool/odd/3"); - norm!(success_prelude_Bool_or_0, "prelude/Bool/or/0"); - norm!(success_prelude_Bool_or_1, "prelude/Bool/or/1"); - norm!(success_prelude_Bool_show_0, "prelude/Bool/show/0"); - norm!(success_prelude_Bool_show_1, "prelude/Bool/show/1"); - norm!(success_prelude_Double_show_0, "prelude/Double/show/0"); - norm!(success_prelude_Double_show_1, "prelude/Double/show/1"); - norm!(success_prelude_Integer_show_0, "prelude/Integer/show/0"); - norm!(success_prelude_Integer_show_1, "prelude/Integer/show/1"); - norm!(success_prelude_Integer_toDouble_0, "prelude/Integer/toDouble/0"); - norm!(success_prelude_Integer_toDouble_1, "prelude/Integer/toDouble/1"); - norm!(success_prelude_List_all_0, "prelude/List/all/0"); - norm!(success_prelude_List_all_1, "prelude/List/all/1"); - norm!(success_prelude_List_any_0, "prelude/List/any/0"); - norm!(success_prelude_List_any_1, "prelude/List/any/1"); - norm!(success_prelude_List_build_0, "prelude/List/build/0"); - norm!(success_prelude_List_build_1, "prelude/List/build/1"); - norm!(success_prelude_List_concat_0, "prelude/List/concat/0"); - norm!(success_prelude_List_concat_1, "prelude/List/concat/1"); - norm!(success_prelude_List_concatMap_0, "prelude/List/concatMap/0"); - norm!(success_prelude_List_concatMap_1, "prelude/List/concatMap/1"); - norm!(success_prelude_List_filter_0, "prelude/List/filter/0"); - norm!(success_prelude_List_filter_1, "prelude/List/filter/1"); - norm!(success_prelude_List_fold_0, "prelude/List/fold/0"); - norm!(success_prelude_List_fold_1, "prelude/List/fold/1"); - norm!(success_prelude_List_fold_2, "prelude/List/fold/2"); - norm!(success_prelude_List_generate_0, "prelude/List/generate/0"); - norm!(success_prelude_List_generate_1, "prelude/List/generate/1"); - norm!(success_prelude_List_head_0, "prelude/List/head/0"); - norm!(success_prelude_List_head_1, "prelude/List/head/1"); - norm!(success_prelude_List_indexed_0, "prelude/List/indexed/0"); - norm!(success_prelude_List_indexed_1, "prelude/List/indexed/1"); - norm!(success_prelude_List_iterate_0, "prelude/List/iterate/0"); - norm!(success_prelude_List_iterate_1, "prelude/List/iterate/1"); - norm!(success_prelude_List_last_0, "prelude/List/last/0"); - norm!(success_prelude_List_last_1, "prelude/List/last/1"); - norm!(success_prelude_List_length_0, "prelude/List/length/0"); - norm!(success_prelude_List_length_1, "prelude/List/length/1"); - norm!(success_prelude_List_map_0, "prelude/List/map/0"); - norm!(success_prelude_List_map_1, "prelude/List/map/1"); - norm!(success_prelude_List_null_0, "prelude/List/null/0"); - norm!(success_prelude_List_null_1, "prelude/List/null/1"); - norm!(success_prelude_List_replicate_0, "prelude/List/replicate/0"); - norm!(success_prelude_List_replicate_1, "prelude/List/replicate/1"); - norm!(success_prelude_List_reverse_0, "prelude/List/reverse/0"); - norm!(success_prelude_List_reverse_1, "prelude/List/reverse/1"); - norm!(success_prelude_List_shifted_0, "prelude/List/shifted/0"); - norm!(success_prelude_List_shifted_1, "prelude/List/shifted/1"); - norm!(success_prelude_List_unzip_0, "prelude/List/unzip/0"); - norm!(success_prelude_List_unzip_1, "prelude/List/unzip/1"); - norm!(success_prelude_Natural_build_0, "prelude/Natural/build/0"); - norm!(success_prelude_Natural_build_1, "prelude/Natural/build/1"); - norm!(success_prelude_Natural_enumerate_0, "prelude/Natural/enumerate/0"); - norm!(success_prelude_Natural_enumerate_1, "prelude/Natural/enumerate/1"); - norm!(success_prelude_Natural_even_0, "prelude/Natural/even/0"); - norm!(success_prelude_Natural_even_1, "prelude/Natural/even/1"); - norm!(success_prelude_Natural_fold_0, "prelude/Natural/fold/0"); - norm!(success_prelude_Natural_fold_1, "prelude/Natural/fold/1"); - norm!(success_prelude_Natural_fold_2, "prelude/Natural/fold/2"); - norm!(success_prelude_Natural_isZero_0, "prelude/Natural/isZero/0"); - norm!(success_prelude_Natural_isZero_1, "prelude/Natural/isZero/1"); - norm!(success_prelude_Natural_odd_0, "prelude/Natural/odd/0"); - norm!(success_prelude_Natural_odd_1, "prelude/Natural/odd/1"); - norm!(success_prelude_Natural_product_0, "prelude/Natural/product/0"); - norm!(success_prelude_Natural_product_1, "prelude/Natural/product/1"); - norm!(success_prelude_Natural_show_0, "prelude/Natural/show/0"); - norm!(success_prelude_Natural_show_1, "prelude/Natural/show/1"); - norm!(success_prelude_Natural_sum_0, "prelude/Natural/sum/0"); - norm!(success_prelude_Natural_sum_1, "prelude/Natural/sum/1"); - norm!(success_prelude_Natural_toDouble_0, "prelude/Natural/toDouble/0"); - norm!(success_prelude_Natural_toDouble_1, "prelude/Natural/toDouble/1"); - norm!(success_prelude_Natural_toInteger_0, "prelude/Natural/toInteger/0"); - norm!(success_prelude_Natural_toInteger_1, "prelude/Natural/toInteger/1"); - norm!(success_prelude_Optional_all_0, "prelude/Optional/all/0"); - norm!(success_prelude_Optional_all_1, "prelude/Optional/all/1"); - norm!(success_prelude_Optional_any_0, "prelude/Optional/any/0"); - norm!(success_prelude_Optional_any_1, "prelude/Optional/any/1"); - norm!(success_prelude_Optional_build_0, "prelude/Optional/build/0"); - norm!(success_prelude_Optional_build_1, "prelude/Optional/build/1"); - norm!(success_prelude_Optional_concat_0, "prelude/Optional/concat/0"); - norm!(success_prelude_Optional_concat_1, "prelude/Optional/concat/1"); - norm!(success_prelude_Optional_concat_2, "prelude/Optional/concat/2"); - norm!(success_prelude_Optional_filter_0, "prelude/Optional/filter/0"); - norm!(success_prelude_Optional_filter_1, "prelude/Optional/filter/1"); - norm!(success_prelude_Optional_fold_0, "prelude/Optional/fold/0"); - norm!(success_prelude_Optional_fold_1, "prelude/Optional/fold/1"); - norm!(success_prelude_Optional_head_0, "prelude/Optional/head/0"); - norm!(success_prelude_Optional_head_1, "prelude/Optional/head/1"); - norm!(success_prelude_Optional_head_2, "prelude/Optional/head/2"); - norm!(success_prelude_Optional_last_0, "prelude/Optional/last/0"); - norm!(success_prelude_Optional_last_1, "prelude/Optional/last/1"); - norm!(success_prelude_Optional_last_2, "prelude/Optional/last/2"); - norm!(success_prelude_Optional_length_0, "prelude/Optional/length/0"); - norm!(success_prelude_Optional_length_1, "prelude/Optional/length/1"); - norm!(success_prelude_Optional_map_0, "prelude/Optional/map/0"); - norm!(success_prelude_Optional_map_1, "prelude/Optional/map/1"); - norm!(success_prelude_Optional_null_0, "prelude/Optional/null/0"); - norm!(success_prelude_Optional_null_1, "prelude/Optional/null/1"); - norm!(success_prelude_Optional_toList_0, "prelude/Optional/toList/0"); - norm!(success_prelude_Optional_toList_1, "prelude/Optional/toList/1"); - norm!(success_prelude_Optional_unzip_0, "prelude/Optional/unzip/0"); - norm!(success_prelude_Optional_unzip_1, "prelude/Optional/unzip/1"); - norm!(success_prelude_Text_concat_0, "prelude/Text/concat/0"); - norm!(success_prelude_Text_concat_1, "prelude/Text/concat/1"); - norm!(success_prelude_Text_concatMap_0, "prelude/Text/concatMap/0"); - norm!(success_prelude_Text_concatMap_1, "prelude/Text/concatMap/1"); - norm!(success_prelude_Text_concatMapSep_0, "prelude/Text/concatMapSep/0"); - norm!(success_prelude_Text_concatMapSep_1, "prelude/Text/concatMapSep/1"); - norm!(success_prelude_Text_concatSep_0, "prelude/Text/concatSep/0"); - norm!(success_prelude_Text_concatSep_1, "prelude/Text/concatSep/1"); - norm!(success_prelude_Text_show_0, "prelude/Text/show/0"); - norm!(success_prelude_Text_show_1, "prelude/Text/show/1"); - norm!(success_remoteSystems, "remoteSystems"); - - norm!(success_simple_doubleShow, "simple/doubleShow"); - norm!(success_simple_enum, "simple/enum"); - norm!(success_simple_integerShow, "simple/integerShow"); - // norm!(success_simple_integerToDouble, "simple/integerToDouble"); - norm!(success_simple_letAvoidCapture, "simple/letAvoidCapture"); - norm!(success_simple_letenum, "simple/letenum"); - norm!(success_simple_letlet, "simple/letlet"); - norm!(success_simple_listBuild, "simple/listBuild"); - norm!(success_simple_multiLine, "simple/multiLine"); - norm!(success_simple_naturalBuild, "simple/naturalBuild"); - norm!(success_simple_naturalPlus, "simple/naturalPlus"); - norm!(success_simple_naturalShow, "simple/naturalShow"); - norm!(success_simple_naturalToInteger, "simple/naturalToInteger"); - norm!(success_simple_optionalBuild, "simple/optionalBuild"); - norm!(success_simple_optionalBuildFold, "simple/optionalBuildFold"); - norm!(success_simple_optionalFold, "simple/optionalFold"); - norm!(success_simple_simpleAddition, "simple/simpleAddition"); - norm!(success_simple_sortOperator, "simple/sortOperator"); - norm!(success_simplifications_and, "simplifications/and"); - norm!(success_simplifications_eq, "simplifications/eq"); - norm!(success_simplifications_ifThenElse, "simplifications/ifThenElse"); - norm!(success_simplifications_ne, "simplifications/ne"); - norm!(success_simplifications_or, "simplifications/or"); - - norm!(success_unit_BareInterpolation, "unit/BareInterpolation"); - norm!(success_unit_Bool, "unit/Bool"); - norm!(success_unit_Double, "unit/Double"); - norm!(success_unit_DoubleLiteral, "unit/DoubleLiteral"); - norm!(success_unit_DoubleShow, "unit/DoubleShow"); - norm!(success_unit_DoubleShowValue, "unit/DoubleShowValue"); - norm!(success_unit_EmptyAlternative, "unit/EmptyAlternative"); - norm!(success_unit_FunctionApplicationCapture, "unit/FunctionApplicationCapture"); - norm!(success_unit_FunctionApplicationNoSubstitute, "unit/FunctionApplicationNoSubstitute"); - norm!(success_unit_FunctionApplicationNormalizeArguments, "unit/FunctionApplicationNormalizeArguments"); - norm!(success_unit_FunctionApplicationSubstitute, "unit/FunctionApplicationSubstitute"); - norm!(success_unit_FunctionNormalizeArguments, "unit/FunctionNormalizeArguments"); - norm!(success_unit_FunctionTypeNormalizeArguments, "unit/FunctionTypeNormalizeArguments"); - norm!(success_unit_IfAlternativesIdentical, "unit/IfAlternativesIdentical"); - norm!(success_unit_IfFalse, "unit/IfFalse"); - norm!(success_unit_IfNormalizePredicateAndBranches, "unit/IfNormalizePredicateAndBranches"); - norm!(success_unit_IfTrivial, "unit/IfTrivial"); - norm!(success_unit_IfTrue, "unit/IfTrue"); - norm!(success_unit_Integer, "unit/Integer"); - norm!(success_unit_IntegerNegative, "unit/IntegerNegative"); - norm!(success_unit_IntegerPositive, "unit/IntegerPositive"); - norm!(success_unit_IntegerShow_12, "unit/IntegerShow-12"); - norm!(success_unit_IntegerShow12, "unit/IntegerShow12"); - norm!(success_unit_IntegerShow, "unit/IntegerShow"); - norm!(success_unit_IntegerToDouble_12, "unit/IntegerToDouble-12"); - norm!(success_unit_IntegerToDouble12, "unit/IntegerToDouble12"); - norm!(success_unit_IntegerToDouble, "unit/IntegerToDouble"); - norm!(success_unit_Kind, "unit/Kind"); - norm!(success_unit_Let, "unit/Let"); - norm!(success_unit_LetWithType, "unit/LetWithType"); - norm!(success_unit_List, "unit/List"); - norm!(success_unit_ListBuild, "unit/ListBuild"); - norm!(success_unit_ListBuildFoldFusion, "unit/ListBuildFoldFusion"); - norm!(success_unit_ListBuildImplementation, "unit/ListBuildImplementation"); - norm!(success_unit_ListFold, "unit/ListFold"); - norm!(success_unit_ListFoldEmpty, "unit/ListFoldEmpty"); - norm!(success_unit_ListFoldOne, "unit/ListFoldOne"); - norm!(success_unit_ListHead, "unit/ListHead"); - norm!(success_unit_ListHeadEmpty, "unit/ListHeadEmpty"); - norm!(success_unit_ListHeadOne, "unit/ListHeadOne"); - norm!(success_unit_ListIndexed, "unit/ListIndexed"); - norm!(success_unit_ListIndexedEmpty, "unit/ListIndexedEmpty"); - norm!(success_unit_ListIndexedOne, "unit/ListIndexedOne"); - norm!(success_unit_ListLast, "unit/ListLast"); - norm!(success_unit_ListLastEmpty, "unit/ListLastEmpty"); - norm!(success_unit_ListLastOne, "unit/ListLastOne"); - norm!(success_unit_ListLength, "unit/ListLength"); - norm!(success_unit_ListLengthEmpty, "unit/ListLengthEmpty"); - norm!(success_unit_ListLengthOne, "unit/ListLengthOne"); - norm!(success_unit_ListNormalizeElements, "unit/ListNormalizeElements"); - norm!(success_unit_ListNormalizeTypeAnnotation, "unit/ListNormalizeTypeAnnotation"); - norm!(success_unit_ListReverse, "unit/ListReverse"); - norm!(success_unit_ListReverseEmpty, "unit/ListReverseEmpty"); - norm!(success_unit_ListReverseTwo, "unit/ListReverseTwo"); - norm!(success_unit_Merge, "unit/Merge"); - norm!(success_unit_MergeEmptyAlternative, "unit/MergeEmptyAlternative"); - norm!(success_unit_MergeNormalizeArguments, "unit/MergeNormalizeArguments"); - norm!(success_unit_MergeWithType, "unit/MergeWithType"); - norm!(success_unit_MergeWithTypeNormalizeArguments, "unit/MergeWithTypeNormalizeArguments"); - norm!(success_unit_Natural, "unit/Natural"); - norm!(success_unit_NaturalBuild, "unit/NaturalBuild"); - norm!(success_unit_NaturalBuildFoldFusion, "unit/NaturalBuildFoldFusion"); - norm!(success_unit_NaturalBuildImplementation, "unit/NaturalBuildImplementation"); - norm!(success_unit_NaturalEven, "unit/NaturalEven"); - norm!(success_unit_NaturalEvenOne, "unit/NaturalEvenOne"); - norm!(success_unit_NaturalEvenZero, "unit/NaturalEvenZero"); - norm!(success_unit_NaturalFold, "unit/NaturalFold"); - norm!(success_unit_NaturalFoldOne, "unit/NaturalFoldOne"); - norm!(success_unit_NaturalFoldZero, "unit/NaturalFoldZero"); - norm!(success_unit_NaturalIsZero, "unit/NaturalIsZero"); - norm!(success_unit_NaturalIsZeroOne, "unit/NaturalIsZeroOne"); - norm!(success_unit_NaturalIsZeroZero, "unit/NaturalIsZeroZero"); - norm!(success_unit_NaturalLiteral, "unit/NaturalLiteral"); - norm!(success_unit_NaturalOdd, "unit/NaturalOdd"); - norm!(success_unit_NaturalOddOne, "unit/NaturalOddOne"); - norm!(success_unit_NaturalOddZero, "unit/NaturalOddZero"); - norm!(success_unit_NaturalShow, "unit/NaturalShow"); - norm!(success_unit_NaturalShowOne, "unit/NaturalShowOne"); - norm!(success_unit_NaturalToInteger, "unit/NaturalToInteger"); - norm!(success_unit_NaturalToIntegerOne, "unit/NaturalToIntegerOne"); - norm!(success_unit_None, "unit/None"); - norm!(success_unit_NoneNatural, "unit/NoneNatural"); - norm!(success_unit_OperatorAndEquivalentArguments, "unit/OperatorAndEquivalentArguments"); - norm!(success_unit_OperatorAndLhsFalse, "unit/OperatorAndLhsFalse"); - norm!(success_unit_OperatorAndLhsTrue, "unit/OperatorAndLhsTrue"); - norm!(success_unit_OperatorAndNormalizeArguments, "unit/OperatorAndNormalizeArguments"); - norm!(success_unit_OperatorAndRhsFalse, "unit/OperatorAndRhsFalse"); - norm!(success_unit_OperatorAndRhsTrue, "unit/OperatorAndRhsTrue"); - norm!(success_unit_OperatorEqualEquivalentArguments, "unit/OperatorEqualEquivalentArguments"); - norm!(success_unit_OperatorEqualLhsTrue, "unit/OperatorEqualLhsTrue"); - norm!(success_unit_OperatorEqualNormalizeArguments, "unit/OperatorEqualNormalizeArguments"); - norm!(success_unit_OperatorEqualRhsTrue, "unit/OperatorEqualRhsTrue"); - norm!(success_unit_OperatorListConcatenateLhsEmpty, "unit/OperatorListConcatenateLhsEmpty"); - norm!(success_unit_OperatorListConcatenateListList, "unit/OperatorListConcatenateListList"); - norm!(success_unit_OperatorListConcatenateNormalizeArguments, "unit/OperatorListConcatenateNormalizeArguments"); - norm!(success_unit_OperatorListConcatenateRhsEmpty, "unit/OperatorListConcatenateRhsEmpty"); - norm!(success_unit_OperatorNotEqualEquivalentArguments, "unit/OperatorNotEqualEquivalentArguments"); - norm!(success_unit_OperatorNotEqualLhsFalse, "unit/OperatorNotEqualLhsFalse"); - norm!(success_unit_OperatorNotEqualNormalizeArguments, "unit/OperatorNotEqualNormalizeArguments"); - norm!(success_unit_OperatorNotEqualRhsFalse, "unit/OperatorNotEqualRhsFalse"); - norm!(success_unit_OperatorOrEquivalentArguments, "unit/OperatorOrEquivalentArguments"); - norm!(success_unit_OperatorOrLhsFalse, "unit/OperatorOrLhsFalse"); - norm!(success_unit_OperatorOrLhsTrue, "unit/OperatorOrLhsTrue"); - norm!(success_unit_OperatorOrNormalizeArguments, "unit/OperatorOrNormalizeArguments"); - norm!(success_unit_OperatorOrRhsFalse, "unit/OperatorOrRhsFalse"); - norm!(success_unit_OperatorOrRhsTrue, "unit/OperatorOrRhsTrue"); - norm!(success_unit_OperatorPlusLhsZero, "unit/OperatorPlusLhsZero"); - norm!(success_unit_OperatorPlusNormalizeArguments, "unit/OperatorPlusNormalizeArguments"); - norm!(success_unit_OperatorPlusOneAndOne, "unit/OperatorPlusOneAndOne"); - norm!(success_unit_OperatorPlusRhsZero, "unit/OperatorPlusRhsZero"); - norm!(success_unit_OperatorTextConcatenateLhsEmpty, "unit/OperatorTextConcatenateLhsEmpty"); - norm!(success_unit_OperatorTextConcatenateLhsNonEmpty, "unit/OperatorTextConcatenateLhsNonEmpty"); - norm!(success_unit_OperatorTextConcatenateRhsEmpty, "unit/OperatorTextConcatenateRhsEmpty"); - norm!(success_unit_OperatorTextConcatenateRhsNonEmpty, "unit/OperatorTextConcatenateRhsNonEmpty"); - norm!(success_unit_OperatorTextConcatenateTextText, "unit/OperatorTextConcatenateTextText"); - norm!(success_unit_OperatorTimesLhsOne, "unit/OperatorTimesLhsOne"); - norm!(success_unit_OperatorTimesLhsZero, "unit/OperatorTimesLhsZero"); - norm!(success_unit_OperatorTimesNormalizeArguments, "unit/OperatorTimesNormalizeArguments"); - norm!(success_unit_OperatorTimesRhsOne, "unit/OperatorTimesRhsOne"); - norm!(success_unit_OperatorTimesRhsZero, "unit/OperatorTimesRhsZero"); - norm!(success_unit_OperatorTimesTwoAndTwo, "unit/OperatorTimesTwoAndTwo"); - norm!(success_unit_Optional, "unit/Optional"); - norm!(success_unit_OptionalBuild, "unit/OptionalBuild"); - norm!(success_unit_OptionalBuildFoldFusion, "unit/OptionalBuildFoldFusion"); - norm!(success_unit_OptionalBuildImplementation, "unit/OptionalBuildImplementation"); - norm!(success_unit_OptionalFold, "unit/OptionalFold"); - norm!(success_unit_OptionalFoldNone, "unit/OptionalFoldNone"); - norm!(success_unit_OptionalFoldSome, "unit/OptionalFoldSome"); - norm!(success_unit_Record, "unit/Record"); - norm!(success_unit_RecordEmpty, "unit/RecordEmpty"); - norm!(success_unit_RecordProjection, "unit/RecordProjection"); - norm!(success_unit_RecordProjectionEmpty, "unit/RecordProjectionEmpty"); - norm!(success_unit_RecordProjectionNormalizeArguments, "unit/RecordProjectionNormalizeArguments"); - norm!(success_unit_RecordSelection, "unit/RecordSelection"); - norm!(success_unit_RecordSelectionNormalizeArguments, "unit/RecordSelectionNormalizeArguments"); - norm!(success_unit_RecordType, "unit/RecordType"); - norm!(success_unit_RecordTypeEmpty, "unit/RecordTypeEmpty"); - norm!(success_unit_RecursiveRecordMergeCollision, "unit/RecursiveRecordMergeCollision"); - norm!(success_unit_RecursiveRecordMergeLhsEmpty, "unit/RecursiveRecordMergeLhsEmpty"); - norm!(success_unit_RecursiveRecordMergeNoCollision, "unit/RecursiveRecordMergeNoCollision"); - norm!(success_unit_RecursiveRecordMergeNormalizeArguments, "unit/RecursiveRecordMergeNormalizeArguments"); - norm!(success_unit_RecursiveRecordMergeRhsEmpty, "unit/RecursiveRecordMergeRhsEmpty"); - norm!(success_unit_RecursiveRecordTypeMergeCollision, "unit/RecursiveRecordTypeMergeCollision"); - norm!(success_unit_RecursiveRecordTypeMergeLhsEmpty, "unit/RecursiveRecordTypeMergeLhsEmpty"); - norm!(success_unit_RecursiveRecordTypeMergeNoCollision, "unit/RecursiveRecordTypeMergeNoCollision"); - norm!(success_unit_RecursiveRecordTypeMergeNormalizeArguments, "unit/RecursiveRecordTypeMergeNormalizeArguments"); - norm!(success_unit_RecursiveRecordTypeMergeRhsEmpty, "unit/RecursiveRecordTypeMergeRhsEmpty"); - norm!(success_unit_RecursiveRecordTypeMergeSorts, "unit/RecursiveRecordTypeMergeSorts"); - norm!(success_unit_RightBiasedRecordMergeCollision, "unit/RightBiasedRecordMergeCollision"); - norm!(success_unit_RightBiasedRecordMergeLhsEmpty, "unit/RightBiasedRecordMergeLhsEmpty"); - norm!(success_unit_RightBiasedRecordMergeNoCollision, "unit/RightBiasedRecordMergeNoCollision"); - norm!(success_unit_RightBiasedRecordMergeNormalizeArguments, "unit/RightBiasedRecordMergeNormalizeArguments"); - norm!(success_unit_RightBiasedRecordMergeRhsEmpty, "unit/RightBiasedRecordMergeRhsEmpty"); - norm!(success_unit_SomeNormalizeArguments, "unit/SomeNormalizeArguments"); - norm!(success_unit_Sort, "unit/Sort"); - norm!(success_unit_Text, "unit/Text"); - norm!(success_unit_TextInterpolate, "unit/TextInterpolate"); - norm!(success_unit_TextLiteral, "unit/TextLiteral"); - norm!(success_unit_TextNormalizeInterpolations, "unit/TextNormalizeInterpolations"); - norm!(success_unit_TextShow, "unit/TextShow"); - norm!(success_unit_TextShowAllEscapes, "unit/TextShowAllEscapes"); - norm!(success_unit_True, "unit/True"); - norm!(success_unit_Type, "unit/Type"); - norm!(success_unit_TypeAnnotation, "unit/TypeAnnotation"); - norm!(success_unit_UnionNormalizeAlternatives, "unit/UnionNormalizeAlternatives"); - norm!(success_unit_UnionNormalizeArguments, "unit/UnionNormalizeArguments"); - norm!(success_unit_UnionProjectConstructor, "unit/UnionProjectConstructor"); - norm!(success_unit_UnionSortAlternatives, "unit/UnionSortAlternatives"); - norm!(success_unit_UnionType, "unit/UnionType"); - norm!(success_unit_UnionTypeEmpty, "unit/UnionTypeEmpty"); - norm!(success_unit_UnionTypeNormalizeArguments, "unit/UnionTypeNormalizeArguments"); - norm!(success_unit_Variable, "unit/Variable"); - - alpha_norm!(regression_preludeBoolFold, "regression/preludeBoolFold"); - alpha_norm!(unit_FunctionBindingUnderscore, "unit/FunctionBindingUnderscore"); - alpha_norm!(unit_FunctionBindingX, "unit/FunctionBindingX"); - alpha_norm!(unit_FunctionNestedBindingX, "unit/FunctionNestedBindingX"); - alpha_norm!(unit_FunctionNestedBindingXX, "unit/FunctionNestedBindingXX"); - alpha_norm!(unit_FunctionNestedBindingXXFree, "unit/FunctionNestedBindingXXFree"); - alpha_norm!(unit_FunctionNestedBindingXY, "unit/FunctionNestedBindingXY"); - alpha_norm!(unit_FunctionTypeBindingUnderscore, "unit/FunctionTypeBindingUnderscore"); - alpha_norm!(unit_FunctionTypeBindingX, "unit/FunctionTypeBindingX"); - alpha_norm!(unit_FunctionTypeNestedBindingX, "unit/FunctionTypeNestedBindingX"); -} diff --git a/dhall/src/phase/parse.rs b/dhall/src/phase/parse.rs index 6b426af..d5cb9f5 100644 --- a/dhall/src/phase/parse.rs +++ b/dhall/src/phase/parse.rs @@ -29,10 +29,3 @@ pub(crate) fn parse_binary_file(f: &Path) -> Result<Parsed, Error> { let root = ImportRoot::LocalDir(f.parent().unwrap().to_owned()); Ok(Parsed(expr.note_absurd(), root)) } - -#[cfg(test)] -mod spec_tests { - #![rustfmt::skip] - // See build.rs - include!(concat!(env!("OUT_DIR"), "/parser_tests.rs")); -} diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs index 4fa1cf5..a958e48 100644 --- a/dhall/src/tests.rs +++ b/dhall/src/tests.rs @@ -172,3 +172,8 @@ pub fn run_test( } Ok(()) } + +mod spec { + // See build.rs + include!(concat!(env!("OUT_DIR"), "/spec_tests.rs")); +} |