Skip to content

Commit

Permalink
Merge pull request peggyjs#484 from hildjj/test-library
Browse files Browse the repository at this point in the history
Fixes peggyjs#481.  Adds --library test to CLI
  • Loading branch information
hildjj authored Feb 23, 2024
2 parents 1043631 + 3289a3a commit eb90c17
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Released: TBD
- [#479](https://github.com/peggyjs/peggy/issues/379)
Refactor `cli/fromMem.js` into separate project
[from-mem](https://github.com/peggyjs/from-mem/).
- [#481](https://github.com/peggyjs/peggy/issues/481) Add CLI test for
--library
- [#483](https://github.com/peggyjs/peggy/issues/483) fix errors in
typescript file.

4.0.0
-----
Expand Down
16 changes: 16 additions & 0 deletions test/cli/run.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,21 @@ error: Rule "unknownRule" is not defined
expect(parse("baz")).toBe("baz");
});

it("produces library-style output", async() => {
await exec({
args: ["-t", "boo", "--library"],
stdin: "foo = 'boo'",
expected: `\
{
'peg$result': 'boo',
'peg$currPos': 3,
'peg$FAILED': {},
'peg$maxFailExpected': [],
'peg$maxFailPos': 0
}\n`,
});
});

describe("--watch option", () => {
it("rejects stdin for watching", async() => {
await exec({
Expand Down Expand Up @@ -1349,3 +1364,4 @@ error: Rule "unknownRule" is not defined
});
});
});

0 comments on commit eb90c17

Please sign in to comment.