OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 test_replace(not_found_1, not_found_1, "+", "-"); | 64 test_replace(not_found_1, not_found_1, "+", "-"); |
65 | 65 |
66 var not_found_2 = prefix1024 + "abcdefghijklm\u1234nopqrstuvwxyz"; | 66 var not_found_2 = prefix1024 + "abcdefghijklm\u1234nopqrstuvwxyz"; |
67 test_replace(not_found_2, not_found_2, "+", "---"); | 67 test_replace(not_found_2, not_found_2, "+", "---"); |
68 | 68 |
69 var not_found_3 = prefix1024 + "abcdefghijklmnopqrstuvwxyz"; | 69 var not_found_3 = prefix1024 + "abcdefghijklmnopqrstuvwxyz"; |
70 test_replace(not_found_3, not_found_3, "\u1234", "ZZZ"); | 70 test_replace(not_found_3, not_found_3, "\u1234", "ZZZ"); |
71 | 71 |
72 // Deep cons tree. | 72 // Deep cons tree. |
73 var nested_1 = ""; | 73 var nested_1 = ""; |
74 for (var i = 0; i < 1000000; i++) nested_1 += "y"; | 74 for (var i = 0; i < 100000; i++) nested_1 += "y"; |
75 var nested_1_result = prefix1024 + nested_1 + "aa"; | 75 var nested_1_result = prefix1024 + nested_1 + "aa"; |
76 nested_1 = prefix1024 + nested_1 + "z"; | 76 nested_1 = prefix1024 + nested_1 + "z"; |
77 test_replace(nested_1, nested_1_result, "z", "aa"); | 77 test_replace(nested_1, nested_1_result, "z", "aa"); |
78 | 78 |
79 var nested_2 = "\u2244"; | 79 var nested_2 = "\u2244"; |
80 for (var i = 0; i < 1000000; i++) nested_2 += "y"; | 80 for (var i = 0; i < 100000; i++) nested_2 += "y"; |
81 var nested_2_result = prefix1024 + nested_2 + "aa"; | 81 var nested_2_result = prefix1024 + nested_2 + "aa"; |
82 nested_2 = prefix1024 + nested_2 + "\u2012"; | 82 nested_2 = prefix1024 + nested_2 + "\u2012"; |
83 test_replace(nested_2, nested_2_result, "\u2012", "aa"); | 83 test_replace(nested_2, nested_2_result, "\u2012", "aa"); |
84 | 84 |
85 // Sliced string as input. A cons string is always flattened before sliced. | 85 // Sliced string as input. A cons string is always flattened before sliced. |
86 var slice_1 = ("ab" + prefix1024 + "cdefghijklmnopqrstuvwxyz").slice(1, -1); | 86 var slice_1 = ("ab" + prefix1024 + "cdefghijklmnopqrstuvwxyz").slice(1, -1); |
87 var slice_1_result = "b" + prefix1024 + "cdefghijklmnopqrstuvwxQ"; | 87 var slice_1_result = "b" + prefix1024 + "cdefghijklmnopqrstuvwxQ"; |
88 test_replace(slice_1, slice_1_result, "y", "Q"); | 88 test_replace(slice_1, slice_1_result, "y", "Q"); |
89 | 89 |
90 var slice_2 = (prefix1024 + "abcdefghijklmno\u1234\u1234p").slice(1, -1); | 90 var slice_2 = (prefix1024 + "abcdefghijklmno\u1234\u1234p").slice(1, -1); |
91 var slice_2_result = prefix1024.substr(1) + "abcdefghijklmnoQ\u1234"; | 91 var slice_2_result = prefix1024.substr(1) + "abcdefghijklmnoQ\u1234"; |
92 test_replace(slice_2, slice_2_result, "\u1234", "Q"); | 92 test_replace(slice_2, slice_2_result, "\u1234", "Q"); |
OLD | NEW |