Add test case for quoteAtoms().
This commit is contained in:
parent
a1732ba03a
commit
b7471280c7
1 changed files with 62 additions and 0 deletions
62
test/com/fsck/k9/helper/Utility_quoteAtoms.java
Normal file
62
test/com/fsck/k9/helper/Utility_quoteAtoms.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package com.fsck.k9.helper;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class Utility_quoteAtoms extends TestCase
|
||||
{
|
||||
public void testNoQuote() {
|
||||
// Alpha
|
||||
noQuote("a");
|
||||
noQuote("aa");
|
||||
noQuote("aaa aaa");
|
||||
|
||||
// Numeric
|
||||
noQuote("1");
|
||||
noQuote("12");
|
||||
noQuote("123 456");
|
||||
|
||||
// Alpha Numeric
|
||||
noQuote("abc 123");
|
||||
|
||||
// Specials
|
||||
noQuote("!");
|
||||
noQuote("#");
|
||||
noQuote("$");
|
||||
noQuote("%");
|
||||
noQuote("&");
|
||||
noQuote("'");
|
||||
noQuote("*");
|
||||
noQuote("+");
|
||||
noQuote("-");
|
||||
noQuote("/");
|
||||
noQuote("=");
|
||||
noQuote("?");
|
||||
noQuote("^");
|
||||
noQuote("_");
|
||||
noQuote("`");
|
||||
noQuote("{");
|
||||
noQuote("|");
|
||||
noQuote("}");
|
||||
noQuote("~");
|
||||
|
||||
// Combos
|
||||
noQuote("bob barker! #1!");
|
||||
noQuote("!");
|
||||
noQuote("#&#!");
|
||||
noQuote("{|}");
|
||||
noQuote("'-=+=-'");
|
||||
}
|
||||
|
||||
public void testQuote() {
|
||||
assertEquals("\"bob s. barker\"", quote("bob s. barker"));
|
||||
assertEquals("\":(\"", quote(":("));
|
||||
}
|
||||
|
||||
private void noQuote(final String s) {
|
||||
assertEquals(s, Utility.quoteAtoms(s));
|
||||
}
|
||||
|
||||
private String quote(final String s) {
|
||||
return Utility.quoteAtoms(s);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue