Skip to content

Commit

Permalink
Cleaned up std.algorithm.joiner's docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JackStouffer committed Apr 12, 2016
1 parent 4547f8c commit 12c17d4
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions std/algorithm/iteration.d
Expand Up @@ -2107,19 +2107,13 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR)
import std.algorithm.comparison : equal;
import std.conv : text;

debug(std_algorithm) scope(success)
writeln("unittest @", __FILE__, ":", __LINE__, " done.");

static assert(isInputRange!(typeof(joiner([""], ""))));
static assert(isForwardRange!(typeof(joiner([""], ""))));
assert(equal(joiner([""], "xyz"), ""), text(joiner([""], "xyz")));
assert(equal(joiner(["", ""], "xyz"), "xyz"), text(joiner(["", ""], "xyz")));
assert(equal(joiner(["", "abc"], "xyz"), "xyzabc"));
assert(equal(joiner(["abc", ""], "xyz"), "abcxyz"));
assert(equal(joiner(["abc", "def"], "xyz"), "abcxyzdef"));
assert(equal(joiner(["Mary", "has", "a", "little", "lamb"], "..."),
"Mary...has...a...little...lamb"));
assert(equal(joiner(["abc", "def"]), "abcdef"));
assert(["abc", "def"].joiner.equal("abcdef"));
assert(["Mary", "has", "a", "little", "lamb"]
.joiner("...")
.equal("Mary...has...a...little...lamb"));
assert(["", "abc"].joiner("xyz").equal("xyzabc"));
assert([""].joiner("xyz").equal(""));
assert(["", ""].joiner("xyz").equal("xyz"));
}

unittest
Expand Down Expand Up @@ -2228,6 +2222,12 @@ unittest
assert(equal(joiner(tr5, [0,1]), [1,2,0,1,3,4,0,1,0,1]));
}

unittest
{
static assert(isInputRange!(typeof(joiner([""], ""))));
static assert(isForwardRange!(typeof(joiner([""], ""))));
}

/// Ditto
auto joiner(RoR)(RoR r)
if (isInputRange!RoR && isInputRange!(ElementType!RoR))
Expand Down

0 comments on commit 12c17d4

Please sign in to comment.