2014-04-30 07:36:12 +00:00
|
|
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-04-30 09:04:17 +00:00
|
|
|
if ("Intl" in this) {
|
|
|
|
function overflow() {
|
|
|
|
return overflow() + 1;
|
|
|
|
}
|
|
|
|
Object.defineProperty = overflow;
|
|
|
|
assertDoesNotThrow(function() { Intl.Collator.supportedLocalesOf("en"); });
|
2014-04-30 07:36:12 +00:00
|
|
|
|
2014-04-30 09:04:17 +00:00
|
|
|
var date = new Date(Date.UTC(2004, 12, 25, 3, 0, 0));
|
|
|
|
var options = {
|
|
|
|
weekday: "long",
|
|
|
|
year: "numeric",
|
|
|
|
month: "long",
|
|
|
|
day: "numeric"
|
|
|
|
};
|
2014-04-30 07:36:12 +00:00
|
|
|
|
2014-04-30 09:04:17 +00:00
|
|
|
Object.apply = overflow;
|
|
|
|
assertDoesNotThrow(function() { date.toLocaleDateString("de-DE", options); });
|
2014-04-30 07:36:12 +00:00
|
|
|
|
2014-04-30 09:04:17 +00:00
|
|
|
var options_incomplete = {};
|
|
|
|
assertDoesNotThrow(function() {
|
|
|
|
date.toLocaleDateString("de-DE", options_incomplete);
|
|
|
|
});
|
|
|
|
assertTrue(options_incomplete.hasOwnProperty("year"));
|
2014-04-30 07:36:12 +00:00
|
|
|
|
2014-04-30 09:04:17 +00:00
|
|
|
assertDoesNotThrow(function() { date.toLocaleDateString("de-DE", undefined); });
|
|
|
|
assertDoesNotThrow(function() { date.toLocaleDateString("de-DE"); });
|
|
|
|
assertThrows(function() { date.toLocaleDateString("de-DE", null); }, TypeError);
|
|
|
|
}
|