Skip to content

Commit

Permalink
test(parser): name prop
Browse files Browse the repository at this point in the history
  • Loading branch information
sovrin committed Dec 1, 2023
1 parent 64fdea9 commit 0e262df
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,18 @@ describe('onia', () => {
});
});

describe('names', () => {
it('should return expected parser names', () => {
assert.equal(alpha(null).name , '[Parser alpha]');
assert.equal(regex(null).name, '[Parser regex]');
assert.equal(sequence(null).name, '[Parser sequence]');
assert.equal(any(null).name, '[Parser any]');
assert.equal(optional(null).name, '[Parser optional]');
assert.equal(many(null).name, '[Parser many]');
assert.equal(map(null, null).name, '[Parser map]');
});
});

describe('example', () => {
const digit = map(
regex(/\d/g, 'digit'),
Expand Down

0 comments on commit 0e262df

Please sign in to comment.