tycho icon indicating copy to clipboard operation
tycho copied to clipboard

Enabling assertions should take an argument

Open khatchad opened this issue 2 years ago • 5 comments

On the command line, -ea takes an argument (the package). However, the property in the tycho surefire test configuration does not:

https://tycho.eclipseprojects.io/doc/latest/tycho-surefire-plugin/test-mojo.html

khatchad avatar Oct 24 '23 14:10 khatchad

@khatchad do you like to propose a PR at best with an integration-test to demonstrate the issue?

laeubi avatar Oct 24 '23 14:10 laeubi

I think it's more of an enhancement than an issue. The workaround is as follows:

<properties>
  <!-- Enable assertions for the xyz.abc package and its subpackages. -->
  <tycho.testArgLine>-ea:xyz.abc...</tycho.testArgLine>
</properties>

I'll have a look.

khatchad avatar Oct 24 '23 15:10 khatchad

Looks like there's an existing assertions test. And, here's the corresponding field:

https://github.com/eclipse-tycho/tycho/blob/0fde42d1731d8084ad8997fc9e232ac51f5574da/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/AbstractEclipseTestMojo.java#L220-L227

khatchad avatar Oct 24 '23 15:10 khatchad

@laeubi What is the desired API change here? How are configuration parameters that optimally take arguments typically handled in Tycho?

khatchad avatar Oct 25 '23 10:10 khatchad

In this case I would simply go for changing boolean -> String parameter, then where it is used we can check if it is true/false --> work as before, else assume it is a package name to be passed as -ea parameter.

laeubi avatar Oct 25 '23 10:10 laeubi