Skip to content

Unit Test Parsing #340

Answered by msujew
ballcoach12 asked this question in Q&A
Jan 5, 2022 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

Hi @ballcoach12,

we actually provide a parseHelper function, but it's exported from the langium/lib/test path of the framework.

You can see how it works in action:

https://github.com/langium/langium/blob/850f92226032aaa74a4695d5d8847a9a3026332f/packages/langium/test/parser/token-builder.test.ts#L27

It basically creates a curried function based on an instance of LangiumServices. Afterwards you can throw in any text and get a LangiumDocument back.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@ballcoach12
Comment options

@ballcoach12
Comment options

@ballcoach12
Comment options

@msujew
Comment options

@ballcoach12
Comment options

Answer selected by ballcoach12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants