Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: test/intl/overrides/string.js

Issue 148883002: Synchronize with r15594. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/intl/overrides/security.js ('k') | test/intl/overrides/webkit-tests.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/intl/overrides/string.js
diff --git a/test/mjsunit/regress/regress-crbug-222893.js b/test/intl/overrides/string.js
similarity index 59%
copy from test/mjsunit/regress/regress-crbug-222893.js
copy to test/intl/overrides/string.js
index d5baa7b2579b9330231dc7e3329b42aa1a579a60..9e9da4da1d152c731eb5b7a01d75da4dd72b1730 100644
--- a/test/mjsunit/regress/regress-crbug-222893.js
+++ b/test/intl/overrides/string.js
@@ -25,40 +25,45 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --expose-debug-as debug
+// Tests String.prototype.localeCompare method override.
-Debug = debug.Debug
+var testData = {
+ 'en': ['blood', 'bull', 'ascend', 'zed', 'down'],
+ 'sr': ['новине', 'ограда', 'жирафа', 'Никола', 'Андрија', 'Стара Планина',
+ 'џак', 'алав', 'ћук', 'чука'],
+ 'de': ['März', 'Fuße', 'FUSSE', 'Fluße', 'Flusse', 'flusse', 'fluße',
+ 'flüße', 'flüsse']
+};
-var error = null;
-var array = ["a", "b", "c"];
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Break) {
- assertArrayEquals(array,
- exec_state.frame(0).evaluate('arguments').value());
- }
- } catch (e) {
- error = e;
+function testArrays(locale) {
+ var data;
+ if (locale === undefined) {
+ data = testData['en'];
+ locale = [];
+ } else {
+ data = testData[locale];
}
-};
-Debug.setListener(listener);
+ var collator = new Intl.Collator(locale, options);
+ var collatorResult = data.sort(collator.compare);
+ var localeCompareResult = data.sort(function(a, b) {
+ return a.localeCompare(b, locale, options)
+ });
+ assertEquals(collatorResult, localeCompareResult);
+}
+
+// Defaults
+var options = undefined;
+testArrays();
-function f(a, b) {
- arguments;
- debugger; // Arguments object is already materialized.
-}
-f.apply(this, array);
-f("a", "b", "c");
-assertNull(error);
+// Specify locale, keep default options.
+options = undefined;
+Object.keys(testData).forEach(testArrays);
-function g(a, b) {
- debugger; // Arguments object is not yet materialized.
-}
-g.apply(this, array);
-g("a", "b", "c");
-assertNull(error);
+// Specify locale and options.
+options = {caseFirst: 'upper'};
+Object.keys(testData).forEach(testArrays);
« no previous file with comments | « test/intl/overrides/security.js ('k') | test/intl/overrides/webkit-tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698