Skip to content

Commit

Permalink
Merge pull request #5266 from CyberShadow/pull-20170311-021153
Browse files Browse the repository at this point in the history
std.utf: Fix broken tests
merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
  • Loading branch information
dlang-bot committed Mar 11, 2017
2 parents 3de49bf + 86c4314 commit f156be1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions std/utf.d
Expand Up @@ -3397,7 +3397,7 @@ if (isAutodecodableString!R ||
void popBack() { str = str[0 .. $-1]; }

auto ref opIndex(size_t index) inout { return str[index]; }
auto opSlice(size_t lower, size_t upper) { return ByCodeUnitImpl(str[lower..upper]); }
auto opSlice(size_t lower, size_t upper) { return ByCodeUnitImpl(str[lower .. upper]); }

@property size_t length() const { return str.length; }
alias opDollar = length;
Expand Down Expand Up @@ -3425,6 +3425,8 @@ if (isAutodecodableString!R ||
///
@safe unittest
{
import std.range.primitives;

auto r = "Hello, World!".byCodeUnit();
static assert(hasLength!(typeof(r)));
static assert(hasSlicing!(typeof(r)));
Expand Down Expand Up @@ -3544,7 +3546,7 @@ if (isAutodecodableString!R ||
static assert(!is(typeof(bcu) == Stringish));
static assert(is(typeof(bcu) == typeof(bcu.byCodeUnit())));
static assert(is(ElementType!(typeof(bcu)) == immutable char));
assert(bcu.front == cast(char)244);
assert(bcu.front == cast(char) 244);
}
{
static struct WStringish
Expand All @@ -3559,7 +3561,7 @@ if (isAutodecodableString!R ||
static assert(!is(typeof(bcu) == WStringish));
static assert(is(typeof(bcu) == typeof(bcu.byCodeUnit())));
static assert(is(ElementType!(typeof(bcu)) == immutable wchar));
assert(bcu.front == cast(wchar)56319);
assert(bcu.front == cast(wchar) 56319);
}
{
static struct DStringish
Expand All @@ -3573,7 +3575,7 @@ if (isAutodecodableString!R ||
static assert(is(typeof(bcu) == dstring));
static assert(is(typeof(bcu) == typeof(bcu.byCodeUnit())));
static assert(is(ElementType!(typeof(bcu)) == immutable dchar));
assert(bcu.front == cast(dchar)1114104);
assert(bcu.front == cast(dchar) 1114104);
}
{
static struct FuncStringish
Expand All @@ -3589,7 +3591,7 @@ if (isAutodecodableString!R ||
static assert(!is(typeof(bcu) == FuncStringish));
static assert(is(typeof(bcu) == typeof(bcu.byCodeUnit())));
static assert(is(ElementType!(typeof(bcu)) == immutable char));
assert(bcu.front == cast(char)244);
assert(bcu.front == cast(char) 244);
}
{
static struct Range
Expand All @@ -3605,7 +3607,7 @@ if (isAutodecodableString!R ||
static assert(is(typeof(bcu) == Range));
static assert(is(typeof(bcu) == typeof(bcu.byCodeUnit())));
static assert(is(ElementType!(typeof(bcu)) == char));
assert(bcu.front == cast(char)244);
assert(bcu.front == cast(char) 244);
}
{
static struct WRange
Expand Down

0 comments on commit f156be1

Please sign in to comment.