Skip to content

Commit fafae9c

Browse files
committed
Add tests for parser references and nesting functionality
1 parent d771b19 commit fafae9c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/composite-parser.test.ts

+9
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,15 @@ function compositeParserTests(
654654
it("should be able to refer to other parsers by name", () => {
655655
const parser = Parser.start().namely("self");
656656

657+
// @ts-ignore
658+
const stop = Parser.start().namely("stop");
659+
660+
// @ts-ignore
661+
const twoCells = Parser.start()
662+
.namely("twoCells")
663+
.nest("left", { type: "self" })
664+
.nest("right", { type: "stop" });
665+
657666
parser.uint8("type").choice("data", {
658667
tag: "type",
659668
choices: {

0 commit comments

Comments
 (0)