summaryrefslogtreecommitdiff
path: root/dhall/src
diff options
context:
space:
mode:
authorNadrieril2019-08-05 18:18:45 +0200
committerNadrieril2019-08-06 21:42:16 +0200
commit2551e6f91110bfe385fa65dd63e576df637c26fa (patch)
treeae02cc84a085e75ece48c2831309448741d18e15 /dhall/src
parente52f50080d8e0e6d6a05b1045e3e0e840acb50d0 (diff)
Add some tests
Diffstat (limited to '')
-rw-r--r--dhall/src/phase/normalize.rs10
1 files changed, 10 insertions, 0 deletions
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)] => {