mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 12:20:40 -07:00
feat: throw an Error if delimiter not matched
This commit is contained in:
@@ -6,7 +6,7 @@ import HTMLToken from 'src/parser/html-token'
|
||||
|
||||
describe('tokenizer', function () {
|
||||
const tokenizer = new Tokenizer()
|
||||
describe('parse', function () {
|
||||
describe('#tokenize()', function () {
|
||||
it('should handle plain HTML', function () {
|
||||
const html = '<html><body><p>Lorem Ipsum</p></body></html>'
|
||||
const tokens = tokenizer.tokenize(html)
|
||||
@@ -66,5 +66,15 @@ describe('tokenizer', function () {
|
||||
expect(tokens[0]).instanceOf(OutputToken)
|
||||
expect(tokens[0].raw).to.equal('{{foo\n|date:\n"%Y-%m-%d"\n}}')
|
||||
})
|
||||
it('should throw if tag not closed', function () {
|
||||
expect(() => {
|
||||
tokenizer.tokenize('{% assign foo = bar {{foo}}')
|
||||
}).to.throw(/tag "{% assign foo..." not closed/)
|
||||
})
|
||||
it('should throw if output not closed', function () {
|
||||
expect(() => {
|
||||
tokenizer.tokenize('{{name}')
|
||||
}).to.throw(/output "{{name}" not closed/)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user