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:
The Dlang Bot 2019-08-15 10:28:27 +02:00 committed by GitHub
commit 5b83b74bf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(" "));