v8/test/intl/toStringTag.js
Frank Tang 439c868ffa [Intl] Define @@toStringTag for Intl namespace
Implement https://github.com/tc39/ecma402/pull/487
Also improve test/intl/toStringTag.js

see also: https://github.com/tc39/test262/pull/2712

Bug: v8:10744
Change-Id: I678876aa21f169a8dfcec8e3ce974978a8847fe0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2315455
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69185}
2020-08-01 02:21:20 +00:00

25 lines
960 B
JavaScript

// Copyright 2016 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 descriptor;
for (const [obj, tag] of
[[Intl, "Intl"],
[Intl.Collator.prototype, "Intl.Collator"],
[Intl.DateTimeFormat.prototype, "Intl.DateTimeFormat"],
[Intl.DisplayNames.prototype, "Intl.DisplayNames"],
[Intl.Locale.prototype, "Intl.Locale"],
[Intl.ListFormat.prototype, "Intl.ListFormat"],
[Intl.NumberFormat.prototype, "Intl.NumberFormat"],
[Intl.RelativeTimeFormat.prototype, "Intl.RelativeTimeFormat"],
[Intl.PluralRules.prototype, "Intl.PluralRules"],
]) {
descriptor = Object.getOwnPropertyDescriptor(obj,
Symbol.toStringTag);
assertEquals(tag, descriptor.value);
assertFalse(descriptor.writable);
assertFalse(descriptor.enumerable);
assertTrue(descriptor.configurable);
}