diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/is')
23 files changed, 538 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/is/browser.js b/js/src/tests/test262/built-ins/Object/is/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/browser.js diff --git a/js/src/tests/test262/built-ins/Object/is/length.js b/js/src/tests/test262/built-ins/Object/is/length.js new file mode 100644 index 0000000000..98483984b9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/length.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Object.is.length, 2, "The value of `Object.is.length` is `2`"); + +verifyNotEnumerable(Object.is, "length"); +verifyNotWritable(Object.is, "length"); +verifyConfigurable(Object.is, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/name.js b/js/src/tests/test262/built-ins/Object/is/name.js new file mode 100644 index 0000000000..f495ccbc12 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/name.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Object.is.name, 'is', "The value of `Object.is.name` is `'is'`"); + +verifyNotEnumerable(Object.is, "name"); +verifyNotWritable(Object.is, "name"); +verifyConfigurable(Object.is, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/not-a-constructor.js b/js/src/tests/test262/built-ins/Object/is/not-a-constructor.js new file mode 100644 index 0000000000..96c90fcc5d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Object.is does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, Object.is, arrow-function] +---*/ + +assert.sameValue(isConstructor(Object.is), false, 'isConstructor(Object.is) must return false'); + +assert.throws(TypeError, () => { + new Object.is(0, 0); +}, '`new Object.is(0, 0)` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-boolean.js b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-boolean.js new file mode 100644 index 0000000000..96a9b52bde --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-boolean.js @@ -0,0 +1,32 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 7.2.9 SameValue(x, y) + + ... + 8. If Type(x) is Boolean, then + a. If x and y are both true or both false, + return true; otherwise, return false. +---*/ + +assert.sameValue(Object.is(true, false), false, "`Object.is(true, false)` returns `false`"); +assert.sameValue(Object.is(false, true), false, "`Object.is(false, true)` returns `false`"); +assert.sameValue(Object.is(true, 1), false, "`Object.is(true, 1)` returns `false`"); +assert.sameValue(Object.is(false, 0), false, "`Object.is(false, 0)` returns `false`"); +assert.sameValue(Object.is(true, {}), false, "`Object.is(true, {})` returns `false`"); +assert.sameValue(Object.is(true, undefined), false, "`Object.is(true, undefined)` returns `false`"); +assert.sameValue(Object.is(false, undefined), false, "`Object.is(false, undefined)` returns `false`"); +assert.sameValue(Object.is(true, null), false, "`Object.is(true, null)` returns `false`"); +assert.sameValue(Object.is(false, null), false, "`Object.is(false, null)` returns `false`"); +assert.sameValue(Object.is(true, NaN), false, "`Object.is(true, NaN)` returns `false`"); +assert.sameValue(Object.is(false, NaN), false, "`Object.is(false, NaN)` returns `false`"); +assert.sameValue(Object.is(true, ''), false, "`Object.is(true, '')` returns `false`"); +assert.sameValue(Object.is(false, ''), false, "`Object.is(false, '')` returns `false`"); +assert.sameValue(Object.is(true, []), false, "`Object.is(true, [])` returns `false`"); +assert.sameValue(Object.is(false, []), false, "`Object.is(false, [])` returns `false`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-null.js b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-null.js new file mode 100644 index 0000000000..11373e3466 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-null.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 7.2.9 SameValue(x, y) + + ... + 3. If Type(x) is different from Type(y), return false. + ... + 5. If Type(x) is Null, return true. + ... + +---*/ + +assert.sameValue(Object.is(null), false, "`Object.is(null)` returns `false`"); +assert.sameValue(Object.is(null, undefined), false, "`Object.is(null, undefined)` returns `false`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-number.js b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-number.js new file mode 100644 index 0000000000..7dd60bed5d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-number.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + ... + 6. If Type(x) is Number, then + a. If x is NaN and y is NaN, return true. + b. If x is +0 and y is -0, return false. + c. If x is -0 and y is +0, return false. + d. If x is the same Number value as y, return true. + e. Return false. + ... +---*/ + +assert.sameValue(Object.is(+0, -0), false, "`Object.is(+0, -0)` returns `false`"); +assert.sameValue(Object.is(-0, +0), false, "`Object.is(-0, +0)` returns `false`"); +assert.sameValue(Object.is(0), false, "`Object.is(0)` returns `false`"); +assert.sameValue(Object.is(Infinity, -Infinity), false, "`Object.is(Infinity, -Infinity)` returns `false`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-object.js b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-object.js new file mode 100644 index 0000000000..38aeba6e09 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-object.js @@ -0,0 +1,34 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + ... + 10. Return true if x and y are the same Object value. Otherwise, return false. +---*/ + +assert.sameValue(Object.is({}, {}), false, "`Object.is({}, {})` returns `false`"); +assert.sameValue( + Object.is(Object(), Object()), + false, + "`Object.is(Object(), Object())` returns `false`" +); +assert.sameValue( + Object.is(new Object(), new Object()), + false, + "`Object.is(new Object(), new Object())` returns `false`" +); +assert.sameValue( + Object.is(Object(0), Object(0)), + false, + "`Object.is(Object(0), Object(0))` returns `false`" +); +assert.sameValue( + Object.is(new Object(''), new Object('')), + false, + "`Object.is(new Object(''), new Object(''))` returns `false`" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-string.js b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-string.js new file mode 100644 index 0000000000..c0ea4fde01 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-string.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 7.2.9 SameValue(x, y) + + ... + 7. If Type(x) is String, then + a. If x and y are exactly the same sequence of code units + (same length and same code units at corresponding indices) + return true; otherwise, return false. + ... +---*/ + +assert.sameValue(Object.is('', true), false, "`Object.is('', true)` returns `false`"); +assert.sameValue(Object.is('', 0), false, "`Object.is('', 0)` returns `false`"); +assert.sameValue(Object.is('', {}), false, "`Object.is('', {})` returns `false`"); +assert.sameValue( + Object.is('', undefined), + false, + "`Object.is('', undefined)` returns `false`" +); +assert.sameValue(Object.is('', null), false, "`Object.is('', null)` returns `false`"); +assert.sameValue(Object.is('', NaN), false, "`Object.is('', NaN)` returns `false`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-symbol.js b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-symbol.js new file mode 100644 index 0000000000..bfc0dddd09 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-symbol.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + ... + 6. If Type(x) is Symbol, then + a. If x and y are both the same Symbol value, + return true; otherwise, return false. + ... +features: [Symbol] +---*/ + +assert.sameValue( + Object.is(Symbol(), Symbol()), + false, + "`Object.is(Symbol(), Symbol())` returns `false`" +); +assert.sameValue( + Object.is(Symbol('description'), Symbol('description')), + false, + "`Object.is(Symbol('description'), Symbol('description'))` returns `false`" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-type.js b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-type.js new file mode 100644 index 0000000000..b33e75f234 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-type.js @@ -0,0 +1,70 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 7.2.9 SameValue(x, y) + + ... + 3. If Type(x) is different from Type(y), return false. + ... + +---*/ + +var a = {}; + +assert.sameValue(Object.is(a, true), false, "`Object.is(a, true)` returns `false`"); +assert.sameValue(Object.is(a, ''), false, "`Object.is(a, '')` returns `false`"); +assert.sameValue(Object.is(a, 0), false, "`Object.is(a, 0)` returns `false`"); +assert.sameValue( + Object.is(a, undefined), + false, + "`Object.is(a, undefined)` returns `false`" +); + +assert.sameValue(Object.is(NaN, true), false, "`Object.is(NaN, true)` returns `false`"); +assert.sameValue(Object.is(NaN, ''), false, "`Object.is(NaN, '')` returns `false`"); +assert.sameValue(Object.is(NaN, a), false, "`Object.is(NaN, a)` returns `false`"); +assert.sameValue( + Object.is(NaN, undefined), + false, + "`Object.is(NaN, undefined)` returns `false`" +); +assert.sameValue(Object.is(NaN, null), false, "`Object.is(NaN, null)` returns `false`"); + +assert.sameValue(Object.is(true, 0), false, "`Object.is(true, 0)` returns `false`"); +assert.sameValue(Object.is(true, a), false, "`Object.is(true, a)` returns `false`"); +assert.sameValue( + Object.is(true, undefined), + false, + "`Object.is(true, undefined)` returns `false`" +); +assert.sameValue(Object.is(true, null), false, "`Object.is(true, null)` returns `false`"); +assert.sameValue(Object.is(true, NaN), false, "`Object.is(true, NaN)` returns `false`"); +assert.sameValue(Object.is(true, ''), false, "`Object.is(true, '')` returns `false`"); + +assert.sameValue(Object.is(false, 0), false, "`Object.is(false, 0)` returns `false`"); +assert.sameValue(Object.is(false, a), false, "`Object.is(false, a)` returns `false`"); +assert.sameValue( + Object.is(false, undefined), + false, + "`Object.is(false, undefined)` returns `false`" +); +assert.sameValue(Object.is(false, null), false, "`Object.is(false, null)` returns `false`"); +assert.sameValue(Object.is(false, NaN), false, "`Object.is(false, NaN)` returns `false`"); +assert.sameValue(Object.is(false, ''), false, "`Object.is(false, '')` returns `false`"); + +assert.sameValue(Object.is(0, true), false, "`Object.is(0, true)` returns `false`"); +assert.sameValue(Object.is(0, a), false, "`Object.is(0, a)` returns `false`"); +assert.sameValue( + Object.is(0, undefined), + false, + "`Object.is(0, undefined)` returns `false`" +); +assert.sameValue(Object.is(0, null), false, "`Object.is(0, null)` returns `false`"); +assert.sameValue(Object.is(0, NaN), false, "`Object.is(0, NaN)` returns `false`"); +assert.sameValue(Object.is(0, ''), false, "`Object.is(0, '')` returns `false`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-undefined.js b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-undefined.js new file mode 100644 index 0000000000..2b6ac29c57 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/not-same-value-x-y-undefined.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 7.2.9 SameValue(x, y) + + ... + 4. If Type(x) is Undefined, return true. + ... + +---*/ + +assert.sameValue(Object.is(undefined, null), false, "`Object.is(undefined, null)` returns `false`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/object-is.js b/js/src/tests/test262/built-ins/Object/is/object-is.js new file mode 100644 index 0000000000..22dcd083aa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/object-is.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + + +assert.sameValue(typeof Object.is, "function"); +assert.sameValue(Object.is.name, "is"); + +verifyWritable(Object, "is"); +verifyNotEnumerable(Object, "is"); +verifyConfigurable(Object, "is"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/same-value-x-y-boolean.js b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-boolean.js new file mode 100644 index 0000000000..3af4a4b63c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-boolean.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 7.2.9 SameValue(x, y) + + ... + 8. If Type(x) is Boolean, then + a. If x and y are both true or both false, + return true; otherwise, return false. +---*/ + +assert.sameValue(Object.is(true, true), true, "`Object.is(true, true)` returns `true`"); +assert.sameValue(Object.is(false, false), true, "`Object.is(false, false)` returns `true`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/same-value-x-y-empty.js b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-empty.js new file mode 100644 index 0000000000..1a21afffe6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-empty.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 7.2.9 SameValue(x, y) + + ... + 4. If Type(x) is Undefined, return true. + ... + +---*/ + +assert.sameValue(Object.is(), true, "`Object.is()` returns `true`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/same-value-x-y-null.js b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-null.js new file mode 100644 index 0000000000..b7111df164 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-null.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 7.2.9 SameValue(x, y) + + ... + 3. If Type(x) is different from Type(y), return false. + ... + 5. If Type(x) is Null, return true. + ... + +---*/ + +assert.sameValue(Object.is(null, null), true, "`Object.is(null, null)` returns `true`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/same-value-x-y-number.js b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-number.js new file mode 100644 index 0000000000..56512031d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-number.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + ... + 6. If Type(x) is Number, then + a. If x is NaN and y is NaN, return true. + b. If x is +0 and y is -0, return false. + c. If x is -0 and y is +0, return false. + d. If x is the same Number value as y, return true. + e. Return false. + ... +---*/ + +assert.sameValue(Object.is(NaN, NaN), true, "`Object.is(NaN, NaN)` returns `true`"); +assert.sameValue(Object.is(-0, -0), true, "`Object.is(-0, -0)` returns `true`"); +assert.sameValue(Object.is(+0, +0), true, "`Object.is(+0, +0)` returns `true`"); +assert.sameValue(Object.is(0, 0), true, "`Object.is(0, 0)` returns `true`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/same-value-x-y-object.js b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-object.js new file mode 100644 index 0000000000..8a3fa70901 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-object.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + ... + 10. Return true if x and y are the same Object value. Otherwise, return false. +---*/ + +var a = {}; +var b = Object(0); +var c = new Object(""); +var d = []; +var e = Array(); +var f = new Array(); + +assert.sameValue(Object.is(a, a), true, "`Object.is(a, a)` returns `true`"); +assert.sameValue(Object.is(b, b), true, "`Object.is(b, b)` returns `true`"); +assert.sameValue(Object.is(c, c), true, "`Object.is(c, c)` returns `true`"); +assert.sameValue(Object.is(d, d), true, "`Object.is(d, d)` returns `true`"); +assert.sameValue(Object.is(e, e), true, "`Object.is(e, e)` returns `true`"); +assert.sameValue(Object.is(f, f), true, "`Object.is(f, f)` returns `true`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/same-value-x-y-string.js b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-string.js new file mode 100644 index 0000000000..2c9437bce9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-string.js @@ -0,0 +1,30 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 7.2.9 SameValue(x, y) + + ... + 7. If Type(x) is String, then + a. If x and y are exactly the same sequence of code units + (same length and same code units at corresponding indices) + return true; otherwise, return false. + ... +---*/ + +assert.sameValue(Object.is('', ''), true, "`Object.is('', '')` returns `true`"); +assert.sameValue( + Object.is('foo', 'foo'), + true, + "`Object.is('foo', 'foo')` returns `true`" +); +assert.sameValue( + Object.is(String('foo'), String('foo')), + true, + "`Object.is(String('foo'), String('foo'))` returns `true`" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/same-value-x-y-symbol.js b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-symbol.js new file mode 100644 index 0000000000..e10329f767 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-symbol.js @@ -0,0 +1,22 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + ... + 6. If Type(x) is Symbol, then + a. If x and y are both the same Symbol value, + return true; otherwise, return false. + ... +features: [Symbol] +---*/ + +var a = Symbol(); +var b = Symbol("description"); + +assert.sameValue(Object.is(a, a), true, "`Object.is(a, a)` returns `true`"); +assert.sameValue(Object.is(b, b), true, "`Object.is(b, b)` returns `true`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/same-value-x-y-undefined.js b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-undefined.js new file mode 100644 index 0000000000..25c8506f70 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/same-value-x-y-undefined.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.1.2.10 +description: > + Object.is ( value1, value2 ) + + 7.2.9 SameValue(x, y) + + ... + 4. If Type(x) is Undefined, return true. + ... + +---*/ + +assert.sameValue(Object.is(undefined, undefined), true, "`Object.is(undefined, undefined)` returns `true`"); +assert.sameValue(Object.is(undefined), true, "`Object.is(undefined)` returns `true`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/is/shell.js b/js/src/tests/test262/built-ins/Object/is/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/shell.js diff --git a/js/src/tests/test262/built-ins/Object/is/symbol-object-is-same-value.js b/js/src/tests/test262/built-ins/Object/is/symbol-object-is-same-value.js new file mode 100644 index 0000000000..a6c0ad77ce --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/is/symbol-object-is-same-value.js @@ -0,0 +1,17 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object.is +description: > + Object.is/SameValue: Symbol +features: [Object.is, Symbol] +---*/ +var symA = Symbol('66'); +var symB = Symbol('66'); + + +assert.sameValue(Object.is(symA, symA), true, "`Object.is(symA, symA)` returns `true`"); +assert.sameValue(Object.is(symB, symB), true, "`Object.is(symB, symB)` returns `true`"); +assert.sameValue(Object.is(symA, symB), false, "`Object.is(symA, symB)` returns `false`"); + +reportCompare(0, 0); |