From 3dbea456237b2d1f97b65a4c0ccda8fb39fbf9e3 Mon Sep 17 00:00:00 2001 From: uzmoi Date: Thu, 17 Oct 2024 23:41:56 +0900 Subject: [PATCH] improve test --- test/interpreter.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test/interpreter.ts b/test/interpreter.ts index 484a63f3..178e1b06 100644 --- a/test/interpreter.ts +++ b/test/interpreter.ts @@ -133,7 +133,12 @@ describe('callstack', () => { @function2() { function1() } function2() `); - expect(result).toMatch(/at function1.+at function2/s); + expect(result).toMatchInlineSnapshot(` + "emitError + at function1 (Line 2, Column 28) + at function2 (Line 3, Column 28) + at (Line 4, Column 13)" + `); }); test('error in function in namespace', async () => { const result = await exeAndGetErrMessage(` @@ -142,12 +147,20 @@ describe('callstack', () => { } Ai:function() `); - expect(result).toContain("at Ai:function"); + expect(result).toMatchInlineSnapshot(` + "emitError + at Ai:function (Line 3, Column 28) + at (Line 5, Column 15)" + `); }); test('error in anonymous function', async () => { const result = await exeAndGetErrMessage(` (@() { emitError() })() `); - expect(result).toContain('at '); + expect(result).toMatchInlineSnapshot(` + "emitError + at (Line 2, Column 20) + at (Line 2, Column 25)" + `); }); });