Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 12eb53d

Browse files
wilzbachPetarKirov
authored andcommitted
Add tests for dassert with 'in'
1 parent 8103d87 commit 12eb53d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/core/internal/dassert.d

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ auto miniFormat(V)(auto ref V v)
4141
{
4242
import core.stdc.stdio : sprintf;
4343
import core.stdc.string : strlen;
44-
static if (__traits(isIntegral, V))
44+
static if (is(V : bool))
45+
{
46+
return v ? "true" : "false";
47+
}
48+
else static if (__traits(isIntegral, V))
4549
{
4650
enum printfFormat = getPrintfFormat!V;
4751
char[20] val;

test/exceptions/src/assert_fail.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ void testStruct()()
108108
void testAA()()
109109
{
110110
test([1:"one"], [2: "two"], `[1: "one"] != [2: "two"]`);
111+
test!"in"(1, [2: 3], "1 !in [2: 3]");
112+
test!"in"("foo", ["bar": true], `"foo" !in ["bar": true]`);
111113
}
112114

113115
void main()

0 commit comments

Comments
 (0)