I try to write unit tests for my complier plugin u...
# compiler
t
I try to write unit tests for my complier plugin using kotlin-compile-testing. The tests that are supposed to generate a compilation error are successful. The result of the compilation is COMPILATION_ERROR, this is good. However, IDEA recognises the error and reports it (see the screenshot attached). I use
pluginContext.createDiagnosticReporter(_PLUGIN_ID_)
to create a diagnostics reporter and send the errors through that reporter. Is there a smarter way to do this? It is an inconvenience only but I don't like that the build seems like an error even when it is successful.
d
Can't say anything about
kotlin-compiler-testing
, but I can suggest to use test framework which is used in kotlin compiler itself Here you can find the example of plugin and test framework setup
t
Ah, thank you, I didn't know about this one.
d
Here is a doc which describes how this framework works