mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
compiler unit test harness
This commit is contained in:
@@ -319,4 +319,28 @@ Tinytest.add("spacebars - parser", function (test) {
|
||||
"elseTokens":[
|
||||
{"type":"StartTag","name":"hr","data":[]}]}]},
|
||||
{"type":"EndTag","name":"div"}]});
|
||||
});
|
||||
});
|
||||
|
||||
Tinytest.add("spacebars - compiler", function (test) {
|
||||
|
||||
var run = function (input/*, expectedLines*/) {
|
||||
var expectedLines = Array.prototype.slice.call(arguments, 1);
|
||||
var expected = expectedLines.join('\n');
|
||||
var output = Spacebars.compile(input);
|
||||
test.equal(output, expected);
|
||||
};
|
||||
|
||||
run('abc',
|
||||
|
||||
'function (buf) {',
|
||||
' buf.text("abc");',
|
||||
'}');
|
||||
|
||||
run('<a foo=bar>abc</a>',
|
||||
|
||||
'function (buf) {',
|
||||
' buf.openTag("a", {"foo":"bar"});',
|
||||
' buf.text("abc");',
|
||||
' buf.closeTag("a");',
|
||||
'}');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user