From 07cc3c8bb19f1bc367842a0a3c1b714496422454 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Tue, 22 Sep 2020 11:32:16 -0400 Subject: [PATCH] Coverage: calling array methods with boolean as thisValue. Fixes gh-2803 --- .../prototype/concat/call-with-boolean.js | 18 ++++++++++++++++++ .../prototype/copyWithin/call-with-boolean.js | 18 ++++++++++++++++++ .../prototype/every/call-with-boolean.js | 18 ++++++++++++++++++ .../Array/prototype/fill/call-with-boolean.js | 18 ++++++++++++++++++ .../prototype/filter/call-with-boolean.js | 19 +++++++++++++++++++ .../Array/prototype/find/call-with-boolean.js | 18 ++++++++++++++++++ .../prototype/findIndex/call-with-boolean.js | 18 ++++++++++++++++++ .../Array/prototype/flat/call-with-boolean.js | 11 +++++++++++ .../prototype/flatMap/call-with-boolean.js | 19 +++++++++++++++++++ .../prototype/forEach/call-with-boolean.js | 18 ++++++++++++++++++ .../prototype/includes/call-with-boolean.js | 14 ++++++++++++++ .../prototype/indexOf/call-with-boolean.js | 10 ++++++++++ .../Array/prototype/join/call-with-boolean.js | 10 ++++++++++ .../lastIndexOf/call-with-boolean.js | 14 ++++++++++++++ .../Array/prototype/map/call-with-boolean.js | 19 +++++++++++++++++++ .../Array/prototype/pop/call-with-boolean.js | 10 ++++++++++ .../Array/prototype/push/call-with-boolean.js | 10 ++++++++++ .../prototype/reduce/call-with-boolean.js | 18 ++++++++++++++++++ .../reduceRight/call-with-boolean.js | 18 ++++++++++++++++++ .../prototype/reverse/call-with-boolean.js | 18 ++++++++++++++++++ .../prototype/shift/call-with-boolean.js | 18 ++++++++++++++++++ .../prototype/slice/call-with-boolean.js | 11 +++++++++++ .../Array/prototype/some/call-with-boolean.js | 18 ++++++++++++++++++ .../prototype/splice/call-with-boolean.js | 11 +++++++++++ .../prototype/toString/call-with-boolean.js | 18 ++++++++++++++++++ .../prototype/unshift/call-with-boolean.js | 10 ++++++++++ 26 files changed, 402 insertions(+) create mode 100644 test/built-ins/Array/prototype/concat/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/copyWithin/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/every/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/fill/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/filter/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/find/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/findIndex/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/flat/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/flatMap/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/forEach/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/includes/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/indexOf/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/join/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/lastIndexOf/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/map/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/pop/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/push/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/reduce/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/reduceRight/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/reverse/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/shift/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/slice/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/some/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/splice/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/toString/call-with-boolean.js create mode 100644 test/built-ins/Array/prototype/unshift/call-with-boolean.js diff --git a/test/built-ins/Array/prototype/concat/call-with-boolean.js b/test/built-ins/Array/prototype/concat/call-with-boolean.js new file mode 100644 index 0000000000..9e4fe4a8a2 --- /dev/null +++ b/test/built-ins/Array/prototype/concat/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.concat +description: Array.prototype.concat applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.concat.call(true)[0] instanceof Boolean, + true, + 'The result of `(Array.prototype.concat.call(true)[0] instanceof Boolean)` is true' +); +assert.sameValue( + Array.prototype.concat.call(false)[0] instanceof Boolean, + true, + 'The result of `(Array.prototype.concat.call(false)[0] instanceof Boolean)` is true' +); diff --git a/test/built-ins/Array/prototype/copyWithin/call-with-boolean.js b/test/built-ins/Array/prototype/copyWithin/call-with-boolean.js new file mode 100644 index 0000000000..447f89d7aa --- /dev/null +++ b/test/built-ins/Array/prototype/copyWithin/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.copyWithin +description: Array.prototype.copyWithin applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.copyWithin.call(true) instanceof Boolean, + true, + 'The result of `(Array.prototype.copyWithin.call(true) instanceof Boolean)` is true' +); +assert.sameValue( + Array.prototype.copyWithin.call(false) instanceof Boolean, + true, + 'The result of `(Array.prototype.copyWithin.call(false) instanceof Boolean)` is true' +); diff --git a/test/built-ins/Array/prototype/every/call-with-boolean.js b/test/built-ins/Array/prototype/every/call-with-boolean.js new file mode 100644 index 0000000000..63d988981b --- /dev/null +++ b/test/built-ins/Array/prototype/every/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +description: Array.prototype.every applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.every.call(true, () => {}), + true, + 'Array.prototype.every.call(true, () => {}) must return true' +); +assert.sameValue( + Array.prototype.every.call(false, () => {}), + true, + 'Array.prototype.every.call(false, () => {}) must return true' +); diff --git a/test/built-ins/Array/prototype/fill/call-with-boolean.js b/test/built-ins/Array/prototype/fill/call-with-boolean.js new file mode 100644 index 0000000000..058b03bf0e --- /dev/null +++ b/test/built-ins/Array/prototype/fill/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.fill +description: Array.prototype.fill applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.fill.call(true) instanceof Boolean, + true, + 'The result of `(Array.prototype.fill.call(true) instanceof Boolean)` is true' +); +assert.sameValue( + Array.prototype.fill.call(false) instanceof Boolean, + true, + 'The result of `(Array.prototype.fill.call(false) instanceof Boolean)` is true' +); diff --git a/test/built-ins/Array/prototype/filter/call-with-boolean.js b/test/built-ins/Array/prototype/filter/call-with-boolean.js new file mode 100644 index 0000000000..5d2154ed83 --- /dev/null +++ b/test/built-ins/Array/prototype/filter/call-with-boolean.js @@ -0,0 +1,19 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.filter +description: Array.prototype.filter applied to boolean primitive +includes: [compareArray.js] +---*/ + +assert.compareArray( + Array.prototype.filter.call(true, () => {}), + [], + 'Array.prototype.filter.call(true, () => {}) must return []' +); +assert.compareArray( + Array.prototype.filter.call(false, () => {}), + [], + 'Array.prototype.filter.call(false, () => {}) must return []' +); diff --git a/test/built-ins/Array/prototype/find/call-with-boolean.js b/test/built-ins/Array/prototype/find/call-with-boolean.js new file mode 100644 index 0000000000..3923c50a04 --- /dev/null +++ b/test/built-ins/Array/prototype/find/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.find +description: Array.prototype.find applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.find.call(true, () => {}), + undefined, + 'Array.prototype.find.call(true, () => {}) must return undefined' +); +assert.sameValue( + Array.prototype.find.call(false, () => {}), + undefined, + 'Array.prototype.find.call(false, () => {}) must return undefined' +); diff --git a/test/built-ins/Array/prototype/findIndex/call-with-boolean.js b/test/built-ins/Array/prototype/findIndex/call-with-boolean.js new file mode 100644 index 0000000000..3b7dd43e11 --- /dev/null +++ b/test/built-ins/Array/prototype/findIndex/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.findIndex +description: Array.prototype.findIndex applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.findIndex.call(true, () => {}), + -1, + 'Array.prototype.findIndex.call(true, () => {}) must return -1' +); +assert.sameValue( + Array.prototype.findIndex.call(false, () => {}), + -1, + 'Array.prototype.findIndex.call(false, () => {}) must return -1' +); diff --git a/test/built-ins/Array/prototype/flat/call-with-boolean.js b/test/built-ins/Array/prototype/flat/call-with-boolean.js new file mode 100644 index 0000000000..796b0f7f5e --- /dev/null +++ b/test/built-ins/Array/prototype/flat/call-with-boolean.js @@ -0,0 +1,11 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.flat +description: Array.prototype.flat applied to boolean primitive +includes: [compareArray.js] +---*/ + +assert.compareArray(Array.prototype.flat.call(true), [], 'Array.prototype.flat.call(true) must return []'); +assert.compareArray(Array.prototype.flat.call(false), [], 'Array.prototype.flat.call(false) must return []'); diff --git a/test/built-ins/Array/prototype/flatMap/call-with-boolean.js b/test/built-ins/Array/prototype/flatMap/call-with-boolean.js new file mode 100644 index 0000000000..6525fea658 --- /dev/null +++ b/test/built-ins/Array/prototype/flatMap/call-with-boolean.js @@ -0,0 +1,19 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.flatMap +description: Array.prototype.flatMap applied to boolean primitive +includes: [compareArray.js] +---*/ + +assert.compareArray( + Array.prototype.flatMap.call(true, () => {}), + [], + 'Array.prototype.flatMap.call(true, () => {}) must return []' +); +assert.compareArray( + Array.prototype.flatMap.call(false, () => {}), + [], + 'Array.prototype.flatMap.call(false, () => {}) must return []' +); diff --git a/test/built-ins/Array/prototype/forEach/call-with-boolean.js b/test/built-ins/Array/prototype/forEach/call-with-boolean.js new file mode 100644 index 0000000000..f76e9c7c4e --- /dev/null +++ b/test/built-ins/Array/prototype/forEach/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.forEach +description: Array.prototype.forEach applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.forEach.call(true, () => {}), + undefined, + 'Array.prototype.forEach.call(true, () => {}) must return undefined' +); +assert.sameValue( + Array.prototype.forEach.call(false, () => {}), + undefined, + 'Array.prototype.forEach.call(false, () => {}) must return undefined' +); diff --git a/test/built-ins/Array/prototype/includes/call-with-boolean.js b/test/built-ins/Array/prototype/includes/call-with-boolean.js new file mode 100644 index 0000000000..695c249baa --- /dev/null +++ b/test/built-ins/Array/prototype/includes/call-with-boolean.js @@ -0,0 +1,14 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.includes +description: Array.prototype.includes applied to boolean primitive +---*/ + +assert.sameValue(Array.prototype.includes.call(true), false, 'Array.prototype.includes.call(true) must return false'); +assert.sameValue( + Array.prototype.includes.call(false), + false, + 'Array.prototype.includes.call(false) must return false' +); diff --git a/test/built-ins/Array/prototype/indexOf/call-with-boolean.js b/test/built-ins/Array/prototype/indexOf/call-with-boolean.js new file mode 100644 index 0000000000..170222f9aa --- /dev/null +++ b/test/built-ins/Array/prototype/indexOf/call-with-boolean.js @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.indexOf +description: Array.prototype.indexOf applied to boolean primitive +---*/ + +assert.sameValue(Array.prototype.indexOf.call(true), -1, 'Array.prototype.indexOf.call(true) must return -1'); +assert.sameValue(Array.prototype.indexOf.call(false), -1, 'Array.prototype.indexOf.call(false) must return -1'); diff --git a/test/built-ins/Array/prototype/join/call-with-boolean.js b/test/built-ins/Array/prototype/join/call-with-boolean.js new file mode 100644 index 0000000000..0613a5f526 --- /dev/null +++ b/test/built-ins/Array/prototype/join/call-with-boolean.js @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.join +description: Array.prototype.join applied to boolean primitive +---*/ + +assert.sameValue(Array.prototype.join.call(true), "", 'Array.prototype.join.call(true) must return ""'); +assert.sameValue(Array.prototype.join.call(false), "", 'Array.prototype.join.call(false) must return ""'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/call-with-boolean.js b/test/built-ins/Array/prototype/lastIndexOf/call-with-boolean.js new file mode 100644 index 0000000000..626c4a274a --- /dev/null +++ b/test/built-ins/Array/prototype/lastIndexOf/call-with-boolean.js @@ -0,0 +1,14 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.lastIndexOf +description: Array.prototype.lastIndexOf applied to boolean primitive +---*/ + +assert.sameValue(Array.prototype.lastIndexOf.call(true), -1, 'Array.prototype.lastIndexOf.call(true) must return -1'); +assert.sameValue( + Array.prototype.lastIndexOf.call(false), + -1, + 'Array.prototype.lastIndexOf.call(false) must return -1' +); diff --git a/test/built-ins/Array/prototype/map/call-with-boolean.js b/test/built-ins/Array/prototype/map/call-with-boolean.js new file mode 100644 index 0000000000..ef06d9877e --- /dev/null +++ b/test/built-ins/Array/prototype/map/call-with-boolean.js @@ -0,0 +1,19 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.map +description: Array.prototype.map applied to boolean primitive +includes: [compareArray.js] +---*/ + +assert.compareArray( + Array.prototype.map.call(true, () => {}), + [], + 'Array.prototype.map.call(true, () => {}) must return []' +); +assert.compareArray( + Array.prototype.map.call(false, () => {}), + [], + 'Array.prototype.map.call(false, () => {}) must return []' +); diff --git a/test/built-ins/Array/prototype/pop/call-with-boolean.js b/test/built-ins/Array/prototype/pop/call-with-boolean.js new file mode 100644 index 0000000000..4a741ab2f8 --- /dev/null +++ b/test/built-ins/Array/prototype/pop/call-with-boolean.js @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.pop +description: Array.prototype.pop applied to boolean primitive +---*/ + +assert.sameValue(Array.prototype.pop.call(true), undefined, 'Array.prototype.pop.call(true) must return undefined'); +assert.sameValue(Array.prototype.pop.call(false), undefined, 'Array.prototype.pop.call(false) must return undefined'); diff --git a/test/built-ins/Array/prototype/push/call-with-boolean.js b/test/built-ins/Array/prototype/push/call-with-boolean.js new file mode 100644 index 0000000000..c54bec4265 --- /dev/null +++ b/test/built-ins/Array/prototype/push/call-with-boolean.js @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.push +description: Array.prototype.push applied to boolean primitive +---*/ + +assert.sameValue(Array.prototype.push.call(true), 0, 'Array.prototype.push.call(true) must return 0'); +assert.sameValue(Array.prototype.push.call(false), 0, 'Array.prototype.push.call(false) must return 0'); diff --git a/test/built-ins/Array/prototype/reduce/call-with-boolean.js b/test/built-ins/Array/prototype/reduce/call-with-boolean.js new file mode 100644 index 0000000000..a35e041e6c --- /dev/null +++ b/test/built-ins/Array/prototype/reduce/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.reduce +description: Array.prototype.reduce applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.reduce.call(true, () => {}, -1), + -1, + 'Array.prototype.reduce.call(true, () => {}, -1) must return -1' +); +assert.sameValue( + Array.prototype.reduce.call(false, () => {}, -1), + -1, + 'Array.prototype.reduce.call(false, () => {}, -1) must return -1' +); diff --git a/test/built-ins/Array/prototype/reduceRight/call-with-boolean.js b/test/built-ins/Array/prototype/reduceRight/call-with-boolean.js new file mode 100644 index 0000000000..1d3a91b88f --- /dev/null +++ b/test/built-ins/Array/prototype/reduceRight/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.reduceRight +description: Array.prototype.reduceRight applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.reduceRight.call(true, () => {}, -1), + -1, + 'Array.prototype.reduceRight.call(true, () => {}, -1) must return -1' +); +assert.sameValue( + Array.prototype.reduceRight.call(false, () => {}, -1), + -1, + 'Array.prototype.reduceRight.call(false, () => {}, -1) must return -1' +); diff --git a/test/built-ins/Array/prototype/reverse/call-with-boolean.js b/test/built-ins/Array/prototype/reverse/call-with-boolean.js new file mode 100644 index 0000000000..aa25d7e799 --- /dev/null +++ b/test/built-ins/Array/prototype/reverse/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.reverse +description: Array.prototype.reverse applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.reverse.call(true) instanceof Boolean, + true, + 'The result of `(Array.prototype.reverse.call(true) instanceof Boolean)` is true' +); +assert.sameValue( + Array.prototype.reverse.call(false) instanceof Boolean, + true, + 'The result of `(Array.prototype.reverse.call(false) instanceof Boolean)` is true' +); diff --git a/test/built-ins/Array/prototype/shift/call-with-boolean.js b/test/built-ins/Array/prototype/shift/call-with-boolean.js new file mode 100644 index 0000000000..777f0377c3 --- /dev/null +++ b/test/built-ins/Array/prototype/shift/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.shift +description: Array.prototype.shift applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.shift.call(true), + undefined, + 'Array.prototype.shift.call(true) must return undefined' +); +assert.sameValue( + Array.prototype.shift.call(false), + undefined, + 'Array.prototype.shift.call(false) must return undefined' +); diff --git a/test/built-ins/Array/prototype/slice/call-with-boolean.js b/test/built-ins/Array/prototype/slice/call-with-boolean.js new file mode 100644 index 0000000000..3aba64fa7b --- /dev/null +++ b/test/built-ins/Array/prototype/slice/call-with-boolean.js @@ -0,0 +1,11 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.slice +description: Array.prototype.slice applied to boolean primitive +includes: [compareArray.js] +---*/ + +assert.compareArray(Array.prototype.slice.call(true), [], 'Array.prototype.slice.call(true) must return []'); +assert.compareArray(Array.prototype.slice.call(false), [], 'Array.prototype.slice.call(false) must return []'); diff --git a/test/built-ins/Array/prototype/some/call-with-boolean.js b/test/built-ins/Array/prototype/some/call-with-boolean.js new file mode 100644 index 0000000000..5813f3dea5 --- /dev/null +++ b/test/built-ins/Array/prototype/some/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.some +description: Array.prototype.some applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.some.call(true, () => {}), + false, + 'Array.prototype.some.call(true, () => {}) must return false' +); +assert.sameValue( + Array.prototype.some.call(false, () => {}), + false, + 'Array.prototype.some.call(false, () => {}) must return false' +); diff --git a/test/built-ins/Array/prototype/splice/call-with-boolean.js b/test/built-ins/Array/prototype/splice/call-with-boolean.js new file mode 100644 index 0000000000..ed79d51e98 --- /dev/null +++ b/test/built-ins/Array/prototype/splice/call-with-boolean.js @@ -0,0 +1,11 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.splice +description: Array.prototype.splice applied to boolean primitive +includes: [compareArray.js] +---*/ + +assert.compareArray(Array.prototype.splice.call(true), [], 'Array.prototype.splice.call(true) must return []'); +assert.compareArray(Array.prototype.splice.call(false), [], 'Array.prototype.splice.call(false) must return []'); diff --git a/test/built-ins/Array/prototype/toString/call-with-boolean.js b/test/built-ins/Array/prototype/toString/call-with-boolean.js new file mode 100644 index 0000000000..cdd555fe68 --- /dev/null +++ b/test/built-ins/Array/prototype/toString/call-with-boolean.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.toString +description: Array.prototype.toString applied to boolean primitive +---*/ + +assert.sameValue( + Array.prototype.toString.call(true), + "[object Boolean]", + 'Array.prototype.toString.call(true) must return "[object Boolean]"' +); +assert.sameValue( + Array.prototype.toString.call(false), + "[object Boolean]", + 'Array.prototype.toString.call(false) must return "[object Boolean]"' +); diff --git a/test/built-ins/Array/prototype/unshift/call-with-boolean.js b/test/built-ins/Array/prototype/unshift/call-with-boolean.js new file mode 100644 index 0000000000..fa531b6514 --- /dev/null +++ b/test/built-ins/Array/prototype/unshift/call-with-boolean.js @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.unshift +description: Array.prototype.unshift applied to boolean primitive +---*/ + +assert.sameValue(Array.prototype.unshift.call(true), 0, 'Array.prototype.unshift.call(true) must return 0'); +assert.sameValue(Array.prototype.unshift.call(false), 0, 'Array.prototype.unshift.call(false) must return 0');