diff options
Diffstat (limited to 'js/src/tests/test262/harness/compare-array-sparse.js')
-rw-r--r-- | js/src/tests/test262/harness/compare-array-sparse.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/tests/test262/harness/compare-array-sparse.js b/js/src/tests/test262/harness/compare-array-sparse.js new file mode 100644 index 0000000000..cbfa79d425 --- /dev/null +++ b/js/src/tests/test262/harness/compare-array-sparse.js @@ -0,0 +1,25 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Spares arrays are only equivalent if they have the same length. +includes: [compareArray.js] +---*/ + + +assert.compareArray([,], [,], 'Sparse arrays of the same length are equivalent.'); +assert.throws(Test262Error, () => { + assert.compareArray([,], [,,]); +}, 'Sparse arrays of differing lengths are not equivalent.'); +assert.throws(Test262Error, () => { + assert.compareArray([,,], [,]); +}, 'Sparse arrays of differing lengths are not equivalent.'); +assert.throws(Test262Error, () => { + assert.compareArray([,], []); +}, 'Sparse arrays are not equivalent to empty arrays.'); +assert.throws(Test262Error, () => { + assert.compareArray([], [,]); +}, 'Sparse arrays are not equivalent to empty arrays.'); + +reportCompare(0, 0); |