diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2014-08-15 12:27:16 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2014-08-15 12:50:06 +0200 |
| commit | f96a5f385d5b5a6ae04c66c1b4f9c73be52b8cef (patch) | |
| tree | f6410bc276c1de63c9af7b8086befd5464a3d841 /tests | |
| parent | af5d62bc9112cf367a2cb4cb52185412b32bb370 (diff) | |
| download | cgeo-f96a5f385d5b5a6ae04c66c1b4f9c73be52b8cef.zip cgeo-f96a5f385d5b5a6ae04c66c1b4f9c73be52b8cef.tar.gz cgeo-f96a5f385d5b5a6ae04c66c1b4f9c73be52b8cef.tar.bz2 | |
fix #4177: TextUtils.getMatch ignores last parameter
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/src/cgeo/geocaching/utils/TextUtilsTest.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/utils/TextUtilsTest.java b/tests/src/cgeo/geocaching/utils/TextUtilsTest.java index 29c4864..709fcc4 100644 --- a/tests/src/cgeo/geocaching/utils/TextUtilsTest.java +++ b/tests/src/cgeo/geocaching/utils/TextUtilsTest.java @@ -26,4 +26,11 @@ public class TextUtilsTest extends AndroidTestCase { assertThat(TextUtils.getMatch("some" + "\u001C" + "control" + (char) 0x1D + "characters removed", patternAll, "")).isEqualTo("some control characters removed"); assertThat(TextUtils.getMatch("newline\nalso\nremoved", patternAll, "")).isEqualTo("newline also removed"); } + + public static void testGetMatch() { + final Pattern patternAll = Pattern.compile("foo(...)"); + final String text = "abc-foobar-def-fooxyz-ghi-foobaz-jkl"; + assertThat(TextUtils.getMatch(text, patternAll, false, 1, null, false)).isEqualTo("bar"); + assertThat(TextUtils.getMatch(text, patternAll, false, 1, null, true)).isEqualTo("baz"); + } } |
