Skip to content

Commit

Permalink
Fixes syntax highlighting for bad grammar. See: peggyjs/code-peggy-la…
Browse files Browse the repository at this point in the history
  • Loading branch information
hildjj committed Jun 6, 2022
1 parent d237918 commit c85e909
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ import assert from "node:assert";
import peggy from "../lib/index.js";
import test from "node:test";

// Don't syntax-highlight the intentionally-invalid code.
const bad = peggy;

test("happy path", () => {
const parser = peggy`foo = "foo"`;
assert(parser("foo"), "foo");
});

test("bad grammar", () => {
assert.throws(
() => peggy`foo = "foo`,
() => bad`foo = "foo`,
"1 | foo"
);
});
Expand Down

0 comments on commit c85e909

Please sign in to comment.