Merge pull request #505 from anba/intl_name

Add coverage for 'name' property of Intl built-in functions
This commit is contained in:
Gorkem Yakin 2016-02-19 11:04:38 -08:00
commit 07aafd0c63
15 changed files with 384 additions and 0 deletions

26
test/intl402/Collator/name.js Executable file
View File

@ -0,0 +1,26 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.Collator
description: >
Intl.Collator.name is "Collator".
info: >
10.1.2 Intl.Collator ([ locales [ , options ]])
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.Collator.name, "Collator");
verifyNotEnumerable(Intl.Collator, "name");
verifyNotWritable(Intl.Collator, "name");
verifyConfigurable(Intl.Collator, "name");

View File

@ -0,0 +1,22 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.Collator.prototype.compare
description: >
The bound Collator compare function is an anonymous function.
info: >
10.3.3 get Intl.Collator.prototype.compare
...
4. If collator.[[boundCompare]] is undefined, then
a. Let F be a new built-in function object as defined in 10.3.4.
b. Let bc be BoundFunctionCreate(F, collator, « »).
c. Perform ! DefinePropertyOrThrow(bc, "length", PropertyDescriptor {[[Value]]: 2, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}).
d. Set collator.[[boundCompare]] to bc.
...
---*/
var compareFn = new Intl.Collator().compare;
assert.sameValue(Object.prototype.hasOwnProperty.call(compareFn, "name"), false);

View File

@ -0,0 +1,28 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.Collator.prototype.compare
description: >
get Intl.Collator.prototype.compare.name is "get compare".
info: >
10.3.3 get Intl.Collator.prototype.compare
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
var desc = Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare");
assert.sameValue(desc.get.name, "get compare");
verifyNotEnumerable(desc.get, "name");
verifyNotWritable(desc.get, "name");
verifyConfigurable(desc.get, "name");

View File

@ -0,0 +1,26 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.Collator.prototype.resolvedOptions
description: >
Intl.Collator.prototype.resolvedOptions.name is "resolvedOptions".
info: >
10.3.5 Intl.Collator.prototype.resolvedOptions ()
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.Collator.prototype.resolvedOptions.name, "resolvedOptions");
verifyNotEnumerable(Intl.Collator.prototype.resolvedOptions, "name");
verifyNotWritable(Intl.Collator.prototype.resolvedOptions, "name");
verifyConfigurable(Intl.Collator.prototype.resolvedOptions, "name");

View File

@ -0,0 +1,26 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.Collator.supportedLocalesOf
description: >
Intl.Collator.supportedLocalesOf.name is "supportedLocalesOf".
info: >
10.2.2 Intl.Collator.supportedLocalesOf (locales [ , options ])
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.Collator.supportedLocalesOf.name, "supportedLocalesOf");
verifyNotEnumerable(Intl.Collator.supportedLocalesOf, "name");
verifyNotWritable(Intl.Collator.supportedLocalesOf, "name");
verifyConfigurable(Intl.Collator.supportedLocalesOf, "name");

View File

@ -0,0 +1,26 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.DateTimeFormat
description: >
Intl.DateTimeFormat.name is "DateTimeFormat".
info: >
12.2.1 Intl.DateTimeFormat ([ locales [ , options ]])
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.DateTimeFormat.name, "DateTimeFormat");
verifyNotEnumerable(Intl.DateTimeFormat, "name");
verifyNotWritable(Intl.DateTimeFormat, "name");
verifyConfigurable(Intl.DateTimeFormat, "name");

View File

@ -0,0 +1,22 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.DateTimeFormat.prototype.format
description: >
The bound DateTimeFormat format function is an anonymous function.
info: >
12.4.3 get Intl.DateTimeFormat.prototype.compare
...
4. If the [[boundFormat]] internal slot of dtf is undefined, then
a. Let F be a new built-in function object as defined in DateTime Format Functions (12.1.5).
b. Let bf be BoundFunctionCreate(F, dft, « »).
c. Perform ! DefinePropertyOrThrow(bf, "length", PropertyDescriptor {[[Value]]: 1, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}).
d. Set dtf.[[boundFormat]] to bf.
...
---*/
var formatFn = new Intl.DateTimeFormat().format;
assert.sameValue(Object.prototype.hasOwnProperty.call(formatFn, "name"), false);

View File

@ -0,0 +1,28 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.DateTimeFormat.prototype.format
description: >
get Intl.DateTimeFormat.prototype.format.name is "get format".
info: >
12.4.3 get Intl.DateTimeFormat.prototype.format
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
var desc = Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, "format");
assert.sameValue(desc.get.name, "get format");
verifyNotEnumerable(desc.get, "name");
verifyNotWritable(desc.get, "name");
verifyConfigurable(desc.get, "name");

View File

@ -0,0 +1,26 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.DateTimeFormat.prototype.resolvedOptions
description: >
Intl.DateTimeFormat.prototype.resolvedOptions.name is "resolvedOptions".
info: >
12.4.4 Intl.DateTimeFormat.prototype.resolvedOptions ()
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.DateTimeFormat.prototype.resolvedOptions.name, "resolvedOptions");
verifyNotEnumerable(Intl.DateTimeFormat.prototype.resolvedOptions, "name");
verifyNotWritable(Intl.DateTimeFormat.prototype.resolvedOptions, "name");
verifyConfigurable(Intl.DateTimeFormat.prototype.resolvedOptions, "name");

View File

@ -0,0 +1,26 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.DateTimeFormat.supportedLocalesOf
description: >
Intl.DateTimeFormat.supportedLocalesOf.name is "supportedLocalesOf".
info: >
12.3.2 Intl.DateTimeFormat.supportedLocalesOf (locales [ , options ])
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.DateTimeFormat.supportedLocalesOf.name, "supportedLocalesOf");
verifyNotEnumerable(Intl.DateTimeFormat.supportedLocalesOf, "name");
verifyNotWritable(Intl.DateTimeFormat.supportedLocalesOf, "name");
verifyConfigurable(Intl.DateTimeFormat.supportedLocalesOf, "name");

View File

@ -0,0 +1,26 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.NumberFormat
description: >
Intl.NumberFormat.name is "NumberFormat".
info: >
11.2.1 Intl.NumberFormat ([ locales [ , options ]])
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.NumberFormat.name, "NumberFormat");
verifyNotEnumerable(Intl.NumberFormat, "name");
verifyNotWritable(Intl.NumberFormat, "name");
verifyConfigurable(Intl.NumberFormat, "name");

View File

@ -0,0 +1,22 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.NumberFormat.prototype.format
description: >
The bound NumberFormat format function is an anonymous function.
info: >
11.4.3 get Intl.NumberFormat.prototype.compare
...
4. If nf.[[boundFormat]] is undefined, then
a. Let F be a new built-in function object as defined in Number Format Functions (11.1.3).
b. Let bf be BoundFunctionCreate(F, nf, « »).
c. Perform ! DefinePropertyOrThrow(bf, "length", PropertyDescriptor {[[Value]]: 1, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}).
d. Set nf.[[boundFormat]] to bf.
...
---*/
var formatFn = new Intl.NumberFormat().format;
assert.sameValue(Object.prototype.hasOwnProperty.call(formatFn, "name"), false);

View File

@ -0,0 +1,28 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.NumberFormat.prototype.format
description: >
get Intl.NumberFormat.prototype.format.name is "get format".
info: >
11.4.3 get Intl.NumberFormat.prototype.format
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
var desc = Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, "format");
assert.sameValue(desc.get.name, "get format");
verifyNotEnumerable(desc.get, "name");
verifyNotWritable(desc.get, "name");
verifyConfigurable(desc.get, "name");

View File

@ -0,0 +1,26 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.NumberFormat.prototype.resolvedOptions
description: >
Intl.NumberFormat.prototype.resolvedOptions.name is "resolvedOptions".
info: >
11.4.4 Intl.NumberFormat.prototype.resolvedOptions ()
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.NumberFormat.prototype.resolvedOptions.name, "resolvedOptions");
verifyNotEnumerable(Intl.NumberFormat.prototype.resolvedOptions, "name");
verifyNotWritable(Intl.NumberFormat.prototype.resolvedOptions, "name");
verifyConfigurable(Intl.NumberFormat.prototype.resolvedOptions, "name");

View File

@ -0,0 +1,26 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-Intl.NumberFormat.supportedLocalesOf
description: >
Intl.NumberFormat.supportedLocalesOf.name is "supportedLocalesOf".
info: >
11.3.2 Intl.NumberFormat.supportedLocalesOf (locales [ , options ])
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.NumberFormat.supportedLocalesOf.name, "supportedLocalesOf");
verifyNotEnumerable(Intl.NumberFormat.supportedLocalesOf, "name");
verifyNotWritable(Intl.NumberFormat.supportedLocalesOf, "name");
verifyConfigurable(Intl.NumberFormat.supportedLocalesOf, "name");