mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 05:30:33 +03:00
@safe tests in std.uni
This commit is contained in:
parent
dd310f3543
commit
dc69783cfb
1 changed files with 19 additions and 19 deletions
|
@ -1528,7 +1528,7 @@ if (is(Unqual!T == T))
|
|||
return SliceOverIndexed!T(a, b, x);
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
int[] idxArray = [2, 3, 5, 8, 13];
|
||||
auto sliced = sliceOverIndexed(0, idxArray.length, &idxArray);
|
||||
|
@ -3116,7 +3116,7 @@ private:
|
|||
CowArray!SP data;
|
||||
}
|
||||
|
||||
pure @system unittest
|
||||
pure @safe unittest
|
||||
{
|
||||
import std.conv : to;
|
||||
assert(unicode.ASCII.to!string() == "[0..128)");
|
||||
|
@ -5410,7 +5410,7 @@ pure @safe unittest
|
|||
}
|
||||
|
||||
// cover decode fail cases of Matcher
|
||||
pure @system unittest
|
||||
pure @safe unittest
|
||||
{
|
||||
import std.algorithm.iteration : map;
|
||||
import std.exception : collectException;
|
||||
|
@ -5427,7 +5427,7 @@ pure @system unittest
|
|||
auto s = msg;
|
||||
size_t idx = 0;
|
||||
utf8.test(s);
|
||||
}()), format("%( %2x %)", cast(ubyte[]) msg));
|
||||
}()), format("%( %2x %)", cast(immutable(ubyte)[]) msg));
|
||||
}
|
||||
//decode failure cases UTF-16
|
||||
alias fails16 = AliasSeq!([0xD811], [0xDC02]);
|
||||
|
@ -7150,7 +7150,7 @@ if (isInputRange!Input && is(immutable ElementType!Input == immutable dchar))
|
|||
return genericDecodeGrapheme!true(inp);
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
|
||||
|
@ -7233,7 +7233,7 @@ if (isInputRange!Range && is(immutable ElementType!Range == immutable dchar))
|
|||
|
||||
// For testing non-forward-range input ranges
|
||||
version (StdUnittest)
|
||||
private static struct InputRangeString
|
||||
private static @safe struct InputRangeString
|
||||
{
|
||||
private string s;
|
||||
|
||||
|
@ -7242,7 +7242,7 @@ private static struct InputRangeString
|
|||
void popFront() { s.popFront(); }
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.array : array;
|
||||
|
@ -7366,7 +7366,7 @@ if (isInputRange!Range && is(immutable ElementType!Range == immutable dchar))
|
|||
assert(reverse == "le\u0308on"); // lëon
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.range.primitives : walkLength;
|
||||
|
@ -7523,7 +7523,7 @@ public:
|
|||
}
|
||||
|
||||
///
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
auto g = Grapheme("A");
|
||||
|
@ -7650,7 +7650,7 @@ private:
|
|||
static assert(Grapheme.sizeof == size_t.sizeof*4);
|
||||
|
||||
|
||||
@system pure /*nothrow @nogc*/ unittest // TODO: string .front is GC and throw
|
||||
@safe pure /*nothrow @nogc*/ unittest // TODO: string .front is GC and throw
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
Grapheme[3] data = [Grapheme("Ю"), Grapheme("У"), Grapheme("З")];
|
||||
|
@ -7658,7 +7658,7 @@ static assert(Grapheme.sizeof == size_t.sizeof*4);
|
|||
}
|
||||
|
||||
///
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.algorithm.iteration : filter;
|
||||
|
@ -7704,7 +7704,7 @@ static assert(Grapheme.sizeof == size_t.sizeof*4);
|
|||
assert(!g.valid);
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.algorithm.iteration : map;
|
||||
|
@ -8205,7 +8205,7 @@ package(std) auto simpleCaseFoldings(dchar ch) @safe
|
|||
return Range(start, entry.size);
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.algorithm.searching : canFind;
|
||||
|
@ -8356,7 +8356,7 @@ public Grapheme decompose(UnicodeDecomposition decompType=Canonical)(dchar ch) @
|
|||
}
|
||||
|
||||
///
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
|
||||
|
@ -8464,7 +8464,7 @@ Grapheme decomposeHangul(dchar ch) @safe
|
|||
}
|
||||
|
||||
///
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
assert(decomposeHangul('\uD4DB')[].equal("\u1111\u1171\u11B6"));
|
||||
|
@ -8504,7 +8504,7 @@ dchar composeJamo(dchar lead, dchar vowel, dchar trailing=dchar.init) pure nothr
|
|||
assert(composeJamo('A', '\u1171') == dchar.init);
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.conv : text;
|
||||
|
@ -10105,7 +10105,7 @@ if (isSomeString!S || (isRandomAccessRange!S && hasLength!S && hasSlicing!S && i
|
|||
assert(s2 !is s1);
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
static void doTest(C)(const(C)[] s, const(C)[] trueUp, const(C)[] trueLow)
|
||||
{
|
||||
|
@ -10118,9 +10118,9 @@ if (isSomeString!S || (isRandomAccessRange!S && hasLength!S && hasSlicing!S && i
|
|||
assert(low == trueLow, format(diff, low, trueLow));
|
||||
assert(up == trueUp, format(diff, up, trueUp));
|
||||
assert(lowInp == trueLow,
|
||||
format(diff, cast(ubyte[]) s, cast(ubyte[]) lowInp, cast(ubyte[]) trueLow));
|
||||
format(diff, cast(const(ubyte)[]) s, cast(const(ubyte)[]) lowInp, cast(const(ubyte)[]) trueLow));
|
||||
assert(upInp == trueUp,
|
||||
format(diff, cast(ubyte[]) s, cast(ubyte[]) upInp, cast(ubyte[]) trueUp));
|
||||
format(diff, cast(const(ubyte)[]) s, cast(const(ubyte)[]) upInp, cast(const(ubyte)[]) trueUp));
|
||||
}
|
||||
static foreach (S; AliasSeq!(dstring, wstring, string))
|
||||
{{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue