|
| 1 | +//------------------------------------------------------------------------------------------------------- |
| 2 | +// Copyright (C) Microsoft. All rights reserved. |
| 3 | +// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. |
| 4 | +//------------------------------------------------------------------------------------------------------- |
| 5 | + |
| 6 | +WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js"); |
| 7 | + |
| 8 | +var tests = [ |
| 9 | + { |
| 10 | + name: "Symbol.prototype.description API shape", |
| 11 | + body: function () { |
| 12 | + assert.isTrue(Symbol.prototype.hasOwnProperty('description'), "Symbol.prototype has a 'description' property"); |
| 13 | + |
| 14 | + var descriptor = Object.getOwnPropertyDescriptor(Symbol.prototype, 'description'); |
| 15 | + assert.areEqual(undefined, descriptor.writable, "writable(description) isn't set"); |
| 16 | + assert.isFalse(descriptor.enumerable, "enumerable(description) must be false"); |
| 17 | + assert.isTrue(descriptor.configurable, "configurable(description) must be true"); |
| 18 | + |
| 19 | + assert.areEqual('function', typeof descriptor.get, "Symbol.prototype.description is an accessor with a getter"); |
| 20 | + assert.areEqual(0, descriptor.get.length, "Symbol.prototype.description getter has length 0"); |
| 21 | + assert.areEqual("get description", descriptor.get.name, "Symbol.prototype.description getter has name 'get description'"); |
| 22 | + assert.areEqual(undefined, descriptor.set, "Symbol.prototype.description has no setter"); |
| 23 | + } |
| 24 | + }, |
| 25 | + { |
| 26 | + name: "Symbol.prototype.description functionality", |
| 27 | + body: function () { |
| 28 | + assert.areEqual('foo', Symbol('foo').description); |
| 29 | + assert.areEqual('', Symbol('').description); |
| 30 | + assert.areEqual('null', Symbol(null).description); |
| 31 | + |
| 32 | + assert.areEqual('', Symbol().description); |
| 33 | + assert.areEqual('', Symbol(undefined).description); |
| 34 | + } |
| 35 | + }, |
| 36 | +]; |
| 37 | + |
| 38 | +testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" }); |
0 commit comments