Skip to content

Commit

Permalink
Merge pull request #3783 from burner/std.string.center_unittest_example
Browse files Browse the repository at this point in the history
std.string.center_unittest_example
  • Loading branch information
DmitryOlshansky committed Nov 7, 2015
2 parents 527eeb6 + 86a9f25 commit ce70770
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion std/string.d
Expand Up @@ -3875,7 +3875,15 @@ S center(S)(S s, size_t width, dchar fillChar = ' ')
return centerJustifier(s, width, fillChar).array;
}

@trusted pure
///
@safe pure unittest
{
assert(center("hello", 7, 'X') == "XhelloX");
assert(center("hello", 2, 'X') == "hello");
assert(center("hello", 9, 'X') == "XXhelloXX");
}

@safe pure
unittest
{
import std.conv : to;
Expand Down

0 comments on commit ce70770

Please sign in to comment.