mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
Make end brace peek stricter and fix the test
This commit is contained in:
@@ -211,7 +211,8 @@ export class Tokenizer {
|
||||
this.p++
|
||||
const prop = this.readQuoted()
|
||||
if (!prop) return
|
||||
this.readTo(']')
|
||||
if (this.peek() !== ']') return
|
||||
this.p++
|
||||
return new PropertyAccessToken(prop, [], this.p)
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ describe('Tokenize', function () {
|
||||
expect((value as PropertyAccessToken).variable.getText()).to.equal('"a prop"')
|
||||
})
|
||||
it('should throw for incomplete quoted property access', () => {
|
||||
const tokenizer = new Tokenizer('["a prop"]')
|
||||
expect(() => tokenizer.readValue()).to.throw()
|
||||
const tokenizer = new Tokenizer('["a prop"')
|
||||
expect(() => tokenizer.readValueOrThrow()).to.throw()
|
||||
})
|
||||
it('should read hash', () => {
|
||||
const hash1 = new Tokenizer('foo: 3').readHash()
|
||||
|
||||
Reference in New Issue
Block a user