From 30dffb675e178b45cdeb1431f301c3db16110948 Mon Sep 17 00:00:00 2001 From: wyozi Date: Fri, 9 Oct 2020 15:20:11 +0300 Subject: [PATCH] Test for broken quoted property access --- test/unit/parser/tokenizer.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/unit/parser/tokenizer.ts b/test/unit/parser/tokenizer.ts index 7f5810651..743edf7c9 100644 --- a/test/unit/parser/tokenizer.ts +++ b/test/unit/parser/tokenizer.ts @@ -39,6 +39,10 @@ describe('Tokenize', function () { expect(value).to.be.instanceOf(PropertyAccessToken) expect((value as PropertyAccessToken).variable.getText()).to.equal('"a prop"') }) + it('should throw for broken quoted property access', () => { + const tokenizer = new Tokenizer('[5]') + expect(() => tokenizer.readValueOrThrow()).to.throw() + }) it('should throw for incomplete quoted property access', () => { const tokenizer = new Tokenizer('["a prop"') expect(() => tokenizer.readValueOrThrow()).to.throw()