Skip to content

Commit

Permalink
Merge pull request #7135 from WalterBright/array-nad3
Browse files Browse the repository at this point in the history
fix unittests for array.join() for no autodecode
merged-on-behalf-of: Walter Bright <[email protected]>
  • Loading branch information
dlang-bot authored Aug 15, 2019
2 parents c707e17 + ce46d9a commit 5b83b74
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions std/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -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(" "));
Expand Down

0 comments on commit 5b83b74

Please sign in to comment.