mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 13:40:20 +03:00
Merge pull request #7135 from WalterBright/array-nad3
fix unittests for array.join() for no autodecode merged-on-behalf-of: Walter Bright <WalterBright@users.noreply.github.com>
This commit is contained in:
commit
5b83b74bf1
1 changed files with 16 additions and 6 deletions
22
std/array.d
22
std/array.d
|
@ -2149,18 +2149,28 @@ if (isInputRange!RoR &&
|
|||
@safe pure unittest
|
||||
{
|
||||
import std.conv : to;
|
||||
import std.range.primitives : autodecodeStrings;
|
||||
|
||||
static foreach (T; AliasSeq!(string,wstring,dstring))
|
||||
{{
|
||||
auto arr2 = "Здравствуй Мир Unicode".to!(T);
|
||||
auto arr = ["Здравствуй", "Мир", "Unicode"].to!(T[]);
|
||||
assert(join(arr) == "ЗдравствуйМирUnicode");
|
||||
static foreach (S; AliasSeq!(char,wchar,dchar))
|
||||
{{
|
||||
auto jarr = arr.join(to!S(' '));
|
||||
static assert(is(typeof(jarr) == T));
|
||||
assert(jarr == arr2);
|
||||
}}
|
||||
static if (autodecodeStrings)
|
||||
{
|
||||
static foreach (S; AliasSeq!(char,wchar,dchar))
|
||||
{{
|
||||
auto jarr = arr.join(to!S(' '));
|
||||
static assert(is(typeof(jarr) == T));
|
||||
assert(jarr == arr2);
|
||||
}}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Turning off autodecode means the join() won't
|
||||
// just convert arr[] to dchar, so mixing char
|
||||
// types fails to compile.
|
||||
}
|
||||
static foreach (S; AliasSeq!(string,wstring,dstring))
|
||||
{{
|
||||
auto jarr = arr.join(to!S(" "));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue