From b33e9ee8dc16f81c474eb861b7b01e398cec7e53 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 29 Jun 2024 09:30:55 +0100 Subject: [PATCH] fix our tests --- test/core.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/core.ts b/test/core.ts index a4ad393..b6ff74e 100644 --- a/test/core.ts +++ b/test/core.ts @@ -1,28 +1,33 @@ import assert from 'assert'; import * as P from '../src/internal/core'; +const state = { + nestLimit: 3, + depth: 0, +}; + describe('core', () => { describe('difference', () => { test('basic', () => { const parser = P.difference(P.regexp(/\p{Letter}/u), P.str('x')); - let result = parser.handler('x',0,{}) as P.Success; + let result = parser.handler('x',0,state) as P.Success; assert.deepStrictEqual(result,P.failure()); - result = parser.handler('a',0,{}) as P.Success; + result = parser.handler('a',0,state) as P.Success; assert.deepStrictEqual(result,P.success(1,'a')); }); test('horizontal whitespace', () => { const parser = P.difference(P.regexp(/\s/u), P.newline); - let result = parser.handler('\n',0,{}) as P.Success; + let result = parser.handler('\n',0,state) as P.Success; assert.deepStrictEqual(result,P.failure()); - result = parser.handler(' ',0,{}) as P.Success; + result = parser.handler(' ',0,state) as P.Success; assert.deepStrictEqual(result,P.success(1,' ')); - result = parser.handler('\t',0,{}) as P.Success; + result = parser.handler('\t',0,state) as P.Success; assert.deepStrictEqual(result,P.success(1,'\t')); });