summaryrefslogtreecommitdiff
path: root/dhall/src/tests.rs
diff options
context:
space:
mode:
authorNadrieril2020-04-05 17:57:07 +0100
committerGitHub2020-04-05 17:57:07 +0100
commit7e977f282fb6a0eff0ef45738b9b5c98dc4c6fee (patch)
treead4249609707fd8720a44469152105c2f6a67c79 /dhall/src/tests.rs
parent5a5aa49e64197899006751db72e404f4b2292d4e (diff)
parent820214615547101f8f2b5de209b5189968bddfee (diff)
Merge pull request #154 from Nadrieril/cleanup-api
Rewrite serde_dhall API
Diffstat (limited to '')
-rw-r--r--dhall/src/tests.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs
index a5a278c..2cd354f 100644
--- a/dhall/src/tests.rs
+++ b/dhall/src/tests.rs
@@ -10,8 +10,8 @@ use std::io::{Read, Write};
use std::path::PathBuf;
use crate::error::{ErrorKind, Result};
-use crate::syntax::binary;
-use crate::{Normalized, NormalizedExpr, Parsed, Resolved, Typed};
+use crate::syntax::{binary, Expr};
+use crate::{Normalized, Parsed, Resolved, Typed};
macro_rules! assert_eq_display {
($left:expr, $right:expr) => {{
@@ -111,7 +111,7 @@ impl TestFile {
env::var("UPDATE_TEST_FILES") == Ok("1".to_string())
}
/// Write the provided expression to the pointed file.
- fn write_expr(&self, expr: impl Into<NormalizedExpr>) -> Result<()> {
+ fn write_expr(&self, expr: impl Into<Expr>) -> Result<()> {
let expr = expr.into();
let path = self.path();
create_dir_all(path.parent().unwrap())?;
@@ -142,7 +142,7 @@ impl TestFile {
}
/// Check that the provided expression matches the file contents.
- pub fn compare(&self, expr: impl Into<NormalizedExpr>) -> Result<()> {
+ pub fn compare(&self, expr: impl Into<Expr>) -> Result<()> {
let expr = expr.into();
if !self.path().is_file() {
return self.write_expr(expr);
@@ -159,7 +159,7 @@ impl TestFile {
Ok(())
}
/// Check that the provided expression matches the file contents.
- pub fn compare_debug(&self, expr: impl Into<NormalizedExpr>) -> Result<()> {
+ pub fn compare_debug(&self, expr: impl Into<Expr>) -> Result<()> {
let expr = expr.into();
if !self.path().is_file() {
return self.write_expr(expr);
@@ -176,10 +176,7 @@ impl TestFile {
Ok(())
}
/// Check that the provided expression matches the file contents.
- pub fn compare_binary(
- &self,
- expr: impl Into<NormalizedExpr>,
- ) -> Result<()> {
+ pub fn compare_binary(&self, expr: impl Into<Expr>) -> Result<()> {
let expr = expr.into();
match self {
TestFile::Binary(_) => {}
@@ -302,7 +299,7 @@ fn run_test(test: Test) -> Result<()> {
expected.compare(expr)?;
}
ImportFailure(expr, expected) => {
- let err = expr.parse()?.resolve().unwrap_err();
+ let err = expr.resolve().unwrap_err();
expected.compare_ui(err)?;
}
TypeInferenceSuccess(expr, expected) => {