mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-19 05:30:43 +00:00
Add new pluralFormat method...
This commit is contained in:
@ -285,4 +285,23 @@ class StringUtilsTest extends BaseTest
|
||||
assertEquals("Abc", StringUtils.ucFirst("abc"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Test
|
||||
void testPluralFormat()
|
||||
{
|
||||
assertEquals("Apple", StringUtils.pluralFormat(1, "Apple{,s}"));
|
||||
assertEquals("Apples", StringUtils.pluralFormat(0, "Apple{,s}"));
|
||||
assertEquals("Apples", StringUtils.pluralFormat(2, "Apple{,s}"));
|
||||
|
||||
assertEquals("Apple and Orange", StringUtils.pluralFormat(1, "Apple{,s} and Orange{,s}"));
|
||||
assertEquals("Apples and Oranges", StringUtils.pluralFormat(2, "Apple{,s} and Orange{,s}"));
|
||||
|
||||
assertEquals("Apple was eaten", StringUtils.pluralFormat(1, "Apple{,s} {was,were} eaten"));
|
||||
assertEquals("Apples were eaten", StringUtils.pluralFormat(2, "Apple{,s} {was,were} eaten"));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user