mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 21:51:40 +03:00
TypeTuple -> MetaList inside Phobos
This commit is contained in:
parent
73f773838d
commit
82f54a38d3
42 changed files with 615 additions and 613 deletions
14
std/ascii.d
14
std/ascii.d
|
@ -30,7 +30,7 @@ version (unittest)
|
|||
// FIXME: When dmd bug #314 is fixed, make these selective.
|
||||
import std.range; // : chain;
|
||||
import std.traits; // : functionAttributes, FunctionAttribute, isSafe;
|
||||
import std.meta; // : TypeTuple;
|
||||
import std.meta; // : MetaList;
|
||||
}
|
||||
|
||||
|
||||
|
@ -531,7 +531,7 @@ auto toLower(C)(C c)
|
|||
@safe pure nothrow unittest
|
||||
{
|
||||
|
||||
foreach(C; TypeTuple!(char, wchar, dchar, immutable char, ubyte))
|
||||
foreach(C; MetaList!(char, wchar, dchar, immutable char, ubyte))
|
||||
{
|
||||
foreach(i, c; uppercase)
|
||||
assert(toLower(cast(C)c) == lowercase[i]);
|
||||
|
@ -592,7 +592,7 @@ auto toUpper(C)(C c)
|
|||
|
||||
@safe pure nothrow unittest
|
||||
{
|
||||
foreach(C; TypeTuple!(char, wchar, dchar, immutable char, ubyte))
|
||||
foreach(C; MetaList!(char, wchar, dchar, immutable char, ubyte))
|
||||
{
|
||||
foreach(i, c; lowercase)
|
||||
assert(toUpper(cast(C)c) == uppercase[i]);
|
||||
|
@ -631,7 +631,7 @@ unittest //Test both toUpper and toLower with non-builtin
|
|||
enum UDDE : UDD {a = UDD('a'), A = UDD('A')}
|
||||
|
||||
//User defined types with implicit cast to dchar test.
|
||||
foreach (Char; TypeTuple!(UDC, UDW, UDD))
|
||||
foreach (Char; MetaList!(UDC, UDW, UDD))
|
||||
{
|
||||
assert(toLower(Char('a')) == 'a');
|
||||
assert(toLower(Char('A')) == 'a');
|
||||
|
@ -642,7 +642,7 @@ unittest //Test both toUpper and toLower with non-builtin
|
|||
}
|
||||
|
||||
//Various enum tests.
|
||||
foreach (Enum; TypeTuple!(CE, WE, DE, UDCE, UDWE, UDDE))
|
||||
foreach (Enum; MetaList!(CE, WE, DE, UDCE, UDWE, UDDE))
|
||||
{
|
||||
assert(toLower(Enum.a) == 'a');
|
||||
assert(toLower(Enum.A) == 'a');
|
||||
|
@ -655,7 +655,7 @@ unittest //Test both toUpper and toLower with non-builtin
|
|||
}
|
||||
|
||||
//Return value type tests for enum of non-UDT. These should be the original type.
|
||||
foreach (T; TypeTuple!(CE, WE, DE))
|
||||
foreach (T; MetaList!(CE, WE, DE))
|
||||
{
|
||||
alias C = OriginalType!T;
|
||||
static assert(is(typeof(toLower(T.init)) == C));
|
||||
|
@ -663,7 +663,7 @@ unittest //Test both toUpper and toLower with non-builtin
|
|||
}
|
||||
|
||||
//Return value tests for UDT and enum of UDT. These should be dchar
|
||||
foreach (T; TypeTuple!(UDC, UDW, UDD, UDCE, UDWE, UDDE))
|
||||
foreach (T; MetaList!(UDC, UDW, UDD, UDCE, UDWE, UDDE))
|
||||
{
|
||||
static assert(is(typeof(toLower(T.init)) == dchar));
|
||||
static assert(is(typeof(toUpper(T.init)) == dchar));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue