commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject [06/14] [lang] LANG-1300: Updated StringUtilsEqualsIndexOfTest to account for new changes
Date Fri, 17 Mar 2017 11:05:43 GMT
LANG-1300: Updated StringUtilsEqualsIndexOfTest to account for new changes


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/0181c805
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/0181c805
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/0181c805

Branch: refs/heads/master
Commit: 0181c8059c081d144cad36d003379bd50fcd9da7
Parents: a8f41ec
Author: MarkDacek <mark.dacek@richmond.edu>
Authored: Mon Mar 6 21:54:40 2017 -0500
Committer: MarkDacek <mark.dacek@richmond.edu>
Committed: Mon Mar 6 21:54:40 2017 -0500

----------------------------------------------------------------------
 .../lang3/StringUtilsEqualsIndexOfTest.java     | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/0181c805/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
index 9014bfa..1c99fa4 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
@@ -294,6 +294,18 @@ public class StringUtilsEqualsIndexOfTest  {
         assertEquals(2, StringUtils.indexOf("aabaabaa", 'b', -1));
 
         assertEquals(5, StringUtils.indexOf(new StringBuilder("aabaabaa"), 'b', 3));
+        
+        //LANG-1300 tests go here
+        final int CODE_POINT = 0x2070E;
+    	StringBuilder builder = new StringBuilder();
+    	builder.appendCodePoint(CODE_POINT);
+    	assertEquals(0, StringUtils.indexOf(builder, CODE_POINT, 0));
+    	//inner branch on the supplementary character block
+    	char[] tmp = {(char) 55361};
+    	builder = new StringBuilder();
+    	builder.append(tmp);
+    	assertEquals(-1, StringUtils.indexOf(builder, CODE_POINT, 0));
+        
     }
 
     @Test
@@ -525,6 +537,17 @@ public class StringUtilsEqualsIndexOfTest  {
         assertEquals(0, StringUtils.lastIndexOf("aabaabaa", 'a', 0));
 
         assertEquals(2, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b', 2));
+        
+        //LANG-1300 addition test
+        final int CODE_POINT = 0x2070E;
+    	StringBuilder builder = new StringBuilder();
+    	builder.appendCodePoint(CODE_POINT);
+    	assertEquals(0, StringUtils.lastIndexOf(builder, CODE_POINT, 0));
+    	//inner branch on the supplementary character block
+    	char[] tmp = {(char) 55361};
+    	builder = new StringBuilder();
+    	builder.append(tmp);
+    	assertEquals(-1, StringUtils.lastIndexOf(builder, CODE_POINT, 0));
     }
 
     @Test


Mime
View raw message