Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions tests/unit/data/benchmark.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@
"default_branch": "master",
"open_issues_count": 0,
"is_template": true,
"topics": [
"octocat",
"atom",
"electron",
"api"
],
"topics": ["octocat", "atom", "electron", "api"],
"has_issues": true,
"has_projects": true,
"has_wiki": true,
Expand All @@ -96,11 +91,7 @@
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"permissions": {
"admin": false,
"push": false,
"pull": true
},
"permissions": { "admin": false, "push": false, "pull": true },
"template_repository": "octocat/template",
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
"delete_branch_on_merge": true,
Expand Down
162 changes: 81 additions & 81 deletions tests/unit/data/mustache_comments.json
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
{
"__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.",
"overview": "Comment tags represent content that should never appear in the resulting\noutput.\n\nThe tag's content may contain any substring (including newlines) EXCEPT the\nclosing delimiter.\n\nComment tags SHOULD be treated as standalone when appropriate.\n",
"tests": [
{
"name": "Inline",
"data": {},
"expected": "1234567890",
"template": "12345{{! Comment Block! }}67890",
"desc": "Comment blocks should be removed from the template."
},
{
"name": "Multiline",
"data": {},
"expected": "1234567890\n",
"template": "12345{{!\n This is a\n multi-line comment...\n}}67890\n",
"desc": "Multiline comments should be permitted."
},
{
"name": "Standalone",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n{{! Comment Block! }}\nEnd.\n",
"desc": "All standalone comment lines should be removed."
},
{
"name": "Indented Standalone",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n {{! Indented Comment Block! }}\nEnd.\n",
"desc": "All standalone comment lines should be removed."
},
{
"name": "Standalone Line Endings",
"data": {},
"expected": "|\r\n|",
"template": "|\r\n{{! Standalone Comment }}\r\n|",
"desc": "\"\\r\\n\" should be considered a newline for standalone tags."
},
{
"name": "Standalone Without Previous Line",
"data": {},
"expected": "!",
"template": " {{! I'm Still Standalone }}\n!",
"desc": "Standalone tags should not require a newline to precede them."
},
{
"name": "Standalone Without Newline",
"data": {},
"expected": "!\n",
"template": "!\n {{! I'm Still Standalone }}",
"desc": "Standalone tags should not require a newline to follow them."
},
{
"name": "Multiline Standalone",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n{{!\nSomething's going on here...\n}}\nEnd.\n",
"desc": "All standalone comment lines should be removed."
},
{
"name": "Indented Multiline Standalone",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n {{!\n Something's going on here...\n }}\nEnd.\n",
"desc": "All standalone comment lines should be removed."
},
{
"name": "Indented Inline",
"data": {},
"expected": " 12 \n",
"template": " 12 {{! 34 }}\n",
"desc": "Inline comments should not strip whitespace"
},
{
"name": "Surrounding Whitespace",
"data": {},
"expected": "12345 67890",
"template": "12345 {{! Comment Block! }} 67890",
"desc": "Comment removal should preserve surrounding whitespace."
}
]
"__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.",
"overview": "Comment tags represent content that should never appear in the resulting\noutput.\n\nThe tag's content may contain any substring (including newlines) EXCEPT the\nclosing delimiter.\n\nComment tags SHOULD be treated as standalone when appropriate.\n",
"tests": [
{
"name": "Inline",
"data": {},
"expected": "1234567890",
"template": "12345{{! Comment Block! }}67890",
"desc": "Comment blocks should be removed from the template."
},
{
"name": "Multiline",
"data": {},
"expected": "1234567890\n",
"template": "12345{{!\n This is a\n multi-line comment...\n}}67890\n",
"desc": "Multiline comments should be permitted."
},
{
"name": "Standalone",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n{{! Comment Block! }}\nEnd.\n",
"desc": "All standalone comment lines should be removed."
},
{
"name": "Indented Standalone",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n {{! Indented Comment Block! }}\nEnd.\n",
"desc": "All standalone comment lines should be removed."
},
{
"name": "Standalone Line Endings",
"data": {},
"expected": "|\r\n|",
"template": "|\r\n{{! Standalone Comment }}\r\n|",
"desc": "\"\\r\\n\" should be considered a newline for standalone tags."
},
{
"name": "Standalone Without Previous Line",
"data": {},
"expected": "!",
"template": " {{! I'm Still Standalone }}\n!",
"desc": "Standalone tags should not require a newline to precede them."
},
{
"name": "Standalone Without Newline",
"data": {},
"expected": "!\n",
"template": "!\n {{! I'm Still Standalone }}",
"desc": "Standalone tags should not require a newline to follow them."
},
{
"name": "Multiline Standalone",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n{{!\nSomething's going on here...\n}}\nEnd.\n",
"desc": "All standalone comment lines should be removed."
},
{
"name": "Indented Multiline Standalone",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n {{!\n Something's going on here...\n }}\nEnd.\n",
"desc": "All standalone comment lines should be removed."
},
{
"name": "Indented Inline",
"data": {},
"expected": " 12 \n",
"template": " 12 {{! 34 }}\n",
"desc": "Inline comments should not strip whitespace"
},
{
"name": "Surrounding Whitespace",
"data": {},
"expected": "12345 67890",
"template": "12345 {{! Comment Block! }} 67890",
"desc": "Comment removal should preserve surrounding whitespace."
}
]
}
140 changes: 65 additions & 75 deletions tests/unit/data/mustache_delimiters.json
Original file line number Diff line number Diff line change
@@ -1,77 +1,67 @@
{
"tests": [
{
"name": "Pair Behavior",
"data": {
"text": "Hey!"
},
"expected": "(Hey!)",
"template": "{{=<% %>=}}(<%text%>)",
"desc": "The equals sign (used on both sides) should permit delimiter changes."
},
{
"name": "Special Characters",
"data": {
"text": "It worked!"
},
"expected": "(It worked!)",
"template": "({{=[ ]=}}[text])",
"desc": "Characters with special meaning regexen should be valid delimiters."
},
{
"name": "Sections",
"data": {
"section": true,
"data": "I got interpolated."
},
"expected": "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n",
"template": "[\n{{#section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|\n]\n",
"desc": "Delimiters set outside sections should persist."
},
{
"name": "Inverted Sections",
"data": {
"section": false,
"data": "I got interpolated."
},
"expected": "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n",
"template": "[\n{{^section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|^section|\n {{data}}\n |data|\n|/section|\n]\n",
"desc": "Delimiters set outside inverted sections should persist."
},
{
"name": "Surrounding Whitespace",
"data": {},
"expected": "| |",
"template": "| {{=@ @=}} |",
"desc": "Surrounding whitespace should be left untouched."
},
{
"name": "Outlying Whitespace (Inline)",
"data": {},
"expected": " | \n",
"template": " | {{=@ @=}}\n",
"desc": "Whitespace should be left untouched."
},
{
"name": "Standalone Tag",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n{{=@ @=}}\nEnd.\n",
"desc": "Standalone lines should be removed from the template."
},
{
"name": "Indented Standalone Tag",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n {{=@ @=}}\nEnd.\n",
"desc": "Indented standalone lines should be removed from the template."
},
{
"name": "Pair with Padding",
"data": {},
"expected": "||",
"template": "|{{= @ @ =}}|",
"desc": "Superfluous in-tag whitespace should be ignored."
}
]
"tests": [
{
"name": "Pair Behavior",
"data": { "text": "Hey!" },
"expected": "(Hey!)",
"template": "{{=<% %>=}}(<%text%>)",
"desc": "The equals sign (used on both sides) should permit delimiter changes."
},
{
"name": "Special Characters",
"data": { "text": "It worked!" },
"expected": "(It worked!)",
"template": "({{=[ ]=}}[text])",
"desc": "Characters with special meaning regexen should be valid delimiters."
},
{
"name": "Sections",
"data": { "section": true, "data": "I got interpolated." },
"expected": "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n",
"template": "[\n{{#section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|\n]\n",
"desc": "Delimiters set outside sections should persist."
},
{
"name": "Inverted Sections",
"data": { "section": false, "data": "I got interpolated." },
"expected": "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n",
"template": "[\n{{^section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|^section|\n {{data}}\n |data|\n|/section|\n]\n",
"desc": "Delimiters set outside inverted sections should persist."
},
{
"name": "Surrounding Whitespace",
"data": {},
"expected": "| |",
"template": "| {{=@ @=}} |",
"desc": "Surrounding whitespace should be left untouched."
},
{
"name": "Outlying Whitespace (Inline)",
"data": {},
"expected": " | \n",
"template": " | {{=@ @=}}\n",
"desc": "Whitespace should be left untouched."
},
{
"name": "Standalone Tag",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n{{=@ @=}}\nEnd.\n",
"desc": "Standalone lines should be removed from the template."
},
{
"name": "Indented Standalone Tag",
"data": {},
"expected": "Begin.\nEnd.\n",
"template": "Begin.\n {{=@ @=}}\nEnd.\n",
"desc": "Indented standalone lines should be removed from the template."
},
{
"name": "Pair with Padding",
"data": {},
"expected": "||",
"template": "|{{= @ @ =}}|",
"desc": "Superfluous in-tag whitespace should be ignored."
}
]
}
Loading
Loading