diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/symbols-included.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/symbols-included.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/symbols-included.js b/js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/symbols-included.js new file mode 100644 index 000000000..5b3241126 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/symbols-included.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 Jordan Harband. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Object.getOwnPropertyDescriptors includes Symbol keys. +esid: pending +author: Jordan Harband +features: [Symbol] +---*/ + +var value = {}; +var enumSym = Symbol('enum'); +var nonEnumSym = Symbol('nonenum'); +var symValue = Symbol('value'); + +var obj = { key: symValue }; +obj[enumSym] = value; +Object.defineProperty(obj, nonEnumSym, { writable: true, enumerable: false, configurable: true, value: value }); + +var result = Object.getOwnPropertyDescriptors(obj); + +assert.sameValue(Object.keys(result).length, 1, 'obj has 1 string-keyed descriptor'); +assert.sameValue(Object.getOwnPropertySymbols(result).length, 2, 'obj has 2 symbol-keyed descriptors'); + +assert.sameValue(result.key.configurable, true, 'result.key is configurable'); +assert.sameValue(result.key.enumerable, true, 'result.key is enumerable'); +assert.sameValue(result.key.writable, true, 'result.key is writable'); +assert.sameValue(result.key.value, symValue, 'result.key has value symValue'); + +assert.sameValue(result[enumSym].configurable, true, 'result[enumSym] is configurable'); +assert.sameValue(result[enumSym].enumerable, true, 'result[enumSym] is enumerable'); +assert.sameValue(result[enumSym].writable, true, 'result[enumSym] is writable'); +assert.sameValue(result[enumSym].value, value, 'result[enumSym] has value `value`'); + +assert.sameValue(result[nonEnumSym].configurable, true, 'result[nonEnumSym] is configurable'); +assert.sameValue(result[nonEnumSym].enumerable, false, 'result[nonEnumSym] is not enumerable'); +assert.sameValue(result[nonEnumSym].writable, true, 'result[nonEnumSym] is writable'); +assert.sameValue(result[nonEnumSym].value, value, 'result[nonEnumSym] has value `value`'); |