Open sgowroji opened 11 months ago
Could be caused by my change #5743
Nope, wasn't it always like that @mai93
I reviewed the notes for manual testing and yes in C++ the binary and test runs should be invoked from the target in the BUILD file. But when we tried running the test from the .cc file worked, I'm not sure if fixing it for the binary is something we want to keep in mind or close this bug as not planned.
O haven't looked at the code in the picture. Indeed, we shouldn't print test
for main
function run
There is a cc_test
target for the .cc file here that I did not notice before, so I'm not sure if this is WAI now? @blorente who added this target, what do you think?
This is intentional as per https://github.com/bazelbuild/intellij/pull/4786
The heuristic introduced there goes like: If there is a "main" function and a cc_test
target, please treat it as a test.
It's definitely a heuristic more than a hard rule, we (internally, at Apple) just found that it suited us well for tests that were essentially "just a main function".
I assumed, perhaps incorrectly, that a main function would be either a test or a binary, not both.
I'm happy to:
cc_test
is it's own separate main function.I think what needs to be updated is if there is also a cc_binary
target for the same "main" function then which rule should be used. I think we can separate the targets in the example project for now.
Description of the bug:
The Clion Bazel plugin shows the "Bazel test" for the Helloworld.cc class from the sample CPP of the example project.
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Import Clion project and do a sync. Then go to https://github.com/bazelbuild/intellij/blob/master/examples/cpp/simple_project/src/hello_world.cc class and click on Green icon beside
int main(int argc, char** argv) {
main method. it showsBazel test src
which is confusing.for reference https://screenshot.googleplex.com/95UVRLzpsj9zPHp
Which Intellij IDE are you using? Please provide the specific version.
CLION 2023.2.
What programming languages and tools are you using? Please provide specific versions.
CPP
What Bazel plugin version are you using?
v2023.11.07
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response