From aad6725ea0ca928c50bde433a953fa094d1fd5e7 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Mon, 19 Apr 2021 01:44:47 +0200 Subject: Specify how to interpolate null (#101) --- specs/interpolation.json | 27 +++++++++++++++++++++++++++ specs/interpolation.yml | 18 ++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/specs/interpolation.json b/specs/interpolation.json index 1718e1c..d422dc3 100644 --- a/specs/interpolation.json +++ b/specs/interpolation.json @@ -100,6 +100,33 @@ "template": "\"{{&power}} jiggawatts!\"", "expected": "\"1.21 jiggawatts!\"" }, + { + "name": "Basic Null Interpolation", + "desc": "Nulls should interpolate as the empty string.", + "data": { + "cannot": null + }, + "template": "I ({{cannot}}) be seen!", + "expected": "I () be seen!" + }, + { + "name": "Triple Mustache Null Interpolation", + "desc": "Nulls should interpolate as the empty string.", + "data": { + "cannot": null + }, + "template": "I ({{{cannot}}}) be seen!", + "expected": "I () be seen!" + }, + { + "name": "Ampersand Null Interpolation", + "desc": "Nulls should interpolate as the empty string.", + "data": { + "cannot": null + }, + "template": "I ({{&cannot}}) be seen!", + "expected": "I () be seen!" + }, { "name": "Basic Context Miss Interpolation", "desc": "Failed context lookups should default to empty strings.", diff --git a/specs/interpolation.yml b/specs/interpolation.yml index 1b6fff1..9410a30 100644 --- a/specs/interpolation.yml +++ b/specs/interpolation.yml @@ -101,6 +101,24 @@ tests: template: '"{{&power}} jiggawatts!"' expected: '"1.21 jiggawatts!"' + - name: Basic Null Interpolation + desc: Nulls should interpolate as the empty string. + data: { cannot: null } + template: "I ({{cannot}}) be seen!" + expected: "I () be seen!" + + - name: Triple Mustache Null Interpolation + desc: Nulls should interpolate as the empty string. + data: { cannot: null } + template: "I ({{{cannot}}}) be seen!" + expected: "I () be seen!" + + - name: Ampersand Null Interpolation + desc: Nulls should interpolate as the empty string. + data: { cannot: null } + template: "I ({{&cannot}}) be seen!" + expected: "I () be seen!" + # Context Misses - name: Basic Context Miss Interpolation -- cgit v1.2.1