linkrope / dunit

xUnit Testing Framework for D
Boost Software License 1.0
37 stars 9 forks source link

Wrong test result #13

Open andre2007 opened 6 years ago

andre2007 commented 6 years ago

The following sample has 1 test class with 1 test method but the output shows 2 tests in console and also in the xml report.

dub test --skip-registry=all -- --report=dunit.xml
..
Tests run: 2, Failures: 0, Errors: 0, Skips: 0
OK

dunit.xml

<testsuites>
    <testsuite name="dunit">
        <testcase name="unittest" time="0.000" classname="app" />
        <testcase name="checkAnswer" time="0.000" classname="tests.tests.TestCase" />
    </testsuite>
</testsuites>

dlang-sample.zip

linkrope commented 6 years ago

Seems that dmd invents a unittest function in app.d in certain situations. The easiest fix is to remove the feature "run unittest functions like @test functions" introduced in 0.8.0. What do you think?

andre2007 commented 6 years ago

My gut feeling is, the unittest function is introduced by dub but I have to do deeper investigations. If I find found out which component causes the additional unittest function I will create an issue either on dub/dmd. Having the unittest functions handled in the same way like the @test functions is a good feature in my opinion. Maybe someone want to enable/disable this by a e.g. console argument but for me it is highly valuable.

As d-unit shows the "truth" and the bug is not d-unit related I think this issue can be closed. What do you think?