summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Reflect/has/symbol-property.js
blob: 49754ec000d5b4858c60bd7c9780312d77f00bdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 26.1.9
description: >
  Return boolean value from a projectKey as a Symbol
info: |
  26.1.9 Reflect.has ( target, propertyKey )

  ...
  2. Let key be ToPropertyKey(propertyKey).
  ...

  7.1.14 ToPropertyKey ( argument )

  ...
  3. If Type(key) is Symbol, then
    a. Return key.
  ...
features: [Reflect, Symbol]
---*/

var o = {};
var s1 = Symbol('1');
o[s1] = 42;

var s2 = Symbol('1');


assert.sameValue(Reflect.has(o, s1), true, 'true from own property');
assert.sameValue(
  Reflect.has(o, s2), false,
  'false when property is not present'
);

reportCompare(0, 0);