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
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
dmitriy.novozhilov
05/10/2023, 10:23 AM
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
Tóth István Zoltán
05/10/2023, 10:27 AM
Ah, thank you, I didn't know about this one.
d
dmitriy.novozhilov
05/10/2023, 10:28 AM
Here is a doc which describes how this framework works