From 2551e6f91110bfe385fa65dd63e576df637c26fa Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 5 Aug 2019 18:18:45 +0200 Subject: Add some tests --- dhall/src/phase/normalize.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'dhall/src/phase/normalize.rs') 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) -> 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 = 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)] => { -- cgit v1.2.3