aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2022-01-14 19:43:45 +0530
committerAkshay Nair <phenax5@gmail.com>2022-01-14 20:31:58 +0530
commitc2c6e8d1258158f61fba026ded1e48ffc5b36cf6 (patch)
tree1762185b79411d0c64880cc43e5639a8a1e3d35d /tests
parent564bd628e98dc44767891249e45677948e6ec17a (diff)
downloadelxr-c2c6e8d1258158f61fba026ded1e48ffc5b36cf6.tar.gz
elxr-c2c6e8d1258158f61fba026ded1e48ffc5b36cf6.zip
feat(eval): implements 0 or more quantifier
Diffstat (limited to 'tests')
-rw-r--r--tests/basic.spec.ts22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/basic.spec.ts b/tests/basic.spec.ts
index dfa5e40..33a4228 100644
--- a/tests/basic.spec.ts
+++ b/tests/basic.spec.ts
@@ -1,7 +1,12 @@
+import {jlog} from '../src/utils'
import { matchAll } from '../src'
describe('Basic tests', () => {
describe('matchAll', () => {
+ it('should do shit', () => {
+ // jlog(matchAll(/\s+/, [1, '2', '', '3', 5, '6']))
+ })
+
it('should filter shit', () => {
expect(matchAll(/\s/, [1, '2', 3, '4']).groups).toEqual([
{ value: '2', index: 1 },
@@ -70,7 +75,7 @@ describe('Basic tests', () => {
])
})
- it('should match object property matchers', () => {
+ it('should match object property matchers multi', () => {
expect(
matchAll(/([age \n][age \T])+/, [
{},
@@ -82,6 +87,21 @@ describe('Basic tests', () => {
).toEqual([{ value: [{ age: 1 }, { age: 2 }], index: 1 }])
expect(
+ matchAll(/([age \n][age \T])*/, [
+ {},
+ { age: 1 },
+ { age: 2 },
+ { age: 0 },
+ '',
+ ]).groups,
+ ).toEqual([
+ { value: [], index: 0 },
+ { value: [{ age: 1 }, { age: 2 }], index: 1 },
+ { value: [], index: 3 },
+ { value: [], index: 4 },
+ ])
+
+ expect(
matchAll(/ [num \n\T]+ /, [
null,
{ num: 1 },