mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 13:40:20 +03:00
Fix Issue 21201 - let std.uuid.parseUUID accept input ranges whose elements are char or wchar, not just dchar
All characters of interest to std.uuid.parseUUID are ASCII so there is no reason it cannot work on a range of chars or wchars.
This commit is contained in:
parent
4b269a86f2
commit
a3c3ea74e3
1 changed files with 8 additions and 2 deletions
10
std/uuid.d
10
std/uuid.d
|
@ -1332,8 +1332,7 @@ if (isSomeString!T)
|
|||
|
||||
///ditto
|
||||
UUID parseUUID(Range)(ref Range uuidRange)
|
||||
if (isInputRange!Range
|
||||
&& is(immutable ElementType!Range == immutable dchar))
|
||||
if (isInputRange!Range && isSomeChar!(ElementType!Range))
|
||||
{
|
||||
import std.ascii : isHexDigit;
|
||||
import std.conv : ConvException, parse;
|
||||
|
@ -1630,6 +1629,13 @@ if (isInputRange!Range
|
|||
assert(parseHelper!S("///8ab3060e2cba4f23b74cb52db3bdfb46||")
|
||||
== parseUUID("8ab3060e-2cba-4f23-b74c-b52db3bdfb46"));
|
||||
}}
|
||||
|
||||
// Test input range with non-dchar element type.
|
||||
{
|
||||
import std.utf : byCodeUnit;
|
||||
auto range = "8AB3060E-2CBA-4F23-b74c-B52Db3BDFB46".byCodeUnit;
|
||||
assert(parseUUID(range).data == [138, 179, 6, 14, 44, 186, 79, 35, 183, 76, 181, 45, 179, 189, 251, 70]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue