v8/test/intl/regress-9464.js
Frank Tang 9d2591a695 Correct the name of the regression test
Bug: v8:9464
Change-Id: Ibdc6f9797661e357e01c2f02565eeca12abbf8ae
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1801251
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63764}
2019-09-13 16:14:50 +00:00

52 lines
1.8 KiB
JavaScript

// Copyright 2019 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.
// Number, BigInt and Intl.NumberFormat
assertThrows(
"new Intl.NumberFormat('en', { style: 'unit', unit: 'son'});",
RangeError,
"Invalid unit argument for Intl.NumberFormat() 'son'");
assertThrows(
"123n.toLocaleString('en', { style: 'unit', unit: 'son'});",
RangeError,
"Invalid unit argument for BigInt.prototype.toLocaleString() 'son'");
assertThrows(
"Math.PI.toLocaleString('en', { style: 'unit', unit: 'son'});",
RangeError,
"Invalid unit argument for Number.prototype.toLocaleString() 'son'");
// String and Intl.Collator
assertThrows(
"new Intl.Collator('en', { usage: 'mom'});",
RangeError,
"Value mom out of range for Intl.Collator options property usage");
assertThrows(
"'abc'.localeCompare('efg', 'en', { usage: 'mom'});",
RangeError,
"Value mom out of range for String.prototype.localeCompare options property usage");
// Date and Intl.DateTimeFormat
assertThrows(
"new Intl.DateTimeFormat('en', { hour: 'dad'});",
RangeError,
"Value dad out of range for Intl.DateTimeFormat options property hour");
assertThrows(
"(new Date).toLocaleDateString('en', { hour: 'dad'});",
RangeError,
"Value dad out of range for Date.prototype.toLocaleDateString options property hour");
assertThrows(
"(new Date).toLocaleString('en', { hour: 'dad'});",
RangeError,
"Value dad out of range for Date.prototype.toLocaleString options property hour");
assertThrows(
"(new Date).toLocaleTimeString('en', { hour: 'dad'});",
RangeError,
"Value dad out of range for Date.prototype.toLocaleTimeString options property hour");