1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-10 11:35:11 -05:00
k-9/test/com/fsck/k9/helper/Utility_quoteAtoms.java

63 lines
1.3 KiB
Java
Raw Normal View History

2011-01-31 18:17:37 -05:00
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);
}
}