diff options
author | Nadrieril | 2020-02-09 18:40:15 +0000 |
---|---|---|
committer | Nadrieril | 2020-02-09 19:58:31 +0000 |
commit | 4c2a28b844b18d7b67278a1c8f628d9a95ea37c4 (patch) | |
tree | cf28b0104879bd73802c4a21c4ca76b298d1cb04 /dhall/src | |
parent | 02cacfd0360a0acea959c5a9b6d1b7fb0241db81 (diff) |
Track error output of parsing and binary decoding tests
Diffstat (limited to 'dhall/src')
-rw-r--r-- | dhall/src/tests.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs index 19e5264..6a67ddc 100644 --- a/dhall/src/tests.rs +++ b/dhall/src/tests.rs @@ -55,11 +55,11 @@ use crate::{Normalized, NormalizedExpr, Parsed, Resolved}; #[allow(dead_code)] enum Test { ParserSuccess(TestFile, TestFile), - ParserFailure(TestFile), + ParserFailure(TestFile, TestFile), Printer(TestFile, TestFile), BinaryEncoding(TestFile, TestFile), BinaryDecodingSuccess(TestFile, TestFile), - BinaryDecodingFailure(TestFile), + BinaryDecodingFailure(TestFile, TestFile), ImportSuccess(TestFile, TestFile), ImportFailure(TestFile, TestFile), TypeInferenceSuccess(TestFile, TestFile), @@ -245,7 +245,7 @@ fn run_test(test: Test) -> Result<()> { // This exercices both parsing and binary decoding expected.compare_debug(expr)?; } - ParserFailure(expr) => { + ParserFailure(expr, expected) => { use std::io::ErrorKind; let err = expr.parse().unwrap_err(); match &err { @@ -253,6 +253,7 @@ fn run_test(test: Test) -> Result<()> { Error::IO(e) if e.kind() == ErrorKind::InvalidData => {} e => panic!("Expected parse error, got: {:?}", e), } + expected.compare_ui(err)?; } BinaryEncoding(expr, expected) => { let expr = expr.parse()?; @@ -262,8 +263,9 @@ fn run_test(test: Test) -> Result<()> { let expr = expr.parse()?; expected.compare_debug(expr)?; } - BinaryDecodingFailure(expr) => { - expr.parse().unwrap_err(); + BinaryDecodingFailure(expr, expected) => { + let err = expr.parse().unwrap_err(); + expected.compare_ui(err)?; } Printer(expr, _) => { let expected = expr.parse()?; |