mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Add @safe to std.ascii unittests
This commit is contained in:
parent
b54a972424
commit
a4a8174e3a
1 changed files with 14 additions and 14 deletions
28
std/ascii.d
28
std/ascii.d
|
@ -78,7 +78,7 @@ bool isAlphaNum(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isAlphaNum('á'));
|
assert(!isAlphaNum('á'));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (c; chain(digits, octalDigits, fullHexDigits, letters, lowercase, uppercase))
|
foreach (c; chain(digits, octalDigits, fullHexDigits, letters, lowercase, uppercase))
|
||||||
assert(isAlphaNum(c));
|
assert(isAlphaNum(c));
|
||||||
|
@ -109,7 +109,7 @@ bool isAlpha(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isAlpha('á'));
|
assert(!isAlpha('á'));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (c; chain(letters, lowercase, uppercase))
|
foreach (c; chain(letters, lowercase, uppercase))
|
||||||
assert(isAlpha(c));
|
assert(isAlpha(c));
|
||||||
|
@ -140,7 +140,7 @@ bool isLower(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isLower('Á'));
|
assert(!isLower('Á'));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (c; lowercase)
|
foreach (c; lowercase)
|
||||||
assert(isLower(c));
|
assert(isLower(c));
|
||||||
|
@ -171,7 +171,7 @@ bool isUpper(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isUpper('Á'));
|
assert(!isUpper('Á'));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (c; uppercase)
|
foreach (c; uppercase)
|
||||||
assert(isUpper(c));
|
assert(isUpper(c));
|
||||||
|
@ -203,7 +203,7 @@ bool isDigit(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isDigit('4')); // full-width digit four (U+FF14)
|
assert(!isDigit('4')); // full-width digit four (U+FF14)
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (c; digits)
|
foreach (c; digits)
|
||||||
assert(isDigit(c));
|
assert(isDigit(c));
|
||||||
|
@ -232,7 +232,7 @@ bool isOctalDigit(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isOctalDigit('#'));
|
assert(!isOctalDigit('#'));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (c; octalDigits)
|
foreach (c; octalDigits)
|
||||||
assert(isOctalDigit(c));
|
assert(isOctalDigit(c));
|
||||||
|
@ -262,7 +262,7 @@ bool isHexDigit(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isHexDigit('#'));
|
assert(!isHexDigit('#'));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (c; fullHexDigits)
|
foreach (c; fullHexDigits)
|
||||||
assert(isHexDigit(c));
|
assert(isHexDigit(c));
|
||||||
|
@ -299,7 +299,7 @@ bool isWhite(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isWhite('\u00A0')); // std.ascii.isWhite
|
assert(!isWhite('\u00A0')); // std.ascii.isWhite
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (c; whitespace)
|
foreach (c; whitespace)
|
||||||
assert(isWhite(c));
|
assert(isWhite(c));
|
||||||
|
@ -335,7 +335,7 @@ bool isControl(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isControl('\u2029'));
|
assert(!isControl('\u2029'));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (dchar c; 0 .. 32)
|
foreach (dchar c; 0 .. 32)
|
||||||
assert(isControl(c));
|
assert(isControl(c));
|
||||||
|
@ -379,7 +379,7 @@ bool isPunctuation(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isPunctuation('\u2012')); // (U+2012 = en-dash)
|
assert(!isPunctuation('\u2012')); // (U+2012 = en-dash)
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (dchar c; 0 .. 128)
|
foreach (dchar c; 0 .. 128)
|
||||||
{
|
{
|
||||||
|
@ -415,7 +415,7 @@ bool isGraphical(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isGraphical('á'));
|
assert(!isGraphical('á'));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (dchar c; 0 .. 128)
|
foreach (dchar c; 0 .. 128)
|
||||||
{
|
{
|
||||||
|
@ -450,7 +450,7 @@ bool isPrintable(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isPrintable('á'));
|
assert(!isPrintable('á'));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (dchar c; 0 .. 128)
|
foreach (dchar c; 0 .. 128)
|
||||||
{
|
{
|
||||||
|
@ -480,7 +480,7 @@ bool isASCII(dchar c) @safe pure nothrow @nogc
|
||||||
assert(!isASCII('á'));
|
assert(!isASCII('á'));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
foreach (dchar c; 0 .. 128)
|
foreach (dchar c; 0 .. 128)
|
||||||
assert(isASCII(c));
|
assert(isASCII(c));
|
||||||
|
@ -612,7 +612,7 @@ auto toUpper(C)(C c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unittest //Test both toUpper and toLower with non-builtin
|
@safe unittest //Test both toUpper and toLower with non-builtin
|
||||||
{
|
{
|
||||||
//User Defined [Char|Wchar|Dchar]
|
//User Defined [Char|Wchar|Dchar]
|
||||||
static struct UDC { char c; alias c this; }
|
static struct UDC { char c; alias c this; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue