aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorBananeweizen <Bananeweizen@gmx.de>2012-10-02 18:18:26 +0200
committerBananeweizen <Bananeweizen@gmx.de>2012-10-02 18:18:26 +0200
commit607bf47b7714bc259718b0db8c306086d078d55f (patch)
tree358aaf5d8e2f0607bb3a0d843d26a4532b09ee28 /tests/src
parent1f8a42c0b5d4897e23f4b523cb73fa95545a4b19 (diff)
downloadcgeo-607bf47b7714bc259718b0db8c306086d078d55f.zip
cgeo-607bf47b7714bc259718b0db8c306086d078d55f.tar.gz
cgeo-607bf47b7714bc259718b0db8c306086d078d55f.tar.bz2
#2034: additional unit test
* replace control character by space instead of empty string
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/cgeo/geocaching/utils/BaseUtilsTest.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/utils/BaseUtilsTest.java b/tests/src/cgeo/geocaching/utils/BaseUtilsTest.java
index fe790af..2cedb2f 100644
--- a/tests/src/cgeo/geocaching/utils/BaseUtilsTest.java
+++ b/tests/src/cgeo/geocaching/utils/BaseUtilsTest.java
@@ -5,6 +5,8 @@ import cgeo.geocaching.test.mock.MockedCache;
import android.test.AndroidTestCase;
+import java.util.regex.Pattern;
+
public class BaseUtilsTest extends AndroidTestCase {
public static void testRegEx() {
String page = MockedCache.readCachePage("GC2CJPF");
@@ -23,4 +25,9 @@ public class BaseUtilsTest extends AndroidTestCase {
assertEquals("foo bar baz ", BaseUtils.replaceWhitespace(" foo\n\tbar \r baz "));
}
+ public static void testControlCharactersCleanup() {
+ Pattern patternAll = Pattern.compile("(.*)", Pattern.DOTALL);
+ assertEquals("some control characters removed", BaseUtils.getMatch("some" + "\u001C" + "control" + (char) 0x1D + "characters removed", patternAll, ""));
+ assertEquals("newline also removed", BaseUtils.getMatch("newline\nalso\nremoved", patternAll, ""));
+ }
}