Debian Codegraph @

js/src/tests/test262/harness/compare-array-sparse.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: >
6 Spares arrays are only equivalent if they have the same length.
7 includes: [compareArray.js]
8 ---*/
9
10
11 assert.compareArray([,], [,], 'Sparse arrays of the same length are equivalent.');
12 assert.throws(Test262Error, () => {
13 assert.compareArray([,], [,,]);
14 }, 'Sparse arrays of differing lengths are not equivalent.');
15 assert.throws(Test262Error, () => {
16 assert.compareArray([,,], [,]);
17 }, 'Sparse arrays of differing lengths are not equivalent.');
18 assert.throws(Test262Error, () => {
19 assert.compareArray([,], []);
20 }, 'Sparse arrays are not equivalent to empty arrays.');
21 assert.throws(Test262Error, () => {
22 assert.compareArray([], [,]);
23 }, 'Sparse arrays are not equivalent to empty arrays.');
24
25 reportCompare(0, 0);