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 bl
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...
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 co
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 co
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 class
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 Tes
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 bein