summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Gonggrijp <dev@juliangonggrijp.com>2022-07-20 12:57:19 +0200
committerGitHub <noreply@github.com>2022-07-20 12:57:19 +0200
commitf794f93d2e1bee7d5ec5a6a197b107cc58f12e05 (patch)
treea46dbf918ee6aa035702b40f9f7d48615ec3019d
parentb2aeb3c283de931a7004b5f7a2cb394b89382369 (diff)
parentfaa9f2764ee5ec6c296a62b05b7e3a1b0f9e1d3b (diff)
downloadmustache-spec-f794f93d2e1bee7d5ec5a6a197b107cc58f12e05.tar.gz
Merge pull request #137 from s9105947/comment-data
add test: comment content colliding with variable
-rw-r--r--specs/comments.json12
-rw-r--r--specs/comments.yml6
2 files changed, 18 insertions, 0 deletions
diff --git a/specs/comments.json b/specs/comments.json
index 60a4929..924ed46 100644
--- a/specs/comments.json
+++ b/specs/comments.json
@@ -89,6 +89,18 @@
},
"template": "12345 {{! Comment Block! }} 67890",
"expected": "12345 67890"
+ },
+ {
+ "name": "Variable Name Collision",
+ "desc": "Comments must never render, even if variable with same name exists.",
+ "data": {
+ "! comment": 1,
+ "! comment ": 2,
+ "!comment": 3,
+ "comment": 4
+ },
+ "template": "comments never show: >{{! comment }}<",
+ "expected": "comments never show: ><"
}
]
}
diff --git a/specs/comments.yml b/specs/comments.yml
index 7b14c7f..3bad09f 100644
--- a/specs/comments.yml
+++ b/specs/comments.yml
@@ -101,3 +101,9 @@ tests:
data: { }
template: '12345 {{! Comment Block! }} 67890'
expected: '12345 67890'
+
+ - name: Variable Name Collision
+ desc: Comments must never render, even if variable with same name exists.
+ data: { '! comment': 1, '! comment ': 2, '!comment': 3, 'comment': 4}
+ template: 'comments never show: >{{! comment }}<'
+ expected: 'comments never show: ><'