mirror of
https://github.com/dlang/phobos.git
synced 2025-05-07 11:37:24 +03:00
Restore changes to among
unittest that fails on Windows
This commit is contained in:
parent
9a6f9543cf
commit
825b72dc88
1 changed files with 4 additions and 5 deletions
|
@ -139,10 +139,9 @@ efficient search, but one that only supports matching on equality:
|
||||||
assert("bar".among!("foo", "bar", "baz") == 2);
|
assert("bar".among!("foo", "bar", "baz") == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@safe @nogc unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
import std.meta : AliasSeq;
|
import std.meta : AliasSeq;
|
||||||
import std.array : staticArray;
|
|
||||||
|
|
||||||
if (auto pos = 3.among(1, 2, 3))
|
if (auto pos = 3.among(1, 2, 3))
|
||||||
assert(pos == 3);
|
assert(pos == 3);
|
||||||
|
@ -155,9 +154,9 @@ efficient search, but one that only supports matching on equality:
|
||||||
assert(position == 1);
|
assert(position == 1);
|
||||||
|
|
||||||
alias values = AliasSeq!("foo", "bar", "baz");
|
alias values = AliasSeq!("foo", "bar", "baz");
|
||||||
auto arr = [values].staticArray;
|
auto arr = [values];
|
||||||
assert(arr[0 .. "foo".among(values)] == ["foo"].staticArray[]);
|
assert(arr[0 .. "foo".among(values)] == ["foo"]);
|
||||||
assert(arr[0 .. "bar".among(values)] == ["foo", "bar"].staticArray[]);
|
assert(arr[0 .. "bar".among(values)] == ["foo", "bar"]);
|
||||||
assert(arr[0 .. "baz".among(values)] == arr);
|
assert(arr[0 .. "baz".among(values)] == arr);
|
||||||
assert("foobar".among(values) == 0);
|
assert("foobar".among(values) == 0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue