From 3289a3a9996bb7977542c39e276d3afd3ca12daf Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Fri, 23 Feb 2024 13:28:28 -0700 Subject: [PATCH] Fixes #481. Adds --library test to CLI --- CHANGELOG.md | 4 ++++ test/cli/run.spec.ts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b48e93d1..9f34f89a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ----- diff --git a/test/cli/run.spec.ts b/test/cli/run.spec.ts index 53feafd4..37c1c5d8 100644 --- a/test/cli/run.spec.ts +++ b/test/cli/run.spec.ts @@ -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({ @@ -1349,3 +1364,4 @@ error: Rule "unknownRule" is not defined }); }); }); +