summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Gonggrijp <dev@juliangonggrijp.com>2021-04-19 01:44:47 +0200
committerJulian Gonggrijp <dev@juliangonggrijp.com>2021-04-19 01:44:47 +0200
commitaad6725ea0ca928c50bde433a953fa094d1fd5e7 (patch)
tree348e2f3f70d3140f228afda7124292376137f8e0
parentb1329a25e6d265ff360267d23f7c6327bbf59f52 (diff)
downloadmustache-spec-aad6725ea0ca928c50bde433a953fa094d1fd5e7.tar.gz
Specify how to interpolate null (#101)
-rw-r--r--specs/interpolation.json27
-rw-r--r--specs/interpolation.yml18
2 files changed, 45 insertions, 0 deletions
diff --git a/specs/interpolation.json b/specs/interpolation.json
index 1718e1c..d422dc3 100644
--- a/specs/interpolation.json
+++ b/specs/interpolation.json
@@ -101,6 +101,33 @@
"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.",
"data": {
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