diff options
author | Nadrieril | 2019-08-05 18:18:45 +0200 |
---|---|---|
committer | Nadrieril | 2019-08-06 21:42:16 +0200 |
commit | 2551e6f91110bfe385fa65dd63e576df637c26fa (patch) | |
tree | ae02cc84a085e75ece48c2831309448741d18e15 | |
parent | e52f50080d8e0e6d6a05b1045e3e0e840acb50d0 (diff) |
Add some tests
m--------- | dhall-lang | 0 | ||||
-rw-r--r-- | dhall/build.rs | 20 | ||||
-rw-r--r-- | dhall/src/phase/normalize.rs | 10 | ||||
-rw-r--r-- | tests_buffer | 3 |
4 files changed, 31 insertions, 2 deletions
diff --git a/dhall-lang b/dhall-lang -Subproject dbf4ebcfabf499e87c27e75bec108d91929ccc3 +Subproject e01c734e612daac327b06845e45c34552d65d9e diff --git a/dhall/build.rs b/dhall/build.rs index 5a99def..7e320c5 100644 --- a/dhall/build.rs +++ b/dhall/build.rs @@ -90,6 +90,10 @@ fn main() -> std::io::Result<()> { // TODO: Inline headers are not implemented || path == "success/unit/import/parenthesizeUsing" || path == "success/unit/import/inlineUsing" + // TODO: projection by expression + || path == "success/recordProjectionByExpression" + || path == "success/unit/recordProjectionByExpression" + || path == "success/unit/recordProjectionByExpressionEmpty" }, )?; @@ -105,6 +109,10 @@ fn main() -> std::io::Result<()> { || path == "success/largeExpression" // TODO: Inline headers are not implemented || path == "success/unit/import/inlineUsing" + // TODO: projection by expression + || path == "success/recordProjectionByExpression" + || path == "success/unit/recordProjectionByExpression" + || path == "success/unit/recordProjectionByExpressionEmpty" }, )?; @@ -124,8 +132,11 @@ fn main() -> std::io::Result<()> { // See https://github.com/pyfisch/cbor/issues/109 || path == "success/double" // TODO: Inline headers are not implemented - || path == "success/unit/import/parenthesizeUsing" || path == "success/unit/import/inlineUsing" + // TODO: projection by expression + || path == "success/recordProjectionByExpression" + || path == "success/unit/recordProjectionByExpression" + || path == "success/unit/recordProjectionByExpressionEmpty" }, )?; @@ -139,9 +150,14 @@ fn main() -> std::io::Result<()> { path == "success/simple/integerToDouble" // Too slow || path == "success/remoteSystems" - // TODO: selection by expression + // TODO: projection by expression || path == "success/unit/RecordProjectionTypeEmpty" || path == "success/unit/RecordProjectionTypeNonEmpty" + || path == "success/unit/RecordProjectionTypeNormalizeProjection" + // TODO: fix Double/show + || path == "success/prelude/JSON/number/1" + // the test is wrong + || path == "success/prelude/JSON/Type/0" }, )?; diff --git a/dhall/src/phase/normalize.rs b/dhall/src/phase/normalize.rs index f3684d1..d5bdc9e 100644 --- a/dhall/src/phase/normalize.rs +++ b/dhall/src/phase/normalize.rs @@ -72,6 +72,16 @@ pub fn apply_builtin(b: Builtin, args: Vec<Thunk>) -> Value { (TextShow, [v, r..]) => match &*v.as_value() { TextLit(elts) => { match elts.as_slice() { + // Empty string literal. + [] => { + // Printing InterpolatedText takes care of all the escaping + let txt: InterpolatedText<X> = std::iter::empty().collect(); + let s = txt.to_string(); + Ok(( + r, + TextLit(vec![InterpolatedTextContents::Text(s)]), + )) + } // If there are no interpolations (invariants ensure that when there are no // interpolations, there is a single Text item) in the literal. [InterpolatedTextContents::Text(s)] => { diff --git a/tests_buffer b/tests_buffer index deb245d..5234562 100644 --- a/tests_buffer +++ b/tests_buffer @@ -98,6 +98,8 @@ failure/ normalization: variables across import boundaries +Text/show "" +Double/show -1.5e-10 TextLitNested1 "${""}${x}" TextLitNested2 "${"${x}"}" TextLitNested3 "${"${""}"}${x}" @@ -106,6 +108,7 @@ variables across import boundaries typecheck: something that involves destructuring a recordtype after merge +add some of the more complicated Prelude tests back, like List/enumerate failure on old-style optional literal success/ MergeEmptyAlternative merge { x = 1 } < x >.x |