Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/core/demangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -2416,7 +2416,7 @@ else version (Darwin)
else
enum string cPrefix = "";

version (unittest)
@safe pure nothrow unittest
{
immutable string[2][] table =
[
Expand Down Expand Up @@ -2544,9 +2544,6 @@ version (unittest)
else
alias staticIota = Seq!(staticIota!(x - 1), x - 1);
}
}
@safe pure nothrow unittest
{
foreach ( i, name; table )
{
auto r = demangle( name[0] );
Expand Down
14 changes: 5 additions & 9 deletions src/core/internal/convert.d
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,14 @@ private Float denormalizedMantissa(T)(T x, uint sign) if (floatFormat!T == Float
return Float(fl.mantissa2 & 0x00FFFFFFFFFFFFFFUL , 0, sign, 1);
}

version (unittest)
@system unittest
{
private const(ubyte)[] toUbyte2(T)(T val)
static const(ubyte)[] toUbyte2(T)(T val)
{
return toUbyte(val).dup;
}

private void testNumberConvert(string v)()
static void testNumberConvert(string v)()
{
enum ctval = mixin(v);

Expand All @@ -488,7 +488,7 @@ version (unittest)
assert(rtbytes[0..testsize] == ctbytes[0..testsize]);
}

private void testConvert()
static void testConvert()
{
/**Test special values*/
testNumberConvert!("-float.infinity");
Expand Down Expand Up @@ -598,11 +598,7 @@ version (unittest)
testNumberConvert!("cast(float)0x9.54bb0d88806f714p-7088L");
}


unittest
{
testConvert();
}
testConvert();
}


Expand Down
95 changes: 44 additions & 51 deletions src/core/lifetime.d
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,21 @@ T emplace(T, Args...)(void[] chunk, auto ref Args args)

@nogc pure nothrow @safe unittest
{
static class __conv_EmplaceTestClass
{
int i = 3;
this(int i) @nogc @safe pure nothrow
{
assert(this.i == 3 && i == 5);
this.i = i;
}
this(int i, ref int j) @nogc @safe pure nothrow
{
assert(i == 5 && j == 6);
this.i = i;
++j;
}
}
int var = 6;
align(__conv_EmplaceTestClass.alignof) ubyte[__traits(classInstanceSize, __conv_EmplaceTestClass)] buf;
auto support = (() @trusted => cast(__conv_EmplaceTestClass)(buf.ptr))();
Expand Down Expand Up @@ -306,43 +321,6 @@ T* emplace(T, Args...)(void[] chunk, auto ref Args args)
assert(u1.a == "hello");
}

version (unittest) private struct __conv_EmplaceTest
{
int i = 3;
this(int i)
{
assert(this.i == 3 && i == 5);
this.i = i;
}
this(int i, ref int j)
{
assert(i == 5 && j == 6);
this.i = i;
++j;
}

@disable:
this();
this(this);
void opAssign();
}

version (unittest) private class __conv_EmplaceTestClass
{
int i = 3;
this(int i) @nogc @safe pure nothrow
{
assert(this.i == 3 && i == 5);
this.i = i;
}
this(int i, ref int j) @nogc @safe pure nothrow
{
assert(i == 5 && j == 6);
this.i = i;
++j;
}
}

@system unittest // bugzilla 15772
{
abstract class Foo {}
Expand Down Expand Up @@ -476,17 +454,40 @@ version (unittest) private class __conv_EmplaceTestClass

@system unittest
{
static struct __conv_EmplaceTest
{
int i = 3;
this(int i)
{
assert(this.i == 3 && i == 5);
this.i = i;
}
this(int i, ref int j)
{
assert(i == 5 && j == 6);
this.i = i;
++j;
}

@disable:
this();
this(this);
void opAssign();
}

__conv_EmplaceTest k = void;
emplace(&k, 5);
assert(k.i == 5);
}

@system unittest
{
int var = 6;
__conv_EmplaceTest k = void;
emplace(&k, 5, var);
assert(k.i == 5);
__conv_EmplaceTest x = void;
emplace(&x, 5, var);
assert(x.i == 5);
assert(var == 7);

var = 6;
auto z = emplace!__conv_EmplaceTest(new void[__conv_EmplaceTest.sizeof], 5, var);
assert(z.i == 5);
assert(var == 7);
}

Expand Down Expand Up @@ -1162,14 +1163,6 @@ pure nothrow @safe /* @nogc */ unittest
assert(n.refs == 10);
}

@system unittest
{
int var = 6;
auto k = emplace!__conv_EmplaceTest(new void[__conv_EmplaceTest.sizeof], 5, var);
assert(k.i == 5);
assert(var == 7);
}

@system unittest
{
class A
Expand Down