mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
enable cache: parse and render
This commit is contained in:
+6
-6
@@ -4,7 +4,7 @@ var sinon = require("sinon");
|
||||
var expect = chai.expect;
|
||||
chai.use(sinonChai);
|
||||
|
||||
var liquid = require('..')(), ctx;
|
||||
var engine = require('..')(), ctx;
|
||||
|
||||
function test(func, cb){
|
||||
try{
|
||||
@@ -20,7 +20,7 @@ describe('error', function() {
|
||||
|
||||
it('should throw TokenizationError when tag illegal', function() {
|
||||
test(function(){
|
||||
liquid.render('{% -a %}', {});
|
||||
engine.parseAndRender('{% -a %}', {});
|
||||
}, function(err){
|
||||
expect(err.name).to.equal('TokenizationError');
|
||||
expect(err.message).to.equal('illegal tag: {% -a %}');
|
||||
@@ -31,7 +31,7 @@ describe('error', function() {
|
||||
|
||||
it('should throw correct error info', function() {
|
||||
test(function(){
|
||||
liquid.render('{%if true%}\naaa{%endif%}\n{% -a %}\n3', {});
|
||||
engine.parseAndRender('{%if true%}\naaa{%endif%}\n{% -a %}\n3', {});
|
||||
}, function(err){
|
||||
expect(err.input).to.equal('{% -a %}');
|
||||
expect(err.line).to.equal(3);
|
||||
@@ -40,7 +40,7 @@ describe('error', function() {
|
||||
|
||||
it('should throw ParseError when filter not exist', function() {
|
||||
test(function(){
|
||||
liquid.render('{{ a | xz }}', {});
|
||||
engine.parseAndRender('{{ a | xz }}', {});
|
||||
}, function(err){
|
||||
expect(err.name).to.equal('ParseError');
|
||||
expect(err.message).to.equal('filter "xz" not found');
|
||||
@@ -50,7 +50,7 @@ describe('error', function() {
|
||||
});
|
||||
it('should throw ParseError when tag not exist', function() {
|
||||
test(function(){
|
||||
liquid.render('{% a %}', {});
|
||||
engine.parseAndRender('{% a %}', {});
|
||||
}, function(err){
|
||||
expect(err.name).to.equal('ParseError');
|
||||
expect(err.message).to.equal('tag a not found');
|
||||
@@ -61,7 +61,7 @@ describe('error', function() {
|
||||
|
||||
it('should throw ParseError when tag not closed', function() {
|
||||
test(function(){
|
||||
liquid.render('{% if %}', {});
|
||||
engine.parseAndRender('{% if %}', {});
|
||||
}, function(err){
|
||||
expect(err.name).to.equal('ParseError');
|
||||
expect(err.message).to.equal('tag {% if %} not closed');
|
||||
|
||||
Reference in New Issue
Block a user