unittest-cov - results?

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 5 12:01:06 PDT 2017


On Wednesday, July 05, 2017 18:50:32 Jolly James via Digitalmars-d-learn 
wrote:
> On Wednesday, 5 July 2017 at 18:46:38 UTC, Jolly James wrote:
> > On Wednesday, 5 July 2017 at 18:09:46 UTC, Seb wrote:
> >> On Wednesday, 5 July 2017 at 17:46:01 UTC, Jolly James wrote:
> >>> [...]
> >>
> >> For every file a `<file>.lst` file is generated (it's the same
> >> how `-cov` behaves at DMD).
> >> These .lst files contain the original source code with number
> >>
> >> of hits of a respective line:
> >>       2|    auto copy = new char[s.length + 1];
> >>       2|    copy[0 .. s.length] = s[];
> >>       2|    copy[s.length] = 0;
> >>
> >> Maybe you haven't seen the lst files?
> >>
> >>
> >> Btw if you use Travis, you can use an `after_success` event to
> >> your `.travis.yml` to upload the results to CodeCov for a nice
> >> visuals & PR integration:
> >>
> >> ```
> >>
> >> after_success:
> >>  - bash <(curl -s https://codecov.io/bash)
> >>
> >> ```
> >>
> >> We do this on most dlang repos, e.g.
> >> https://github.com/dlang/phobos/pull/5503
> >
> > where would I find these *.lst files. Searching for '*.lst' in
> > the source's root dir doesn't bring any results.
>
> I have changed the 'build' to 'test' in the command. Now at least
> I get the following message: "All unit tests have been run
> successfully." which should not actually happen, as my code
> contains an 'assert(false);' unittest.

If you don't run the tests, you won't get any code coverage. Building with

dub test --coverage

should do it. As for your assert(false) test failing, was it in the same
module with your main in it? I ran into a bug in dub not all that long ago
where the tests in the module with main in it weren't actually being run
even though the other tests were. (which reminds me, I should verify that
again and report it).

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list