diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2019-04-22 19:02:42 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2019-04-22 19:38:31 -0300 |
| commit | df25a7e566e4a91eafbc30566cd19418ac977d02 (patch) | |
| tree | efa599433dd60412b9647e5e9ba1434a7122f7b8 /clformat/src/test/java | |
| parent | 321f2faa7fb0e3ff5be9e2cd08aa2f33124c4697 (diff) | |
Fixed comb. of `@` mod and 4-param ~A dir.
Fixed the combination of the `@` mod and the 4-parameter form of the ~A
directive. Previously, this would add an excessive amount of padding to
the output.
Also added some test cases for this, and fixed another similar padding
bug.
Diffstat (limited to 'clformat/src/test/java')
| -rw-r--r-- | clformat/src/test/java/bjc/utils/test/ioutils/CLFormatterTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clformat/src/test/java/bjc/utils/test/ioutils/CLFormatterTest.java b/clformat/src/test/java/bjc/utils/test/ioutils/CLFormatterTest.java index b14a6b3..d3d7075 100644 --- a/clformat/src/test/java/bjc/utils/test/ioutils/CLFormatterTest.java +++ b/clformat/src/test/java/bjc/utils/test/ioutils/CLFormatterTest.java @@ -110,11 +110,23 @@ public class CLFormatterTest { } @Test + public void testADirective() { + assertFormat("foo", "~A", "foo"); + assertFormat("foobar ", "~7A", "foobar"); + assertFormat(" foobar", "~7@A", "foobar"); + assertFormat(" foobar", "~#mincol;8,#colinc;2,#minpad;1,#padchar;' @A", "foobar"); + } + + @Test public void testRandomCases() { // Random test cases assertEquals("3 dogs are here", format("~D dog~:[s are~; is~] here", 3, 3 == 1)); } + private void assertFormat(String res, String fmt, Object... params) { + assertEquals(res, format(fmt, params)); + } + private String format(String str, Object... params) { try { return fmt.formatString(str, params); |
