diff --git a/test/unit.js b/test/unit.js
index eb3e2aa..c0caf9c 100644
--- a/test/unit.js
+++ b/test/unit.js
@@ -25,7 +25,7 @@ test("Parser", function() {
},
{partial:'Hello {{ name}}\nYou have just won ${{value }}!\n{{# in_ca }}\nWell, ${{ taxed_value }}, after taxes.\n{{/ in_ca }}\n'}
),
- '
Welcome
\nHello Chris\nYou have just won $10000!\nWell, $6000, after taxes.\n\nFair enough, right?
',
+ 'Welcome
\nHello Chris\nYou have just won $10000!\n\nWell, $6000, after taxes.\n\n\nFair enough, right?
',
'Whitespace in Tag names'
);
@@ -39,15 +39,18 @@ test("Parser", function() {
'Preservation of white space'
);
- equals(
+ try {
Mustache.to_html(
'{{=tag1}}',
{ tag1: 'Hello' },
{}
- ),
- '{{=tag1}}',
- 'ignore equal sign'
- );
+ );
+
+ ok(false);
+ } catch (e) {
+ equals(e.message, 'Unexpected end of document.');
+ }
+
});
test("Basic Variables", function() {
@@ -65,7 +68,7 @@ test("Basic Variables", function() {
},
{}
),
- 'Bear > Shark
\nBut not ".\n',
+ 'Bear > Shark
\nBut not ".\n',
'HTML Escaping'
);
@@ -146,7 +149,7 @@ test("'#' (Sections)", function() {
{ numbers: ['1', '2', '3', '4'] },
{ partial: '{{.}}' }
),
- 'Here is some stuff!\n1\n2\n3\n4\n',
+ 'Here is some stuff!\n\n1\n\n2\n\n3\n\n4\n',
'Array of Partials (Implicit)'
);
@@ -157,7 +160,7 @@ test("'#' (Sections)", function() {
{ numbers: [{i: '1'}, {i: '2'}, {i: '3'}, {i: '4'}] },
{ partial: '{{i}}' }
),
- 'Here is some stuff!\n1\n2\n3\n4\n',
+ 'Here is some stuff!\n\n1\n\n2\n\n3\n\n4\n',
'Array of Partials (Explicit)'
);
@@ -187,7 +190,7 @@ test("'#' (Sections)", function() {
},
{}
),
- 'Hi Tater. To tinker?'
+ 'Hi Tater. To tinker?\n'
);
// matches recursion_with_same_names.html
@@ -204,7 +207,7 @@ test("'#' (Sections)", function() {
},
{}
),
- 'name\ndesc\n\n t1\n 0\n t2\n 1\n'
+ 'name\ndesc\n\n\n t1\n 0\n\n t2\n 1\n\n'
);
// matches reuse_of_enumerables.html
@@ -219,7 +222,7 @@ test("'#' (Sections)", function() {
},
{}
),
- ' t1\n 0\n t2\n 1\n t1\n 0\n t2\n 1\n',
+ '\n t1\n 0\n t2\n 1\n\n t1\n 0\n t2\n 1\n\n',
'Lazy match of Section and Inverted Section'
);
@@ -236,7 +239,7 @@ test("'#' (Sections)", function() {
},
{}
),
- ' this is an object
\n one of its attributes is a list
\n \n - listitem1
\n - listitem2
\n
\n',
+ '\n this is an object
\n one of its attributes is a list
\n \n - listitem1
\n - listitem2
\n
\n',
'Lazy match of Section and Inverted Section'
);
});
@@ -253,7 +256,7 @@ test("'^' (Inverted Section)", function() {
},
{}
),
- 'No repos :('
+ '\nNo repos :(\n'
);
});
@@ -284,7 +287,7 @@ test("'>' (Partials)", function() {
},
{partial: 'Hello {{name}}\nYou have just won ${{value}}!\n{{#in_ca}}\nWell, ${{ taxed_value }}, after taxes.\n{{/in_ca}}\n'}
),
- 'Welcome
\nHello Chris\nYou have just won $10000!\nWell, $6000, after taxes.\n\nFair enough, right?
'
+ 'Welcome
\nHello Chris\nYou have just won $10000!\n\nWell, $6000, after taxes.\n\n\nFair enough, right?
'
);
// matches array_partial.html
@@ -298,7 +301,7 @@ test("'>' (Partials)", function() {
},
{ partial: 'Here\'s a non-sense array of values\n{{#array}}\n {{.}}\n{{/array}}' }
),
- 'Here\'s a non-sense array of values\n 1\n 2\n 3\n 4\n'
+ 'Here\'s a non-sense array of values\n\n 1\n\n 2\n\n 3\n\n 4\n'
);
// matches template_partial.html
@@ -335,7 +338,7 @@ test("'>' (Partials)", function() {
},
{partial:'{{name}}\n{{#children}}\n{{>partial}}\n{{/children}}'}
),
- '1\n1.1\n1.1.1\n\n\n'
+ '1\n\n1.1\n\n1.1.1\n\n\n'
);
try {
@@ -346,7 +349,7 @@ test("'>' (Partials)", function() {
);
ok(false);
} catch(e) {
- equals(e.message, "unknown_partial 'partial'");
+ equals(e.message, "Unknown partial 'partial'");
}
});
@@ -365,7 +368,7 @@ test("'=' (Set Delimiter)", function() {
},
{}
),
- '*\nIt worked the first time.\n* And it worked the second time.\n* Then, surprisingly, it worked the third time.\n* Fourth time also fine!.',
+ '*\nIt worked the first time.\n* And it worked the second time.\n\n* Then, surprisingly, it worked the third time.\n\n* Fourth time also fine!.',
'Simple Set Delimiter'
);
});
@@ -473,7 +476,7 @@ test("Demo", function() {
},
{}
),
- 'Hello Chris\nYou have just won $10000!\nWell, $6000, after taxes.\n',
+ 'Hello Chris\nYou have just won $10000!\n\nWell, $6000, after taxes.\n',
'A simple template'
);
@@ -559,7 +562,7 @@ test("Regression Suite", function() {
{ enumerate: [ { text: 'A' }, { text: 'B' } ] },
{ partial: '{{=[[ ]]=}}\n{{text}}\n[[={{ }}=]]' }
),
- '{{text}}\n\n{{text}}\n\n',
+ '\n\n{{text}}\n\n\n\n{{text}}\n\n',
'Issue 44'
);