6cf125a90c
Bug: v8:9464 Change-Id: I3252de850bbaa5fdb15f5fc2103f1ebb7be3e1ea Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1799396 Commit-Queue: Frank Tang <ftang@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#63734}
52 lines
1.8 KiB
JavaScript
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");
|