mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 23:44:27 +02:00
Add tests for [[Description]] of Intl [[FallbackSymbol]]
If normative optional is implemented and [[FallbackSymbol]] is used, its description should be "IntlLegacyConstructedSymbol"
This commit is contained in:
parent
3c58228465
commit
20b11bee0f
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright 2020 Apple Inc. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-unwrapdatetimeformat
|
||||||
|
description: >
|
||||||
|
Tests that [[FallbackSymbol]]'s [[Description]] is "IntlLegacyConstructedSymbol" if normative optional is implemented.
|
||||||
|
author: Yusuke Suzuki
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let object = new Intl.DateTimeFormat();
|
||||||
|
let newObject = Intl.DateTimeFormat.call(object);
|
||||||
|
let symbol = null;
|
||||||
|
let error = null;
|
||||||
|
try {
|
||||||
|
let proxy = new Proxy(newObject, {
|
||||||
|
get(target, property) {
|
||||||
|
symbol = property;
|
||||||
|
return target[property];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Intl.DateTimeFormat.prototype.resolvedOptions.call(proxy);
|
||||||
|
} catch (e) {
|
||||||
|
// If normative optional is not implemented, an error will be thrown.
|
||||||
|
error = e;
|
||||||
|
assert(error instanceof TypeError);
|
||||||
|
}
|
||||||
|
if (error === null) {
|
||||||
|
assert.sameValue(typeof symbol, "symbol");
|
||||||
|
assert.sameValue(symbol.description, "IntlLegacyConstructedSymbol");
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2020 Apple Inc. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-intl.datetimeformat
|
||||||
|
description: >
|
||||||
|
Tests that [[FallbackSymbol]]'s [[Description]] is "IntlLegacyConstructedSymbol" if normative optional is implemented.
|
||||||
|
author: Yusuke Suzuki
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let object = new Intl.DateTimeFormat();
|
||||||
|
let newObject = Intl.DateTimeFormat.call(object);
|
||||||
|
let symbols = Object.getOwnPropertySymbols(newObject);
|
||||||
|
if (symbols.length !== 0) {
|
||||||
|
assert.sameValue(symbols.length, 1);
|
||||||
|
assert.sameValue(symbols[0].description, "IntlLegacyConstructedSymbol");
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright 2020 Apple Inc. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-unwrapnumberformat
|
||||||
|
description: >
|
||||||
|
Tests that [[FallbackSymbol]]'s [[Description]] is "IntlLegacyConstructedSymbol" if normative optional is implemented.
|
||||||
|
author: Yusuke Suzuki
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let object = new Intl.NumberFormat();
|
||||||
|
let newObject = Intl.NumberFormat.call(object);
|
||||||
|
let symbol = null;
|
||||||
|
let error = null;
|
||||||
|
try {
|
||||||
|
let proxy = new Proxy(newObject, {
|
||||||
|
get(target, property) {
|
||||||
|
symbol = property;
|
||||||
|
return target[property];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Intl.NumberFormat.prototype.resolvedOptions.call(proxy);
|
||||||
|
} catch (e) {
|
||||||
|
// If normative optional is not implemented, an error will be thrown.
|
||||||
|
error = e;
|
||||||
|
assert(error instanceof TypeError);
|
||||||
|
}
|
||||||
|
if (error === null) {
|
||||||
|
assert.sameValue(typeof symbol, "symbol");
|
||||||
|
assert.sameValue(symbol.description, "IntlLegacyConstructedSymbol");
|
||||||
|
}
|
17
test/intl402/NumberFormat/intl-legacy-constructed-symbol.js
Normal file
17
test/intl402/NumberFormat/intl-legacy-constructed-symbol.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2020 Apple Inc. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-intl.numberformat
|
||||||
|
description: >
|
||||||
|
Tests that [[FallbackSymbol]]'s [[Description]] is "IntlLegacyConstructedSymbol" if normative optional is implemented.
|
||||||
|
author: Yusuke Suzuki
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let object = new Intl.NumberFormat();
|
||||||
|
let newObject = Intl.NumberFormat.call(object);
|
||||||
|
let symbols = Object.getOwnPropertySymbols(newObject);
|
||||||
|
if (symbols.length !== 0) {
|
||||||
|
assert.sameValue(symbols.length, 1);
|
||||||
|
assert.sameValue(symbols[0].description, "IntlLegacyConstructedSymbol");
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user