How can I unit test a custom language parser?

Hi,

I'm working on a custom language parser, and I'd like to be able to write JUnit tests against it, building it up one expression type at a time. Unfortunately, it's not obvious to me how to do this, short of writing a mock PsiBuilder, which I'd rather not do. Has anyone else out there been in this position? If so, how did you go about addressing this issue?

Thanks,
Kurt Christensen

1 comment
Comment actions Permalink

Hi,

I'm working on a custom language parser, and I'd like to be able to write JUnit tests against it, building it up one expression type at a time. Unfortunately, it's not obvious to me how to do this, short of writing a mock PsiBuilder, which I'd rather not do. Has anyone else out there been in this position? If so, how did you go about addressing this issue?

Thanks,
Kurt Christensen


We usually do this in a more functional-test way, just create a lot of
simple example texts to parse and check the resulting tree. You can look
for examples in JavaScript (JSParseTest) or Velocity (VtlParserTest)
open-source plugins.

0

Please sign in to leave a comment.