Testing lazy ranges in post-conditions

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 24 04:20:39 PST 2014


Peter Alexander:

> Should be able to do:
>
> assert(result.save.all!(x => x < 10));
>
> But iota's save isn't const, so you can't (that's a bug).

Mine was just an example of the general problem, another example:


import std.range, std.algorithm;

auto foo()
out(result) {
     assert(result.all!(b => b.length == 2));
} body {
     auto a = new int[10];
     return a.chunks(2);
}

void main() {}


Bye,
bearophile


More information about the Digitalmars-d mailing list