aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/StringUtilsTests.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-04-16 03:25:25 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-16 03:25:25 -0700
commita694c9ba08895dbfadd703acb731a383edad8c9f (patch)
tree027ea97e01deca7db3b804506c49726e89b9f9a9 /tests/src/com/android/inputmethod/latin/StringUtilsTests.java
parent7abeccfa2753806086c083b3ba7b5b96c40b387a (diff)
parentff766f8c4b92962440d5a11a914971bbf57d46c2 (diff)
downloadlatinime-a694c9ba08895dbfadd703acb731a383edad8c9f.tar.gz
latinime-a694c9ba08895dbfadd703acb731a383edad8c9f.tar.xz
latinime-a694c9ba08895dbfadd703acb731a383edad8c9f.zip
am ff766f8c: Merge "Don\'t insert automatic spaces when text looks like a URL"
* commit 'ff766f8c4b92962440d5a11a914971bbf57d46c2': Don't insert automatic spaces when text looks like a URL
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/StringUtilsTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/StringUtilsTests.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/StringUtilsTests.java b/tests/src/com/android/inputmethod/latin/StringUtilsTests.java
index 98a50b730..1e3cc8ad4 100644
--- a/tests/src/com/android/inputmethod/latin/StringUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/StringUtilsTests.java
@@ -215,4 +215,26 @@ public class StringUtilsTests extends AndroidTestCase {
checkCapitalize("Lorem!Ipsum (dolor) Sit * Amet", "Lorem!Ipsum (Dolor) Sit * Amet",
" \n,.;!?*()&", Locale.ENGLISH);
}
+
+ public void testLooksLikeURL() {
+ assertTrue(StringUtils.lastPartLooksLikeURL("http://www.google."));
+ assertFalse(StringUtils.lastPartLooksLikeURL("word wo"));
+ assertTrue(StringUtils.lastPartLooksLikeURL("/etc/foo"));
+ assertFalse(StringUtils.lastPartLooksLikeURL("left/right"));
+ assertTrue(StringUtils.lastPartLooksLikeURL("www.goo"));
+ assertTrue(StringUtils.lastPartLooksLikeURL("www."));
+ assertFalse(StringUtils.lastPartLooksLikeURL("U.S.A"));
+ assertFalse(StringUtils.lastPartLooksLikeURL("U.S.A."));
+ assertTrue(StringUtils.lastPartLooksLikeURL("rtsp://foo."));
+ assertTrue(StringUtils.lastPartLooksLikeURL("://"));
+ assertFalse(StringUtils.lastPartLooksLikeURL("abc/"));
+ assertTrue(StringUtils.lastPartLooksLikeURL("abc.def/ghi"));
+ assertFalse(StringUtils.lastPartLooksLikeURL("abc.def"));
+ // TODO: ideally this would not look like a URL, but to keep down the complexity of the
+ // code for now True is acceptable.
+ assertTrue(StringUtils.lastPartLooksLikeURL("abc./def"));
+ // TODO: ideally this would not look like a URL, but to keep down the complexity of the
+ // code for now True is acceptable.
+ assertTrue(StringUtils.lastPartLooksLikeURL(".abc/def"));
+ }
}