Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Jan 22, 2013

assert(t1 == " true false");
string t2 = format("%6s %-6s %6s %-6s", true, false, true, false);
assert(t2 == " true false true false ");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding brackets in all cases, like format("[%6s][%6s]", true, false) is better.
And, I think you should add a test case which less than 4 width is specified.

@ghost
Copy link
Author

ghost commented Jan 22, 2013

@9rnsr: Good idea, fixed.

assert(t2 == "[true] [false]");

string t3 = format("[%6s] [%-6s] [%6s] [%-6s]", true, false, true, false);
assert(t3 == "[ true] [false ] [ true] [false ]");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t3 seems just a twice repetition of t1. Redundant?

@ghost
Copy link
Author

ghost commented Jan 22, 2013

It was a bad example trying out negative width specifier, fixed.

alexrp added a commit that referenced this pull request Jan 22, 2013
Issue 7142 - Implement field width for boolean formatting
@alexrp alexrp merged commit c89b21e into dlang:master Jan 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants