You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use this library not just in unittest, but also as a replacement for the D built-in assert in the normal code. But I want to turn off these Asserts in release build, I'm wondering is there a build config string, that will turn off all asserts into no-op?
If currently there is none, can we add such build config?
Thanks.
The text was updated successfully, but these errors were encountered:
Hmm... I think we can do this, but then you will have calls to empty functions, hoping that the compiler / optimiser will remove those calls, but I can not guarantee that will happen.
version (ASSERT) {
public import fluent.asserts;
} else {
pragma(msg, "NOTE: using dummy Assert!");
class Assert {
public static void cmp(X, Y)(X x, Y y, string msg="") {}
alias greaterThan = cmp;
alias lessThan = cmp;
alias equal = cmp;
public static void approximately(X, Y, Z)(X x, Y y, Z=0) {}
}
}
Yes, this is what I was talking about. With this solution you will still have this function call in your code. It can be done. Are you using the last release v13.x.x or master?
Hi,
I use this library not just in unittest, but also as a replacement for the D built-in
assert
in the normal code. But I want to turn off these Asserts in release build, I'm wondering is there a build config string, that will turn off all asserts into no-op?If currently there is none, can we add such build config?
Thanks.
The text was updated successfully, but these errors were encountered: