From 8680920be83ecff0aaf6472b78599bb9108272a7 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 27 Feb 2019 19:31:19 +0100 Subject: Add one test from the spec --- src/lib.rs | 11 +++++++++++ src/main.rs | 19 ++----------------- tests/tests.rs | 12 ++++++++++++ 3 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 src/lib.rs create mode 100644 tests/tests.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..8f82c61 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,11 @@ +#![feature(box_patterns)] + +pub mod context; +mod core; +pub use crate::core::*; +use lalrpop_util::lalrpop_mod; +lalrpop_mod!(pub grammar); // synthesized by LALRPOP +mod grammar_util; +pub mod lexer; +pub mod parser; +pub mod typecheck; diff --git a/src/main.rs b/src/main.rs index 22a4c3b..cdab3c0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,24 +1,9 @@ -#![feature(box_patterns)] - -use bytecount; -use lalrpop_util; -use lalrpop_util::lalrpop_mod; -use term_painter; - -pub mod context; -mod core; -pub use crate::core::*; -lalrpop_mod!(pub grammar); // synthesized by LALRPOP -mod grammar_util; -pub mod lexer; -pub mod parser; -pub mod typecheck; - use std::io::{self, Read}; use std::error::Error; - use term_painter::ToStyle; +use dhall::*; + const ERROR_STYLE: term_painter::Color = term_painter::Color::Red; const BOLD: term_painter::Attr = term_painter::Attr::Bold; diff --git a/tests/tests.rs b/tests/tests.rs new file mode 100644 index 0000000..5089ae8 --- /dev/null +++ b/tests/tests.rs @@ -0,0 +1,12 @@ +use dhall::*; + +#[test] +fn test(){ + let buffer_expr = String::from(include_str!("../dhall-lang/tests/normalization/success/simple/naturalPlusA.dhall")); + let buffer_expected = String::from(include_str!("../dhall-lang/tests/normalization/success/simple/naturalPlusB.dhall")); + let expr = parser::parse_expr(&buffer_expr).unwrap(); + let expected = parser::parse_expr(&buffer_expected).unwrap(); + // let type_expr = typecheck::type_of(&expr).unwrap(); + // let normalized = normalize::<_, X, _>(&expr); + assert_eq!(normalize::<_, X, _>(&expr), normalize::<_, X, _>(&expected)); +} -- cgit v1.2.3