diff options
Diffstat (limited to 'deps/v8/test/intl/number-format')
3 files changed, 29 insertions, 0 deletions
diff --git a/deps/v8/test/intl/number-format/format-is-bound.js b/deps/v8/test/intl/number-format/format-is-bound.js index edb6a4b817..defb8982e2 100644 --- a/deps/v8/test/intl/number-format/format-is-bound.js +++ b/deps/v8/test/intl/number-format/format-is-bound.js @@ -42,3 +42,9 @@ nf.format(12345); // Reading the format doesn't add any additional property keys assertEquals(beforeCount, Object.getOwnPropertyNames(nf).length); + +// format should be bound properly even if created from a non-instance +var legacy = Intl.NumberFormat.call(Object.create(Intl.NumberFormat)); +var boundFormat = legacy.format; +assertEquals(nf.format(12345), legacy.format(12345)); +assertEquals(nf.format(54321), boundFormat(54321)); diff --git a/deps/v8/test/intl/number-format/resolved-options-unwrap.js b/deps/v8/test/intl/number-format/resolved-options-unwrap.js new file mode 100644 index 0000000000..70b40bbea4 --- /dev/null +++ b/deps/v8/test/intl/number-format/resolved-options-unwrap.js @@ -0,0 +1,11 @@ +// Copyright 2015 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. + +let nf = Object.create(Intl.NumberFormat.prototype); +nf = Intl.NumberFormat.call(nf); +const actual = Intl.NumberFormat.prototype.resolvedOptions.call(nf); + +const expected = new Intl.NumberFormat().resolvedOptions(); +Object.keys(expected).forEach(key => assertEquals(expected[key], actual[key])); +assertEquals(Object.keys(expected).length, Object.keys(actual).length); diff --git a/deps/v8/test/intl/number-format/wont-crash-by-1-or-false.js b/deps/v8/test/intl/number-format/wont-crash-by-1-or-false.js new file mode 100644 index 0000000000..518fe52bde --- /dev/null +++ b/deps/v8/test/intl/number-format/wont-crash-by-1-or-false.js @@ -0,0 +1,12 @@ +// Copyright 2018 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. + +// Make sure passing 1 or false to patched construtor won't cause crash + +Object.defineProperty(Intl.NumberFormat, Symbol.hasInstance, { value: _ => true }); +assertThrows(() => + Intl.NumberFormat.call(1), TypeError); + +assertThrows(() => + Intl.NumberFormat.call(false), TypeError); |