www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Code-coverage

reply Sai <Sai_member pathlink.com> writes:
My source files are spread in directories in java style. How can I do code
coverage for all sources ?

with just -cov option, no .lst files are created.

Thanks in advance
Sai
Dec 05 2005
next sibling parent James Dunne <james.jdunne gmail.com> writes:
Sai wrote:
 My source files are spread in directories in java style. How can I do code
 coverage for all sources ?
 
 with just -cov option, no .lst files are created.
 
 Thanks in advance
 Sai
 
 
 
Hope you're not jumping the gun, but the .lst files are generated when the program is run. I haven't tried a multi-directory style D app with -cov, but it works with a single-directory app.
Dec 05 2005
prev sibling next sibling parent reply clayasaurus <clayasaurus gmail.com> writes:
Sai wrote:
 My source files are spread in directories in java style. How can I do code
 coverage for all sources ?
 
 with just -cov option, no .lst files are created.
 
 Thanks in advance
 Sai
 
 
 
Yea, there should only be 1 .lst file created for your program. Compile your D program to an exe, then run 'dmd my.exe -cov'
Dec 05 2005
parent clayasaurus <clayasaurus gmail.com> writes:
clayasaurus wrote:
 Sai wrote:
 
 My source files are spread in directories in java style. How can I do 
 code
 coverage for all sources ?

 with just -cov option, no .lst files are created.

 Thanks in advance
 Sai
Yea, there should only be 1 .lst file created for your program. Compile your D program to an exe, then run 'dmd my.exe -cov'
Nevermind. My advice is to use build with the -cov option, then after you run your exe the .lst file should be created. Although in the bugs forum it looks like someone is having trouble with it.
Dec 05 2005
prev sibling parent reply sai <sai_member pathlink.com> writes:
Now I understand, why no .lst files were created for my program.

I was always exiting using std.c.stdlib.exit(0); which wasn't exiting 
cleanly. Today by mistake, due to an exception, when the program exited
through return in "main", all .lst files were created !

Is there any clean way of exiting (or aborting) in D ? 

Thanks in advance
Sai



In article <dn2dur$2bur$1 digitaldaemon.com>, Sai says...
My source files are spread in directories in java style. How can I do code
coverage for all sources ?

with just -cov option, no .lst files are created.

Thanks in advance
Sai
Dec 16 2005
parent Sean Kelly <sean f4.ca> writes:
sai wrote:
 Now I understand, why no .lst files were created for my program.
 
 I was always exiting using std.c.stdlib.exit(0); which wasn't exiting 
 cleanly. Today by mistake, due to an exception, when the program exited
 through return in "main", all .lst files were created !
 
 Is there any clean way of exiting (or aborting) in D ? 
Nothing official, though you could try this: throw new Exception("Terminate called."); Sean
Dec 16 2005