From 27e579e0e2ae3f1e36e7f9f24d4fb6a267ca29bb Mon Sep 17 00:00:00 2001 From: Harttle Date: Sat, 5 Mar 2022 22:09:36 +0800 Subject: [PATCH] test: case for {% assign %} invalid value, closes #446 --- test/integration/builtin/tags/assign.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/integration/builtin/tags/assign.ts b/test/integration/builtin/tags/assign.ts index f27c60a2b..5f08b9999 100644 --- a/test/integration/builtin/tags/assign.ts +++ b/test/integration/builtin/tags/assign.ts @@ -6,7 +6,7 @@ use(chaiAsPromised) describe('tags/assign', function () { const liquid = new Liquid() - it('should throw when variable expression illegal', function () { + it('should throw when variable name illegal', function () { const src = '{% assign / %}' const ctx = {} return expect(liquid.parseAndRender(src, ctx)).to.be.rejectedWith(/illegal/) @@ -16,6 +16,10 @@ describe('tags/assign', function () { const html = await liquid.parseAndRender(src) return expect(html).to.equal('bar') }) + it('should throw when variable value illegal', async function () { + const src = '{% assign foo = “bar” %}' + return expect(liquid.parseAndRender(src)).to.be.rejectedWith(/unexpected token at "“bar”"/) + }) it('should support assign to a number', async function () { const src = '{% assign foo=10086 %}{{foo}}' const html = await liquid.parseAndRender(src)