< prev index next >

test/jdk/java/lang/String/LiteralReplace.java

Print this page
rev 54615 : [mq]: 8222955-Optimize-String-replace-CharSequence-CharSequence-for-Latin1-encoded-strings

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -20,11 +20,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
 /* @test
- * @bug 8058779 8054307
+ * @bug 8058779 8054307 8222955
  * @library /test/lib
  * @build jdk.test.lib.RandomFactory
  * @run testng LiteralReplace
  * @summary Basic tests of String.replace(CharSequence, CharSequence)
  * @key randomness

@@ -102,10 +102,18 @@
             {"aaaaaaaaa", "aa", "aa", "aaaaaaaaa"},
             {"a.c.e.g.", ".", "-", "a-c-e-g-"},
             {"abcdefgh", "[a-h]", "X", "abcdefgh"},
             {"aa+", "a+", "", "a"},
             {"^abc$", "abc", "x", "^x$"},
+            {"abc", "b", "_", "a_c"},
+            {"abc", "bc", "_", "a_"},
+            {"abc".repeat(65537) + "end", "b", "_XYZ_", "a_XYZ_c".repeat(65537) + "end"},
+            {"abc".repeat(65537) + "end", "a", "_", "_bc".repeat(65537) + "end"},
+            {"a".repeat(65537), "a", "", ""},
+            {"ab".repeat(65537), "a", "", "b".repeat(65537)},
+            {"ab".repeat(65537), "ab", "", ""},
+            {"b" + "ab".repeat(65537), "ab", "", "b"},
 
             // more with non-latin1 characters
             {"\u4e00\u4e00\u4e00",
              "\u4e00\u4e00",
              "\u4e01",
< prev index next >