From a3948a0f0637827eacf6728b73503270c879211f Mon Sep 17 00:00:00 2001 From: magraina Date: Thu, 7 Nov 2024 15:58:42 +0100 Subject: [PATCH] test: add test for numbers with exponent and decimal point --- src/lexical-analysis/lexical-analyser.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lexical-analysis/lexical-analyser.test.ts b/src/lexical-analysis/lexical-analyser.test.ts index 14a64f8..95984ca 100644 --- a/src/lexical-analysis/lexical-analyser.test.ts +++ b/src/lexical-analysis/lexical-analyser.test.ts @@ -119,15 +119,16 @@ describe('lexicalAnalyser', () => { assert.deepStrictEqual(tokens[2], { column: 3, line: 1, type: 'number', value: '456.789' }); }); it('should identify numbers with exponent', () => { - const code = '123e4 456e-4 789E4 456e+4'; + const code = '123e4 456e-4 789E4 456e+4 56.12e4'; const tokens = lexicalAnalyser(code); - assert.strictEqual(tokens.length, 4); + assert.strictEqual(tokens.length, 5); assert.deepStrictEqual(tokens[0], { column: 1, line: 1, type: 'number', value: '123e4' }); assert.deepStrictEqual(tokens[1], { column: 2, line: 1, type: 'number', value: '456e-4' }); assert.deepStrictEqual(tokens[2], { column: 3, line: 1, type: 'number', value: '789E4' }); assert.deepStrictEqual(tokens[3], { column: 4, line: 1, type: 'number', value: '456e+4' }); + assert.deepStrictEqual(tokens[4], { column: 5, line: 1, type: 'number', value: '56.12e4' }); }); }); describe('identifiers', () => {