digitalmars.D.learn - unittest-cov - results?
- Jolly James (2/4) Jul 05 2017 After execution, there is no result output in the command line.
-
Seb
(18/22)
Jul 05 2017
For every file a `
.lst` file is generated (it's the same - Jolly James (3/22) Jul 05 2017 where would I find these *.lst files. Searching for '*.lst' in
- Jolly James (5/34) Jul 05 2017 I have changed the 'build' to 'test' in the command. Now at least
- Jonathan M Davis via Digitalmars-d-learn (10/47) Jul 05 2017 If you don't run the tests, you won't get any code coverage. Building wi...
- Jolly James (6/24) Jul 05 2017 The following command does not change anything:
- Jonathan M Davis via Digitalmars-d-learn (17/44) Jul 05 2017 I don't know why you'd need arch if you're running the tests on the same
- 0xEAB (6/29) Jul 25 2017 Hello,
- Sebastiaan Koppe (6/11) Jul 05 2017 Noticed it as well couple of months ago. I think dub just skips
How does unit testing with dub work?dub build --arch=x86_64 --build=unittest-cov --force --compiler=ldc2After execution, there is no result output in the command line.
Jul 05 2017
On Wednesday, 5 July 2017 at 17:46:01 UTC, Jolly James wrote:How does unit testing with dub work?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/5503dub build --arch=x86_64 --build=unittest-cov --force --compiler=ldc2After execution, there is no result output in the command line.
Jul 05 2017
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:where would I find these *.lst files. Searching for '*.lst' in the source's root dir doesn't bring any results.[...]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
Jul 05 2017
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: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.On Wednesday, 5 July 2017 at 17:46:01 UTC, Jolly James wrote:where would I find these *.lst files. Searching for '*.lst' in the source's root dir doesn't bring any results.[...]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
Jul 05 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: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 DavisOn Wednesday, 5 July 2017 at 18:09:46 UTC, Seb wrote: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.On Wednesday, 5 July 2017 at 17:46:01 UTC, Jolly James wrote:where would I find these *.lst files. Searching for '*.lst' in the source's root dir doesn't bring any results.[...]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
Jul 05 2017
On Wednesday, 5 July 2017 at 19:01:06 UTC, Jonathan M Davis wrote:On Wednesday, July 05, 2017 18:50:32 Jolly James via Digitalmars-d-learn wrote:The following command does not change anything: dub test --coverage --arch=x86_64 --compiler=ldc2 All I get is "All unit tests have been run successfully." in the command line.On Wednesday, 5 July 2017 at 18:46:38 UTC, Jolly James wrote:If you don't run the tests, you won't get any code coverage. Building with dub test --coverageOn Wednesday, 5 July 2017 at 18:09:46 UTC, Seb wrote: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.[...]where would I find these *.lst files. Searching for '*.lst' in the source's root dir doesn't bring any results.should do it. As for your assert(false) test failing, was it in the same module with your main in it?No, this test is actually in module 'tools.array'.
Jul 05 2017
On Wednesday, July 05, 2017 19:13:21 Jolly James via Digitalmars-d-learn wrote:On Wednesday, 5 July 2017 at 19:01:06 UTC, Jonathan M Davis wrote:I don't know why you'd need arch if you're running the tests on the same system that you're building them. And I don't know if ldc has the code coverage stuff that dmd has or not - that depends on which pieces of it are in the front end and which pieces are in the backend. I'd suggest trying it with dmd instead of ldc to see if you get different results. If dub test --coverage does work, whereas running it with the extra flags doesn't, then that at least tells you something about what's going wrong.On Wednesday, July 05, 2017 18:50:32 Jolly James via Digitalmars-d-learn wrote:The following command does not change anything: dub test --coverage --arch=x86_64 --compiler=ldc2 All I get is "All unit tests have been run successfully." in the command line.On Wednesday, 5 July 2017 at 18:46:38 UTC, Jolly James wrote:If you don't run the tests, you won't get any code coverage. Building with dub test --coverageOn Wednesday, 5 July 2017 at 18:09:46 UTC, Seb wrote: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.[...]where would I find these *.lst files. Searching for '*.lst' in the source's root dir doesn't bring any results.I don't know then. It was just a thought based on what I've seen before. Clearly, something is making it so that test doesn't run, but I have no idea what. dub does have its own forums though, so you probably stand a better chance of getting useful help there: http://forum.rejectedsoftware.com/groups/rejectedsoftware.dub/ - Jonathan M Davisshould do it. As for your assert(false) test failing, was it in the same module with your main in it?No, this test is actually in module 'tools.array'.
Jul 05 2017
On Wednesday, 5 July 2017 at 19:13:21 UTC, Jolly James wrote:On Wednesday, 5 July 2017 at 19:01:06 UTC, Jonathan M Davis wrote:Hello, I faced a similar issue today. In my case the utests weren't run because they were part of a templated class. They don't get executed in such a case because a valid utest mustn't be templated.On Wednesday, July 05, 2017 18:50:32 Jolly James via Digitalmars-d-learn wrote:The following command does not change anything: dub test --coverage --arch=x86_64 --compiler=ldc2 All I get is "All unit tests have been run successfully." in the command line.On Wednesday, 5 July 2017 at 18:46:38 UTC, Jolly James wrote:If you don't run the tests, you won't get any code coverage. Building with dub test --coverage[...]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.should do it. As for your assert(false) test failing, was it in the same module with your main in it?No, this test is actually in module 'tools.array'.
Jul 25 2017
On Wednesday, 5 July 2017 at 19:01:06 UTC, Jonathan M Davis wrote: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 DavisNoticed it as well couple of months ago. I think dub just skips the mainSourceFile defined in the dub.sdl (default: source/app.d) to avoid having 2 mains. It is annoying especially for small projects where you would only have app.d. Especially if you don't have a clue what is going on.
Jul 05 2017