Skip to content

Commit

Permalink
Issue 16984 - Make std.traits runnable
Browse files Browse the repository at this point in the history
  • Loading branch information
wilzbach committed Oct 5, 2017
1 parent c2d03bf commit 3cc6300
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions std/traits.d
Expand Up @@ -2490,6 +2490,7 @@ template Fields(T)
///
@safe unittest
{
import std.meta : AliasSeq;
struct S { int x; float y; }
static assert(is(Fields!S == AliasSeq!(int, float)));
}
Expand Down Expand Up @@ -2546,6 +2547,7 @@ template FieldNameTuple(T)
///
@safe unittest
{
import std.meta : AliasSeq;
struct S { int x; float y; }
static assert(FieldNameTuple!S == AliasSeq!("x", "y"));
static assert(FieldNameTuple!int == AliasSeq!"");
Expand Down Expand Up @@ -2692,7 +2694,7 @@ private template hasRawAliasing(T...)
enum hasRawAliasing = Impl!(RepresentationTypeTuple!T);
}

///
//
@safe unittest
{
// simple types
Expand Down Expand Up @@ -2788,7 +2790,7 @@ private template hasRawUnsharedAliasing(T...)
enum hasRawUnsharedAliasing = Impl!(RepresentationTypeTuple!T);
}

///
//
@safe unittest
{
// simple types
Expand Down Expand Up @@ -4009,6 +4011,8 @@ template BaseTypeTuple(A)
///
@safe unittest
{
import std.meta : AliasSeq;

interface I1 { }
interface I2 { }
interface I12 : I1, I2 { }
Expand Down Expand Up @@ -4062,6 +4066,8 @@ template BaseClassesTuple(T)
///
@safe unittest
{
import std.meta : AliasSeq;

class C1 { }
class C2 : C1 { }
class C3 : C2 { }
Expand Down Expand Up @@ -4422,6 +4428,8 @@ template TemplateArgsOf(T : Base!Args, alias Base, Args...)
///
@safe unittest
{
import std.meta : AliasSeq;

struct Foo(T, U) {}
static assert(is(TemplateArgsOf!(Foo!(int, real)) == AliasSeq!(int, real)));
}
Expand Down Expand Up @@ -7331,6 +7339,8 @@ template mostNegative(T)
///
@safe unittest
{
import std.meta : AliasSeq;

foreach (T; AliasSeq!(bool, byte, short, int, long))
static assert(mostNegative!T == T.min);

Expand Down Expand Up @@ -7397,6 +7407,7 @@ template mangledName(sth...)
///
@safe unittest
{
import std.meta : AliasSeq;
alias TL = staticMap!(mangledName, int, const int, immutable int);
static assert(TL == AliasSeq!("i", "xi", "yi"));
}
Expand Down Expand Up @@ -7845,13 +7856,13 @@ template getSymbolsByUDA(alias symbol, alias attribute)
static assert(hasUDA!(getSymbolsByUDA!(HasPrivateMembers, Attr)[0], Attr));
}

///
//
@safe unittest
{
enum Attr;
struct A
{
alias int INT;
alias INT = int;
alias void function(INT) SomeFunction;
@Attr int a;
int b;
Expand Down

0 comments on commit 3cc6300

Please sign in to comment.