Skip to content

Commit

Permalink
nicer test
Browse files Browse the repository at this point in the history
  • Loading branch information
ErinaceusEuropaeus committed Dec 20, 2016
1 parent a9a0bce commit 757d3f1
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions std/range/package.d
Expand Up @@ -4423,21 +4423,13 @@ pure unittest
auto zz = z.save;
}

@safe pure unittest
pure unittest
{
import std.typecons : tuple;

static class RefRange
{
@safe: pure:
this(int front){ this.front = front; }
int front;
enum empty = false;
void popFront(){ front++; }
RefRange save(){ return new RefRange(front); }
}

auto z1 = zip(new RefRange(0), new RefRange(1));

auto r1 = [0,1,2];
auto r2 = [1,2,3];
auto z1 = zip(refRange(&r1), refRange(&r2));
auto z2 = z1.save;
z1.popFront();
assert(z1.front == tuple(1,2));
Expand Down

0 comments on commit 757d3f1

Please sign in to comment.