Re: unittest blocks not being run inside of class and struct templates

2017-07-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, July 25, 2017 09:31:28 Steven Schveighoffer via Digitalmars-d- learn wrote: > The unfortunate thing is that if you want to have non-templated unit > tests, you have to put them outside the struct itself. This sucks for > documented unit tests, and for tests being close to the thing

Re: unittest blocks not being run inside of class and struct templates

2017-07-25 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 02:48:57 UTC, NoBigDeal256 wrote: What is the standard way of testing class templates in the context of a library where some of the classes may never actually be used by the library itself? Write a test and instantiate whatever templates you want to test. class

Re: unittest blocks not being run inside of class and struct templates

2017-07-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/24/17 11:13 PM, NoBigDeal256 wrote: On Tuesday, 25 July 2017 at 02:18:41 UTC, Adam D. Ruppe wrote: On Tuesday, 25 July 2017 at 02:11:20 UTC, NoBigDeal256 wrote: it passes when it should fail because the unittest block is never executed. Why is this? Did you actually instantiate the

Re: unittest blocks not being run inside of class and struct templates

2017-07-24 Thread NoBigDeal256 via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 02:18:41 UTC, Adam D. Ruppe wrote: On Tuesday, 25 July 2017 at 02:11:20 UTC, NoBigDeal256 wrote: it passes when it should fail because the unittest block is never executed. Why is this? Did you actually instantiate the class somewhere? A template has no concrete

Re: unittest blocks not being run inside of class and struct templates

2017-07-24 Thread NoBigDeal256 via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 02:18:41 UTC, Adam D. Ruppe wrote: On Tuesday, 25 July 2017 at 02:11:20 UTC, NoBigDeal256 wrote: it passes when it should fail because the unittest block is never executed. Why is this? Did you actually instantiate the class somewhere? A template has no concrete

Re: unittest blocks not being run inside of class and struct templates

2017-07-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 02:11:20 UTC, NoBigDeal256 wrote: it passes when it should fail because the unittest block is never executed. Why is this? Did you actually instantiate the class somewhere? A template has no concrete code unless created with an argument somewhere...

unittest blocks not being run inside of class and struct templates

2017-07-24 Thread NoBigDeal256 via Digitalmars-d-learn
For example this code: class Test { unittest { assert(false); } } fails when ran with dmd test.d -unittest like you'd expect. But if I make it a class template: class Test(T) { unittest { assert(false); } } it passes when it should fail because the unittest