瀏覽代碼

Merge with master

tags/0.5.0-vsc
Sahab Yazdani 15 年之前
父節點
當前提交
084ad6dc73
共有 1 個文件被更改,包括 34 次插入31 次删除
  1. +34
    -31
      test/unit.js

+ 34
- 31
test/unit.js 查看文件

@@ -43,18 +43,19 @@ test("Parser", function() {
'Hello\n\n\nWorld\n',
'Preservation of white space'
);
try {
Mustache.to_html(
'{{=tag1}}',
{ tag1: 'Hello' },
{}
);

ok(false);
} catch (e) {
equals(e.message, 'Malformed change delimiter token: {{=tag1}}');
}
raises(
function() {
Mustache.to_html(
'{{=tag1}}',
{ tag1: 'Hello' },
{}
);
}, function(e) {
return e.message === 'Unexpected end of document.';
},
'Malformed change delimiter token: {{=tag1}}'
);
//var partials = { 'partial' : '{{key}}' };
//Mustache.compile('{{>partial}}', partials );
@@ -368,16 +369,18 @@ test("'>' (Partials)", function() {
'1\n\n1.1\n\n1.1.1\n\n\n'
);
try {
Mustache.to_html(
'{{>partial}}',
{},
{partal: ''}
);
ok(false);
} catch(e) {
equals(e.message, "Unknown partial 'partial'");
}
raises(
function() {
Mustache.to_html(
'{{>partial}}',
{},
{partal: ''}
);
}, function(e) {
return e.message === "Unknown partial 'partial'";
},
'Missing partials should be handled correctly.'
);
});

test("'=' (Set Delimiter)", function() {
@@ -445,20 +448,20 @@ test("'%' (Pragmas)", function() {
);
// matches unknown_pragma.txt
try {
equals(
raises(
function() {
Mustache.to_html(
'{{%I-HAVE-THE-GREATEST-MUSTACHE}}\n',
{},
{}
),
'hello world ',
'IMPLICIT-ITERATOR pragma'
);
ok(false);
} catch (e) {
equals(e.message, 'This implementation of mustache does not implement the "I-HAVE-THE-GREATEST-MUSTACHE" pragma');
}
);
},
function(e) {
return e.message === 'This implementation of mustache does not implement the "I-HAVE-THE-GREATEST-MUSTACHE" pragma';
},
'Notification of unimplemented pragmas'
);
equals(
Mustache.to_html(


Loading…
取消
儲存