From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../Array/prototype/every/15.4.4.16-0-1.js | 13 ++ .../Array/prototype/every/15.4.4.16-1-1.js | 14 ++ .../Array/prototype/every/15.4.4.16-1-10.js | 18 +++ .../Array/prototype/every/15.4.4.16-1-11.js | 19 +++ .../Array/prototype/every/15.4.4.16-1-12.js | 19 +++ .../Array/prototype/every/15.4.4.16-1-13.js | 18 +++ .../Array/prototype/every/15.4.4.16-1-14.js | 19 +++ .../Array/prototype/every/15.4.4.16-1-15.js | 19 +++ .../Array/prototype/every/15.4.4.16-1-2.js | 14 ++ .../Array/prototype/every/15.4.4.16-1-3.js | 22 +++ .../Array/prototype/every/15.4.4.16-1-4.js | 24 +++ .../Array/prototype/every/15.4.4.16-1-5.js | 22 +++ .../Array/prototype/every/15.4.4.16-1-6.js | 24 +++ .../Array/prototype/every/15.4.4.16-1-7.js | 15 ++ .../Array/prototype/every/15.4.4.16-1-8.js | 17 +++ .../Array/prototype/every/15.4.4.16-1-9.js | 21 +++ .../Array/prototype/every/15.4.4.16-2-1.js | 29 ++++ .../Array/prototype/every/15.4.4.16-2-10.js | 39 +++++ .../Array/prototype/every/15.4.4.16-2-11.js | 30 ++++ .../Array/prototype/every/15.4.4.16-2-12.js | 37 +++++ .../Array/prototype/every/15.4.4.16-2-13.js | 34 +++++ .../Array/prototype/every/15.4.4.16-2-14.js | 26 ++++ .../Array/prototype/every/15.4.4.16-2-17.js | 27 ++++ .../Array/prototype/every/15.4.4.16-2-18.js | 26 ++++ .../Array/prototype/every/15.4.4.16-2-19.js | 29 ++++ .../Array/prototype/every/15.4.4.16-2-2.js | 22 +++ .../Array/prototype/every/15.4.4.16-2-3.js | 35 +++++ .../Array/prototype/every/15.4.4.16-2-4.js | 28 ++++ .../Array/prototype/every/15.4.4.16-2-5.js | 44 ++++++ .../Array/prototype/every/15.4.4.16-2-6.js | 34 +++++ .../Array/prototype/every/15.4.4.16-2-7.js | 35 +++++ .../Array/prototype/every/15.4.4.16-2-8.js | 42 ++++++ .../Array/prototype/every/15.4.4.16-2-9.js | 47 ++++++ .../Array/prototype/every/15.4.4.16-3-1.js | 24 +++ .../Array/prototype/every/15.4.4.16-3-10.js | 26 ++++ .../Array/prototype/every/15.4.4.16-3-11.js | 29 ++++ .../Array/prototype/every/15.4.4.16-3-12.js | 29 ++++ .../Array/prototype/every/15.4.4.16-3-13.js | 29 ++++ .../Array/prototype/every/15.4.4.16-3-14.js | 34 +++++ .../Array/prototype/every/15.4.4.16-3-15.js | 29 ++++ .../Array/prototype/every/15.4.4.16-3-16.js | 29 ++++ .../Array/prototype/every/15.4.4.16-3-17.js | 29 ++++ .../Array/prototype/every/15.4.4.16-3-18.js | 27 ++++ .../Array/prototype/every/15.4.4.16-3-19.js | 43 ++++++ .../Array/prototype/every/15.4.4.16-3-2.js | 28 ++++ .../Array/prototype/every/15.4.4.16-3-20.js | 37 +++++ .../Array/prototype/every/15.4.4.16-3-21.js | 44 ++++++ .../Array/prototype/every/15.4.4.16-3-22.js | 43 ++++++ .../Array/prototype/every/15.4.4.16-3-23.js | 51 +++++++ .../Array/prototype/every/15.4.4.16-3-24.js | 29 ++++ .../Array/prototype/every/15.4.4.16-3-25.js | 27 ++++ .../Array/prototype/every/15.4.4.16-3-29.js | 28 ++++ .../Array/prototype/every/15.4.4.16-3-3.js | 24 +++ .../Array/prototype/every/15.4.4.16-3-4.js | 24 +++ .../Array/prototype/every/15.4.4.16-3-5.js | 24 +++ .../Array/prototype/every/15.4.4.16-3-6.js | 29 ++++ .../Array/prototype/every/15.4.4.16-3-7.js | 29 ++++ .../Array/prototype/every/15.4.4.16-3-8.js | 27 ++++ .../Array/prototype/every/15.4.4.16-3-9.js | 27 ++++ .../Array/prototype/every/15.4.4.16-4-1.js | 15 ++ .../Array/prototype/every/15.4.4.16-4-10.js | 28 ++++ .../Array/prototype/every/15.4.4.16-4-11.js | 32 ++++ .../Array/prototype/every/15.4.4.16-4-12.js | 16 ++ .../Array/prototype/every/15.4.4.16-4-15.js | 39 +++++ .../Array/prototype/every/15.4.4.16-4-3.js | 15 ++ .../Array/prototype/every/15.4.4.16-4-4.js | 15 ++ .../Array/prototype/every/15.4.4.16-4-5.js | 15 ++ .../Array/prototype/every/15.4.4.16-4-6.js | 15 ++ .../Array/prototype/every/15.4.4.16-4-7.js | 17 +++ .../Array/prototype/every/15.4.4.16-4-8.js | 31 ++++ .../Array/prototype/every/15.4.4.16-4-9.js | 35 +++++ .../Array/prototype/every/15.4.4.16-5-1-s.js | 23 +++ .../Array/prototype/every/15.4.4.16-5-1.js | 22 +++ .../Array/prototype/every/15.4.4.16-5-10.js | 23 +++ .../Array/prototype/every/15.4.4.16-5-11.js | 23 +++ .../Array/prototype/every/15.4.4.16-5-12.js | 23 +++ .../Array/prototype/every/15.4.4.16-5-13.js | 21 +++ .../Array/prototype/every/15.4.4.16-5-14.js | 20 +++ .../Array/prototype/every/15.4.4.16-5-15.js | 21 +++ .../Array/prototype/every/15.4.4.16-5-16.js | 21 +++ .../Array/prototype/every/15.4.4.16-5-17.js | 20 +++ .../Array/prototype/every/15.4.4.16-5-18.js | 21 +++ .../Array/prototype/every/15.4.4.16-5-19.js | 25 ++++ .../Array/prototype/every/15.4.4.16-5-2.js | 23 +++ .../Array/prototype/every/15.4.4.16-5-21.js | 21 +++ .../Array/prototype/every/15.4.4.16-5-22.js | 20 +++ .../Array/prototype/every/15.4.4.16-5-23.js | 20 +++ .../Array/prototype/every/15.4.4.16-5-24.js | 20 +++ .../Array/prototype/every/15.4.4.16-5-3.js | 23 +++ .../Array/prototype/every/15.4.4.16-5-4.js | 25 ++++ .../Array/prototype/every/15.4.4.16-5-5.js | 23 +++ .../Array/prototype/every/15.4.4.16-5-6.js | 22 +++ .../Array/prototype/every/15.4.4.16-5-7.js | 19 +++ .../Array/prototype/every/15.4.4.16-5-9.js | 20 +++ .../Array/prototype/every/15.4.4.16-7-1.js | 27 ++++ .../Array/prototype/every/15.4.4.16-7-2.js | 25 ++++ .../Array/prototype/every/15.4.4.16-7-3.js | 25 ++++ .../Array/prototype/every/15.4.4.16-7-4.js | 25 ++++ .../Array/prototype/every/15.4.4.16-7-5.js | 27 ++++ .../Array/prototype/every/15.4.4.16-7-6.js | 28 ++++ .../Array/prototype/every/15.4.4.16-7-7.js | 26 ++++ .../Array/prototype/every/15.4.4.16-7-8.js | 25 ++++ .../Array/prototype/every/15.4.4.16-7-9.js | 35 +++++ .../Array/prototype/every/15.4.4.16-7-b-1.js | 25 ++++ .../Array/prototype/every/15.4.4.16-7-b-10.js | 35 +++++ .../Array/prototype/every/15.4.4.16-7-b-11.js | 32 ++++ .../Array/prototype/every/15.4.4.16-7-b-12.js | 38 +++++ .../Array/prototype/every/15.4.4.16-7-b-13.js | 32 ++++ .../Array/prototype/every/15.4.4.16-7-b-14.js | 30 ++++ .../Array/prototype/every/15.4.4.16-7-b-15.js | 37 +++++ .../Array/prototype/every/15.4.4.16-7-b-16.js | 39 +++++ .../Array/prototype/every/15.4.4.16-7-b-2.js | 29 ++++ .../Array/prototype/every/15.4.4.16-7-b-3.js | 33 +++++ .../Array/prototype/every/15.4.4.16-7-b-4.js | 38 +++++ .../Array/prototype/every/15.4.4.16-7-b-5.js | 36 +++++ .../Array/prototype/every/15.4.4.16-7-b-6.js | 37 +++++ .../Array/prototype/every/15.4.4.16-7-b-7.js | 35 +++++ .../Array/prototype/every/15.4.4.16-7-b-8.js | 39 +++++ .../Array/prototype/every/15.4.4.16-7-b-9.js | 37 +++++ .../Array/prototype/every/15.4.4.16-7-c-i-1.js | 28 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-10.js | 30 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-11.js | 40 +++++ .../Array/prototype/every/15.4.4.16-7-c-i-12.js | 32 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-13.js | 45 ++++++ .../Array/prototype/every/15.4.4.16-7-c-i-14.js | 37 +++++ .../Array/prototype/every/15.4.4.16-7-c-i-15.js | 36 +++++ .../Array/prototype/every/15.4.4.16-7-c-i-16.js | 28 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-17.js | 29 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-18.js | 28 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-19.js | 32 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-2.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-i-20.js | 31 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-21.js | 33 +++++ .../Array/prototype/every/15.4.4.16-7-c-i-22.js | 26 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-25.js | 26 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-26.js | 32 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-27.js | 32 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-28.js | 39 +++++ .../Array/prototype/every/15.4.4.16-7-c-i-29.js | 41 ++++++ .../Array/prototype/every/15.4.4.16-7-c-i-3.js | 33 +++++ .../Array/prototype/every/15.4.4.16-7-c-i-30.js | 37 +++++ .../Array/prototype/every/15.4.4.16-7-c-i-31.js | 35 +++++ .../Array/prototype/every/15.4.4.16-7-c-i-4.js | 24 +++ .../Array/prototype/every/15.4.4.16-7-c-i-5.js | 42 ++++++ .../Array/prototype/every/15.4.4.16-7-c-i-6.js | 28 ++++ .../Array/prototype/every/15.4.4.16-7-c-i-7.js | 33 +++++ .../Array/prototype/every/15.4.4.16-7-c-i-8.js | 23 +++ .../Array/prototype/every/15.4.4.16-7-c-i-9.js | 34 +++++ .../Array/prototype/every/15.4.4.16-7-c-ii-1.js | 20 +++ .../Array/prototype/every/15.4.4.16-7-c-ii-10.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-ii-11.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-ii-12.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-ii-13.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-ii-16.js | 26 ++++ .../Array/prototype/every/15.4.4.16-7-c-ii-17.js | 26 ++++ .../Array/prototype/every/15.4.4.16-7-c-ii-18.js | 26 ++++ .../Array/prototype/every/15.4.4.16-7-c-ii-19.js | 26 ++++ .../Array/prototype/every/15.4.4.16-7-c-ii-2.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-ii-20.js | 29 ++++ .../Array/prototype/every/15.4.4.16-7-c-ii-21.js | 34 +++++ .../Array/prototype/every/15.4.4.16-7-c-ii-22.js | 34 +++++ .../Array/prototype/every/15.4.4.16-7-c-ii-23.js | 26 ++++ .../Array/prototype/every/15.4.4.16-7-c-ii-3.js | 28 ++++ .../Array/prototype/every/15.4.4.16-7-c-ii-4.js | 28 ++++ .../Array/prototype/every/15.4.4.16-7-c-ii-5.js | 33 +++++ .../Array/prototype/every/15.4.4.16-7-c-ii-6.js | 27 ++++ .../Array/prototype/every/15.4.4.16-7-c-ii-7.js | 34 +++++ .../Array/prototype/every/15.4.4.16-7-c-ii-8.js | 28 ++++ .../Array/prototype/every/15.4.4.16-7-c-ii-9.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-1.js | 25 ++++ .../Array/prototype/every/15.4.4.16-7-c-iii-10.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-11.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-12.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-13.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-14.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-15.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-16.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-17.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-18.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-19.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-2.js | 25 ++++ .../Array/prototype/every/15.4.4.16-7-c-iii-20.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-21.js | 19 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-22.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-23.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-24.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-25.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-27.js | 22 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-28.js | 46 ++++++ .../Array/prototype/every/15.4.4.16-7-c-iii-29.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-3.js | 25 ++++ .../Array/prototype/every/15.4.4.16-7-c-iii-4.js | 27 ++++ .../Array/prototype/every/15.4.4.16-7-c-iii-5.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-6.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-7.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-8.js | 21 +++ .../Array/prototype/every/15.4.4.16-7-c-iii-9.js | 21 +++ .../Array/prototype/every/15.4.4.16-8-1.js | 14 ++ .../Array/prototype/every/15.4.4.16-8-10.js | 27 ++++ .../Array/prototype/every/15.4.4.16-8-11.js | 25 ++++ .../Array/prototype/every/15.4.4.16-8-12.js | 24 +++ .../Array/prototype/every/15.4.4.16-8-13.js | 25 ++++ .../Array/prototype/every/15.4.4.16-8-2.js | 23 +++ .../Array/prototype/every/15.4.4.16-8-3.js | 23 +++ .../Array/prototype/every/15.4.4.16-8-4.js | 23 +++ .../Array/prototype/every/15.4.4.16-8-5.js | 23 +++ .../Array/prototype/every/15.4.4.16-8-6.js | 29 ++++ .../Array/prototype/every/15.4.4.16-8-7.js | 34 +++++ .../Array/prototype/every/15.4.4.16-8-8.js | 38 +++++ .../built-ins/Array/prototype/every/browser.js | 0 .../Array/prototype/every/call-with-boolean.js | 20 +++ .../every/callbackfn-resize-arraybuffer.js | 74 ++++++++++ .../built-ins/Array/prototype/every/length.js | 23 +++ .../built-ins/Array/prototype/every/name.js | 28 ++++ .../Array/prototype/every/not-a-constructor.js | 35 +++++ .../built-ins/Array/prototype/every/prop-desc.js | 23 +++ .../built-ins/Array/prototype/every/shell.js | 161 +++++++++++++++++++++ 217 files changed, 6016 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-0-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-10.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-11.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-12.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-13.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-14.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-15.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-2.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-8.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-9.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-10.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-11.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-12.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-13.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-14.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-17.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-18.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-19.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-2.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-8.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-9.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-10.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-11.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-12.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-13.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-14.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-15.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-16.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-17.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-18.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-19.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-2.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-20.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-21.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-22.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-23.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-24.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-25.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-29.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-8.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-9.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-10.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-11.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-12.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-15.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-8.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-9.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-1-s.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-10.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-11.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-12.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-13.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-14.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-15.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-16.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-17.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-18.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-19.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-2.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-21.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-22.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-23.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-24.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-9.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-2.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-8.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-9.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-10.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-11.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-12.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-13.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-14.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-15.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-16.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-2.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-8.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-9.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-10.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-11.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-12.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-13.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-14.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-15.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-16.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-17.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-18.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-19.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-2.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-20.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-21.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-22.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-25.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-26.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-27.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-28.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-29.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-30.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-31.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-8.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-9.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-10.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-11.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-12.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-13.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-16.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-17.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-18.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-19.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-2.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-20.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-21.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-22.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-23.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-8.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-9.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-10.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-11.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-12.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-13.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-14.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-15.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-16.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-17.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-18.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-19.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-2.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-20.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-21.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-22.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-23.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-24.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-25.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-27.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-28.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-29.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-8.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-9.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-1.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-10.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-11.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-12.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-13.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-2.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-3.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-4.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-5.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-6.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-7.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-8.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/browser.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/call-with-boolean.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/callbackfn-resize-arraybuffer.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/length.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/name.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Array/prototype/every/shell.js (limited to 'js/src/tests/test262/built-ins/Array/prototype/every') diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-0-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-0-1.js new file mode 100644 index 0000000000..5748303499 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-0-1.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. 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 must exist as a function +---*/ + +var f = Array.prototype.every; + +assert.sameValue(typeof(f), "function", 'typeof(f)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-1.js new file mode 100644 index 0000000000..28ea6d417b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-1.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. 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 undefined throws a TypeError +---*/ + + +assert.throws(TypeError, function() { + Array.prototype.every.call(undefined); // TypeError is thrown if value is undefined +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-10.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-10.js new file mode 100644 index 0000000000..84d73fedf7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-10.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. 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 the Math object +---*/ + +function callbackfn(val, idx, obj) { + return ('[object Math]' !== Object.prototype.toString.call(obj)); +} + +Math.length = 1; +Math[0] = 1; + +assert.sameValue(Array.prototype.every.call(Math, callbackfn), false, 'Array.prototype.every.call(Math, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-11.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-11.js new file mode 100644 index 0000000000..07413cbbab --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-11.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. 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 Date object +---*/ + +function callbackfn(val, idx, obj) { + return !(obj instanceof Date); +} + +var obj = new Date(); +obj.length = 1; +obj[0] = 1; + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-12.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-12.js new file mode 100644 index 0000000000..725940e814 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-12.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. 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 RegExp object +---*/ + +function callbackfn(val, idx, obj) { + return !(obj instanceof RegExp); +} + +var obj = new RegExp(); +obj.length = 1; +obj[0] = 1; + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-13.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-13.js new file mode 100644 index 0000000000..b4a4ee5a5b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-13.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. 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 the JSON object +---*/ + +function callbackfn(val, idx, obj) { + return ('[object JSON]' !== Object.prototype.toString.call(obj)); +} + +JSON.length = 1; +JSON[0] = 1; + +assert.sameValue(Array.prototype.every.call(JSON, callbackfn), false, 'Array.prototype.every.call(JSON, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-14.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-14.js new file mode 100644 index 0000000000..89ff1df9e8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-14.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. 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 Error object +---*/ + +function callbackfn(val, idx, obj) { + return !(obj instanceof Error); +} + +var obj = new Error(); +obj.length = 1; +obj[0] = 1; + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-15.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-15.js new file mode 100644 index 0000000000..a6ffd11526 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-15.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. 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 the Arguments object +---*/ + +function callbackfn(val, idx, obj) { + return ('[object Arguments]' !== Object.prototype.toString.call(obj)); +} + +var obj = (function fun() { + return arguments; +}("a", "b")); + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-2.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-2.js new file mode 100644 index 0000000000..d3ca2b6104 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-2.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. 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 null throws a TypeError +---*/ + + +assert.throws(TypeError, function() { + Array.prototype.every.call(null); // TypeError is thrown if value is null +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-3.js new file mode 100644 index 0000000000..53710c52a6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-3.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. 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 +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return obj instanceof Boolean; +} + +Boolean.prototype[0] = 1; +Boolean.prototype.length = 1; + +assert(Array.prototype.every.call(false, callbackfn), 'Array.prototype.every.call(false, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-4.js new file mode 100644 index 0000000000..502fddcc8b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-4.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. 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 object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return obj instanceof Boolean; +} + +var obj = new Boolean(true); +obj.length = 2; +obj[0] = 11; +obj[1] = 12; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-5.js new file mode 100644 index 0000000000..7f705289f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-5.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. 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 number primitive +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return obj instanceof Number; +} + +Number.prototype[0] = 1; +Number.prototype.length = 1; + +assert(Array.prototype.every.call(2.5, callbackfn), 'Array.prototype.every.call(2.5, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-6.js new file mode 100644 index 0000000000..1900feccdb --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-6.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. 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 Number object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return obj instanceof Number; +} + +var obj = new Number(-128); +obj.length = 2; +obj[0] = 11; +obj[1] = 12; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-7.js new file mode 100644 index 0000000000..11a157862b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-7.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. 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 string primitive +---*/ + +function callbackfn(val, idx, obj) { + return !(obj instanceof String); +} + +assert.sameValue(Array.prototype.every.call("hello\nworld\\!", callbackfn), false, 'Array.prototype.every.call("hello\nworld\\!", callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-8.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-8.js new file mode 100644 index 0000000000..8c91c089e5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-8.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. 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 String object +---*/ + +function callbackfn(val, idx, obj) { + return !(obj instanceof String); +} + +var obj = new String("hello\nworld\\!"); + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-9.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-9.js new file mode 100644 index 0000000000..b6f878e640 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-1-9.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 Function object +---*/ + +function callbackfn(val, idx, obj) { + return !(obj instanceof Function); +} + +var obj = function(a, b) { + return a + b; +}; +obj[0] = 11; +obj[1] = 9; + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-1.js new file mode 100644 index 0000000000..bb4777ce82 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-1.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 Array-like object, 'length' is an + own data property +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: 2 +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-10.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-10.js new file mode 100644 index 0000000000..1fb57d459f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-10.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. 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 Array-like object, 'length' is an + inherited accessor property +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var proto = {}; + +Object.defineProperty(proto, "length", { + get: function() { + return 2; + }, + configurable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child[0] = 12; +child[1] = 11; +child[2] = 9; + +assert(Array.prototype.every.call(child, callbackfn1), 'Array.prototype.every.call(child, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(child, callbackfn2), false, 'Array.prototype.every.call(child, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-11.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-11.js new file mode 100644 index 0000000000..0c4a6515d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-11.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. 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 Array-like object, 'length' is an + own accessor property without a get function +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 9, + 1: 8 +}; +Object.defineProperty(obj, "length", { + set: function() {}, + configurable: true +}); + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-12.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-12.js new file mode 100644 index 0000000000..06ac2af411 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-12.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is own accessor property without + a get function that overrides an inherited accessor property +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +Object.defineProperty(Object.prototype, "length", { + get: function() { + return 2; + }, + configurable: true +}); + +var obj = { + 0: 9, + 1: 8 +}; +Object.defineProperty(obj, "length", { + set: function() {}, + configurable: true +}); + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-13.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-13.js new file mode 100644 index 0000000000..3dfed8d28c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-13.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. 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 the Array-like object that + 'length' is inherited accessor property without a get function +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var proto = {}; +Object.defineProperty(proto, "length", { + set: function() {}, + configurable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child[0] = 9; +child[1] = 8; + +assert(Array.prototype.every.call(child, callbackfn), 'Array.prototype.every.call(child, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-14.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-14.js new file mode 100644 index 0000000000..5ba3993d15 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-14.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 the Array-like object that + 'length' property doesn't exist +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 11, + 1: 12 +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-17.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-17.js new file mode 100644 index 0000000000..d6d41c06ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-17.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. 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 the Arguments object, which + implements its own property get method +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var func = function(a, b) { + arguments[2] = 9; + return Array.prototype.every.call(arguments, callbackfn1) && + !Array.prototype.every.call(arguments, callbackfn2); +}; + +assert(func(12, 11), 'func(12, 11) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-18.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-18.js new file mode 100644 index 0000000000..ea410a0e7e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-18.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 String object, which implements + its own property get method +---*/ + +function callbackfn1(val, idx, obj) { + return parseInt(val, 10) > 1; +} + +function callbackfn2(val, idx, obj) { + return parseInt(val, 10) > 2; +} + +var str = new String("432"); + +String.prototype[3] = "1"; + +assert(Array.prototype.every.call(str, callbackfn1), 'Array.prototype.every.call(str, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(str, callbackfn2), false, 'Array.prototype.every.call(str, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-19.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-19.js new file mode 100644 index 0000000000..9b4e28396c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-19.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 Function object, which implements + its own property get method +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var fun = function(a, b) { + return a + b; +}; +fun[0] = 12; +fun[1] = 11; +fun[2] = 9; + +assert(Array.prototype.every.call(fun, callbackfn1), 'Array.prototype.every.call(fun, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(fun, callbackfn2), false, 'Array.prototype.every.call(fun, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-2.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-2.js new file mode 100644 index 0000000000..66517da434 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-2.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is own data property on an Array +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +Array.prototype[2] = 9; + +assert([12, 11].every(callbackfn1), '[12, 11].every(callbackfn1) !== true'); +assert.sameValue([12, 11].every(callbackfn2), false, '[12, 11].every(callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-3.js new file mode 100644 index 0000000000..34edd6487f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-3.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. 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 Array-like object, 'length' is an + own data property that overrides an inherited data property +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var proto = { + length: 3 +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child.length = 2; +child[0] = 12; +child[1] = 11; +child[2] = 9; + +assert(Array.prototype.every.call(child, callbackfn1), 'Array.prototype.every.call(child, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(child, callbackfn2), false, 'Array.prototype.every.call(child, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-4.js new file mode 100644 index 0000000000..401816a1dd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-4.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is own data property that + overrides an inherited data property on an Array +---*/ + +var arrProtoLen = 0; + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +arrProtoLen = Array.prototype.length; +Array.prototype.length = 0; +Array.prototype[2] = 9; + +assert([12, 11].every(callbackfn1), '[12, 11].every(callbackfn1) !== true'); +assert.sameValue([12, 11].every(callbackfn2), false, '[12, 11].every(callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-5.js new file mode 100644 index 0000000000..71a5cf7422 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-5.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. 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 Array-like object, 'length' is an + own data property that overrides an inherited accessor property +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var proto = {}; + +Object.defineProperty(proto, "length", { + get: function() { + return 3; + }, + configurable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child[0] = 12; +child[1] = 11; +child[2] = 9; + +Object.defineProperty(child, "length", { + value: 2, + configurable: true +}); + +assert(Array.prototype.every.call(child, callbackfn1), 'Array.prototype.every.call(child, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(child, callbackfn2), false, 'Array.prototype.every.call(child, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-6.js new file mode 100644 index 0000000000..afbe1bc864 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-6.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. 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 Array-like object, 'length' is an + inherited data property +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var proto = { + length: 2 +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child[0] = 12; +child[1] = 11; +child[2] = 9; + +assert(Array.prototype.every.call(child, callbackfn1), 'Array.prototype.every.call(child, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(child, callbackfn2), false, 'Array.prototype.every.call(child, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-7.js new file mode 100644 index 0000000000..63646b52c6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-7.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. 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 Array-like object, 'length' is an + own accessor property +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = {}; + +Object.defineProperty(obj, "length", { + get: function() { + return 2; + }, + configurable: true +}); + +obj[0] = 12; +obj[1] = 11; +obj[2] = 9; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-8.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-8.js new file mode 100644 index 0000000000..a84db41a55 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-8.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. 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 Array-like object, 'length' is an + own accessor property that overrides an inherited data property +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var proto = { + length: 3 +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); + +Object.defineProperty(child, "length", { + get: function() { + return 2; + }, + configurable: true +}); + +child[0] = 12; +child[1] = 11; +child[2] = 9; + +assert(Array.prototype.every.call(child, callbackfn1), 'Array.prototype.every.call(child, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(child, callbackfn2), false, 'Array.prototype.every.call(child, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-9.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-9.js new file mode 100644 index 0000000000..294a8ca36c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-2-9.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. 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 Array-like object, 'length' is an + own accessor property that overrides an inherited accessor property +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var proto = {}; + +Object.defineProperty(proto, "length", { + get: function() { + return 3; + }, + configurable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); + +Object.defineProperty(child, "length", { + get: function() { + return 2; + }, + configurable: true +}); + +child[0] = 12; +child[1] = 11; +child[2] = 9; + +assert(Array.prototype.every.call(child, callbackfn1), 'Array.prototype.every.call(child, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(child, callbackfn2), false, 'Array.prototype.every.call(child, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-1.js new file mode 100644 index 0000000000..2bb0e7335c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-1.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is undefined +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 9, + length: undefined +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-10.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-10.js new file mode 100644 index 0000000000..eb41b2930b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-10.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is a number (value is + NaN) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 9, + length: NaN +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-11.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-11.js new file mode 100644 index 0000000000..274cecba8e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-11.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is a string containing a positive + number +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: "2" +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-12.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-12.js new file mode 100644 index 0000000000..574d2775d0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-12.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is a string containing a negative + number +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 11, + 1: 12, + 2: 9, + length: "-4294967294" +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert(Array.prototype.every.call(obj, callbackfn2), 'Array.prototype.every.call(obj, callbackfn2) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-13.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-13.js new file mode 100644 index 0000000000..67629eea18 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-13.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is a string containing a decimal + number +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: "2.5" +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-14.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-14.js new file mode 100644 index 0000000000..3bb80e60f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-14.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is a string containing +/-Infinity +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var objOne = { + 0: 9, + length: "Infinity" +}; +var objTwo = { + 0: 9, + length: "+Infinity" +}; +var objThree = { + 0: 9, + length: "-Infinity" +}; + +assert.sameValue(Array.prototype.every.call(objOne, callbackfn), false, 'Array.prototype.every.call(objOne, callbackfn)'); +assert.sameValue(Array.prototype.every.call(objTwo, callbackfn), false, 'Array.prototype.every.call(objTwo, callbackfn)'); +assert(Array.prototype.every.call(objThree, callbackfn), 'Array.prototype.every.call(objThree, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-15.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-15.js new file mode 100644 index 0000000000..44c8bd416a --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-15.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is a string containing an + exponential number +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: "2E0" +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-16.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-16.js new file mode 100644 index 0000000000..e89b05d06c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-16.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is a string containing a hex + number +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: "0x0002" +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-17.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-17.js new file mode 100644 index 0000000000..96c78cd4ec --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-17.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is a string containing a number + with leading zeros +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: "0002.00" +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-18.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-18.js new file mode 100644 index 0000000000..06f0631b71 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-18.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is a string that can't + convert to a number +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 9, + 1: 8, + length: "two" +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-19.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-19.js new file mode 100644 index 0000000000..f6d9887381 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-19.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is an Object which has + an own toString method +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var toStringAccessed = false; +var obj = { + 0: 12, + 1: 11, + 2: 9, + + length: { + toString: function() { + toStringAccessed = true; + return '2'; + } + } +}; + +// objects inherit the default valueOf() method from Object +// that simply returns itself. Since the default valueOf() method +// does not return a primitive value, ES next tries to convert the object +// to a number by calling its toString() method and converting the +// resulting string to a number. + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); +assert(toStringAccessed, 'toStringAccessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-2.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-2.js new file mode 100644 index 0000000000..cb811b2e4c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-2.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 on an Array-like object if 'length' is 1 + (length overridden to true(type conversion)) +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 11, + 1: 9, + length: true +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-20.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-20.js new file mode 100644 index 0000000000..acd8b90006 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-20.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is an Object which has + an own valueOf method +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var valueOfAccessed = false; + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: { + valueOf: function() { + valueOfAccessed = true; + return 2; + } + } +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); +assert(valueOfAccessed, 'valueOfAccessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-21.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-21.js new file mode 100644 index 0000000000..237423b379 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-21.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. 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 - 'length' is an object that has an own + valueOf method that returns an object and toString method that + returns a string +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var toStringAccessed = false; +var valueOfAccessed = false; + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: { + valueOf: function() { + valueOfAccessed = true; + return {}; + }, + toString: function() { + toStringAccessed = true; + return '2'; + } + } +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); +assert(valueOfAccessed, 'valueOfAccessed !== true'); +assert(toStringAccessed, 'toStringAccessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-22.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-22.js new file mode 100644 index 0000000000..047a45dd92 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-22.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. 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 throws TypeError exception when 'length' is + an object with toString and valueOf methods that don�t return + primitive values +---*/ + +var callbackfnAccessed = false; +var toStringAccessed = false; +var valueOfAccessed = false; + +function callbackfn(val, idx, obj) { + callbackfnAccessed = true; + return val > 10; +} + +var obj = { + 0: 11, + 1: 12, + + length: { + valueOf: function() { + valueOfAccessed = true; + return {}; + }, + toString: function() { + toStringAccessed = true; + return {}; + } + } +}; +assert.throws(TypeError, function() { + Array.prototype.every.call(obj, callbackfn); +}); +assert(toStringAccessed, 'toStringAccessed !== true'); +assert(valueOfAccessed, 'valueOfAccessed !== true'); +assert.sameValue(callbackfnAccessed, false, 'callbackfnAccessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-23.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-23.js new file mode 100644 index 0000000000..957425b49e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-23.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. 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 uses inherited valueOf method when 'length' + is an object with an own toString and inherited valueOf methods +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var valueOfAccessed = false; +var toStringAccessed = false; + +var proto = { + valueOf: function() { + valueOfAccessed = true; + return 2; + } +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); + +child.toString = function() { + toStringAccessed = true; + return '1'; +}; + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: child +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); +assert(valueOfAccessed, 'valueOfAccessed !== true'); +assert.sameValue(toStringAccessed, false, 'toStringAccessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-24.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-24.js new file mode 100644 index 0000000000..cf3e03afb4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-24.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is a positive + non-integer, ensure truncation occurs in the proper direction +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: 2.685 +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-25.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-25.js new file mode 100644 index 0000000000..a0172b5547 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-25.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is a negative non-integer +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: -4294967294.5 +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert(Array.prototype.every.call(obj, callbackfn2), 'Array.prototype.every.call(obj, callbackfn2) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-29.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-29.js new file mode 100644 index 0000000000..f1515ea20f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-29.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is boundary value (2^32 + + 1) +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 11, + 1: 9, + length: 4294967297 +}; + +assert.sameValue(Array.prototype.every.call(obj, callbackfn1), false, 'Array.prototype.every.call(obj, callbackfn1)'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-3.js new file mode 100644 index 0000000000..343a0f2283 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-3.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is a number (value is 0) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 9, + length: 0 +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-4.js new file mode 100644 index 0000000000..39978edf22 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-4.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is a number (value is +0) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 9, + length: +0 +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-5.js new file mode 100644 index 0000000000..05e0a87044 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-5.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is a number (value is -0) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 9, + length: -0 +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-6.js new file mode 100644 index 0000000000..b416e4edbd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-6.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is a number (value is + positive) +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: 2 +}; + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-7.js new file mode 100644 index 0000000000..9864dabcc5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-7.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - value of 'length' is a number (value is + negative) +---*/ + +function callbackfn1(val, idx, obj) { + return val > 10; +} + +function callbackfn2(val, idx, obj) { + return val > 11; +} + +var obj = { + 0: 12, + 1: 11, + 2: 9, + length: -4294967294 +}; //length used to exec while loop is 0 + +assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true'); +assert(Array.prototype.every.call(obj, callbackfn2), 'Array.prototype.every.call(obj, callbackfn2) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-8.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-8.js new file mode 100644 index 0000000000..89c0f289df --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-8.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-3-8 +description: > + Array.prototype.every - value of 'length' is a number (value is + Infinity) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 9, + length: Infinity +}; + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-9.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-9.js new file mode 100644 index 0000000000..68982576f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-3-9.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-3-9 +description: > + Array.prototype.every - value of 'length' is a number (value is + -Infinity) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 9, + length: -Infinity +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-1.js new file mode 100644 index 0000000000..660ec859fd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-1.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-1 +description: Array.prototype.every throws TypeError if callbackfn is undefined +---*/ + +var arr = new Array(10); +assert.throws(TypeError, function() { + arr.every(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-10.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-10.js new file mode 100644 index 0000000000..436b110fde --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-10.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-10 +description: > + Array.prototype.every - the exception is not thrown if exception + was thrown by step 2 +---*/ + +var obj = { + 0: 11, + 1: 12 +}; + +Object.defineProperty(obj, "length", { + get: function() { + throw new Test262Error(); + }, + configurable: true +}); + +assert.throws(Test262Error, function() { + Array.prototype.every.call(obj, undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-11.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-11.js new file mode 100644 index 0000000000..237922ffce --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-11.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-11 +description: > + Array.prototype.every - the exception is not thrown if exception + was thrown by step 3 +---*/ + +var obj = { + 0: 11, + 1: 12 +}; + +Object.defineProperty(obj, "length", { + get: function() { + return { + toString: function() { + throw new Test262Error(); + } + }; + }, + configurable: true +}); + +assert.throws(Test262Error, function() { + Array.prototype.every.call(obj, undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-12.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-12.js new file mode 100644 index 0000000000..6621699bb0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-12.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-12 +description: Array.prototype.every - 'callbackfn' is a function +---*/ + +function callbackfn(val, idx, obj) { + return val > 10; +} + +assert.sameValue([11, 9].every(callbackfn), false, '[11, 9].every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-15.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-15.js new file mode 100644 index 0000000000..bb36b41b38 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-15.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-15 +description: > + Array.prototype.every - calling with no callbackfn is the same as + passing undefined for callbackfn +---*/ + +var obj = { + 10: 10 +}; +var lengthAccessed = false; +var loopAccessed = false; + +Object.defineProperty(obj, "length", { + get: function() { + lengthAccessed = true; + return 20; + }, + configurable: true +}); + +Object.defineProperty(obj, "0", { + get: function() { + loopAccessed = true; + return 10; + }, + configurable: true +}); +assert.throws(TypeError, function() { + Array.prototype.every.call(obj); +}); +assert(lengthAccessed, 'lengthAccessed !== true'); +assert.sameValue(loopAccessed, false, 'loopAccessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-3.js new file mode 100644 index 0000000000..4e474a3aba --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-3.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-3 +description: Array.prototype.every throws TypeError if callbackfn is null +---*/ + +var arr = new Array(10); +assert.throws(TypeError, function() { + arr.every(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-4.js new file mode 100644 index 0000000000..41ba39632c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-4.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-4 +description: Array.prototype.every throws TypeError if callbackfn is boolean +---*/ + +var arr = new Array(10); +assert.throws(TypeError, function() { + arr.every(true); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-5.js new file mode 100644 index 0000000000..e8c3e10d4c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-5.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-5 +description: Array.prototype.every throws TypeError if callbackfn is number +---*/ + +var arr = new Array(10); +assert.throws(TypeError, function() { + arr.every(5); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-6.js new file mode 100644 index 0000000000..9f3ecf12a4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-6.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-6 +description: Array.prototype.every throws TypeError if callbackfn is string +---*/ + +var arr = new Array(10); +assert.throws(TypeError, function() { + arr.every("abc"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-7.js new file mode 100644 index 0000000000..8e19f45269 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-7.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-7 +description: > + Array.prototype.every throws TypeError if callbackfn is Object + without a Call internal method +---*/ + +var arr = new Array(10); +assert.throws(TypeError, function() { + arr.every({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-8.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-8.js new file mode 100644 index 0000000000..2478684e7a --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-8.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-8 +description: > + Array.prototype.every - side effects produced by step 2 are + visible when an exception occurs +---*/ + +var obj = { + 0: 11, + 1: 12 +}; + +var accessed = false; + +Object.defineProperty(obj, "length", { + get: function() { + accessed = true; + return 2; + }, + configurable: true +}); +assert.throws(TypeError, function() { + Array.prototype.every.call(obj, null); +}); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-9.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-9.js new file mode 100644 index 0000000000..62e27db550 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-4-9.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-4-9 +description: > + Array.prototype.every - side effects produced by step 3 are + visible when an exception occurs +---*/ + +var obj = { + 0: 11, + 1: 12 +}; + +var accessed = false; + +Object.defineProperty(obj, "length", { + get: function() { + return { + toString: function() { + accessed = true; + return "2"; + } + }; + }, + configurable: true +}); +assert.throws(TypeError, function() { + Array.prototype.every.call(obj, null); +}); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-1-s.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-1-s.js new file mode 100644 index 0000000000..b58627a9ac --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-1-s.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-1-s +description: Array.prototype.every - thisArg not passed to strict callbackfn +flags: [noStrict] +---*/ + +var innerThisCorrect = false; + +function callbackfn(val, idx, obj) { + "use strict"; + innerThisCorrect = this === undefined; + return true; +} + +[1].every(callbackfn); + +assert(innerThisCorrect, 'innerThisCorrect !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-1.js new file mode 100644 index 0000000000..dbbd29508b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-1.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-1 +description: Array.prototype.every - thisArg not passed +flags: [noStrict] +---*/ + +var global = this; + +function callbackfn(val, idx, obj) +{ + return this === global; +} + +var arr = [1]; + +assert.sameValue(arr.every(callbackfn), true, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-10.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-10.js new file mode 100644 index 0000000000..772cdcf93e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-10.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-10 +description: Array.prototype.every - Array Object can be used as thisArg +---*/ + +var accessed = false; +var objArray = []; + +function callbackfn(val, idx, obj) { + accessed = true; + return this === objArray; +} + + + +assert([11].every(callbackfn, objArray), '[11].every(callbackfn, objArray) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-11.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-11.js new file mode 100644 index 0000000000..c06aa99f50 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-11.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-11 +description: Array.prototype.every - String Object can be used as thisArg +---*/ + +var accessed = false; +var objString = new String(); + +function callbackfn(val, idx, obj) { + accessed = true; + return this === objString; +} + + + +assert([11].every(callbackfn, objString), '[11].every(callbackfn, objString) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-12.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-12.js new file mode 100644 index 0000000000..8429f21f1a --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-12.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-12 +description: Array.prototype.every - Boolean Object can be used as thisArg +---*/ + +var accessed = false; +var objBoolean = new Boolean(); + +function callbackfn(val, idx, obj) { + accessed = true; + return this === objBoolean; +} + + + +assert([11].every(callbackfn, objBoolean), '[11].every(callbackfn, objBoolean) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-13.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-13.js new file mode 100644 index 0000000000..f22b4dd5bb --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-13.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-13 +description: Array.prototype.every - Number Object can be used as thisArg +---*/ + +var accessed = false; +var objNumber = new Number(); + +function callbackfn(val, idx, obj) { + accessed = true; + return this === objNumber; +} + +assert([11].every(callbackfn, objNumber), '[11].every(callbackfn, objNumber) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-14.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-14.js new file mode 100644 index 0000000000..6cb8c66d25 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-14.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-14 +description: Array.prototype.every - the Math object can be used as thisArg +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return this === Math; +} + +assert([11].every(callbackfn, Math), '[11].every(callbackfn, Math) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-15.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-15.js new file mode 100644 index 0000000000..0e76efc48c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-15.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-15 +description: Array.prototype.every - Date Object can be used as thisArg +---*/ + +var accessed = false; +var objDate = new Date(); + +function callbackfn(val, idx, obj) { + accessed = true; + return this === objDate; +} + +assert([11].every(callbackfn, objDate), '[11].every(callbackfn, objDate) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-16.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-16.js new file mode 100644 index 0000000000..2e7e8a453d --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-16.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-16 +description: Array.prototype.every - RegExp Object can be used as thisArg +---*/ + +var accessed = false; +var objRegExp = new RegExp(); + +function callbackfn(val, idx, obj) { + accessed = true; + return this === objRegExp; +} + +assert([11].every(callbackfn, objRegExp), '[11].every(callbackfn, objRegExp) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-17.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-17.js new file mode 100644 index 0000000000..5c856a3b35 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-17.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-17 +description: Array.prototype.every - the JSON object can be used as thisArg +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return this === JSON; +} + +assert([11].every(callbackfn, JSON), '[11].every(callbackfn, JSON) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-18.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-18.js new file mode 100644 index 0000000000..da70339083 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-18.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-18 +description: Array.prototype.every - Error Object can be used as thisArg +---*/ + +var accessed = false; +var objError = new RangeError(); + +function callbackfn(val, idx, obj) { + accessed = true; + return this === objError; +} + +assert([11].every(callbackfn, objError), '[11].every(callbackfn, objError) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-19.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-19.js new file mode 100644 index 0000000000..2c77316dbd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-19.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-19 +description: Array.prototype.every - the Arguments object can be used as thisArg +---*/ + +var accessed = false; +var arg; + +function callbackfn(val, idx, obj) { + accessed = true; + return this === arg; +} + +(function fun() { + arg = arguments; +}(1, 2, 3)); + +assert([11].every(callbackfn, arg), '[11].every(callbackfn, arg) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-2.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-2.js new file mode 100644 index 0000000000..8a119b612b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-2.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-2 +description: Array.prototype.every - thisArg is Object +---*/ + +var res = false; +var o = new Object(); +o.res = true; + +function callbackfn(val, idx, obj) +{ + return this.res; +} + +var arr = [1]; + +assert.sameValue(arr.every(callbackfn, o), true, 'arr.every(callbackfn, o)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-21.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-21.js new file mode 100644 index 0000000000..f3c0bb3e2f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-21.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-21 +description: Array.prototype.every - the global object can be used as thisArg +---*/ + +var global = this; +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return this === global; +} + +assert([11].every(callbackfn, global), '[11].every(callbackfn, global) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-22.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-22.js new file mode 100644 index 0000000000..1439f3cca3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-22.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-22 +description: Array.prototype.every - boolean primitive can be used as thisArg +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return this.valueOf() === false; +} + +assert([11].every(callbackfn, false), '[11].every(callbackfn, false) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-23.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-23.js new file mode 100644 index 0000000000..8726eb7180 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-23.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-23 +description: Array.prototype.every - number primitive can be used as thisArg +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return this.valueOf() === 101; +} + +assert([11].every(callbackfn, 101), '[11].every(callbackfn, 101) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-24.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-24.js new file mode 100644 index 0000000000..6807fafebb --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-24.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-24 +description: Array.prototype.every - string primitive can be used as thisArg +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return this.valueOf() === "abc"; +} + +assert([11].every(callbackfn, "abc"), '[11].every(callbackfn, "abc") !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-3.js new file mode 100644 index 0000000000..1ef5836771 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-3.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +es5id: 15.4.4.16-5-3 +description: Array.prototype.every - thisArg is Array +---*/ + +var res = false; +var a = new Array(); +a.res = true; + +function callbackfn(val, idx, obj) +{ + return this.res; +} + +var arr = [1]; + +assert.sameValue(arr.every(callbackfn, a), true, 'arr.every(callbackfn, a)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-4.js new file mode 100644 index 0000000000..e6792a467c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-4.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 - thisArg is object from object + template(prototype) +---*/ + +var res = false; + +function callbackfn(val, idx, obj) +{ + return this.res; +} + +function foo() {} +foo.prototype.res = true; +var f = new foo(); +var arr = [1]; + +assert.sameValue(arr.every(callbackfn, f), true, 'arr.every(callbackfn,f)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-5.js new file mode 100644 index 0000000000..bd15cad257 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-5.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. 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 - thisArg is object from object template +---*/ + +var res = false; + +function callbackfn(val, idx, obj) +{ + return this.res; +} + +function foo() {} +var f = new foo(); +f.res = true; +var arr = [1]; + +assert.sameValue(arr.every(callbackfn, f), true, 'arr.every(callbackfn,f)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-6.js new file mode 100644 index 0000000000..ae582cd1aa --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-6.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. 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 - thisArg is function +---*/ + +var res = false; + +function callbackfn(val, idx, obj) +{ + return this.res; +} + +function foo() {} +foo.res = true; +var arr = [1]; + +assert.sameValue(arr.every(callbackfn, foo), true, 'arr.every(callbackfn,foo)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-7.js new file mode 100644 index 0000000000..39af89d8b9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-7.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. 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 - built-in functions can be used as thisArg +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return this === eval; +} + +assert([11].every(callbackfn, eval), '[11].every(callbackfn, eval) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-9.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-9.js new file mode 100644 index 0000000000..6e74e1ef9a --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-5-9.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. 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 - Function Object can be used as thisArg +---*/ + +var accessed = false; +var objFunction = function() {}; + +function callbackfn(val, idx, obj) { + accessed = true; + return this === objFunction; +} + +assert([11].every(callbackfn, objFunction), '[11].every(callbackfn, objFunction) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-1.js new file mode 100644 index 0000000000..eaf18b68c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-1.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. 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 considers new elements added to array after + the call +---*/ + +var calledForThree = false; + +function callbackfn(val, Idx, obj) +{ + arr[2] = 3; + if (val == 3) + calledForThree = true; + return true; +} + +var arr = [1, 2, , 4, 5]; + +var res = arr.every(callbackfn); + +assert(calledForThree, 'calledForThree !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-2.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-2.js new file mode 100644 index 0000000000..95ca0bee7e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-2.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 considers new value of elements in array + after the call +---*/ + +function callbackfn(val, Idx, obj) +{ + arr[4] = 6; + if (val < 6) + return true; + else + return false; +} + +var arr = [1, 2, 3, 4, 5]; + + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-3.js new file mode 100644 index 0000000000..f0af51e8b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-3.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 doesn't visit deleted elements in array + after the call +---*/ + +function callbackfn(val, Idx, obj) +{ + delete arr[2]; + if (val == 3) + return false; + else + return true; +} + +var arr = [1, 2, 3, 4, 5]; + + +assert.sameValue(arr.every(callbackfn), true, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-4.js new file mode 100644 index 0000000000..8e933e580f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-4.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 doesn't visit deleted elements when + Array.length is decreased +---*/ + +function callbackfn(val, Idx, obj) +{ + arr.length = 3; + if (val < 4) + return true; + else + return false; +} + +var arr = [1, 2, 3, 4, 6]; + + +assert.sameValue(arr.every(callbackfn), true, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-5.js new file mode 100644 index 0000000000..16e3d6100f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-5.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. 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 doesn't consider newly added elements in + sparse array +---*/ + +function callbackfn(val, Idx, obj) +{ + arr[1000] = 3; + if (val < 3) + return true; + else + return false; +} + +var arr = new Array(10); +arr[1] = 1; +arr[2] = 2; + + +assert.sameValue(arr.every(callbackfn), true, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-6.js new file mode 100644 index 0000000000..3c0aea28c0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-6.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 visits deleted element in array after the + call when same index is also present in prototype +---*/ + +function callbackfn(val, Idx, obj) +{ + delete arr[2]; + if (val == 3) + return false; + else + return true; +} + +Array.prototype[2] = 3; +var arr = [1, 2, 3, 4, 5]; + +var res = arr.every(callbackfn); +delete Array.prototype[2]; + +assert.sameValue(res, false, 'res'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-7.js new file mode 100644 index 0000000000..4b3366964b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-7.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 - Deleting the array itself within the + callbackfn of Array.prototype.every is successful once + Array.prototype.every is called for all elements +---*/ + +var o = new Object(); +o.arr = [1, 2, 3, 4, 5]; + +function callbackfn(val, Idx, obj) { + delete o.arr; + if (val === Idx + 1) + return true; + else + return false; +} + +assert(o.arr.every(callbackfn), 'o.arr.every(callbackfn) !== true'); +assert.sameValue(o.hasOwnProperty("arr"), false, 'o.hasOwnProperty("arr")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-8.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-8.js new file mode 100644 index 0000000000..68a382931b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-8.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 - no observable effects occur if len is 0 +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val > 10; +} + +var obj = { + 0: 11, + 1: 12, + length: 0 +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-9.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-9.js new file mode 100644 index 0000000000..0e778e091d --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-9.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. 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 - modifications to length don't change + number of iterations +---*/ + +var called = 0; + +function callbackfn(val, idx, obj) { + called++; + return val > 10; +} + +var obj = { + 1: 12, + 2: 9, + length: 2 +}; + +Object.defineProperty(obj, "0", { + get: function() { + obj.length = 3; + return 11; + }, + configurable: true +}); + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(called, 2, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-1.js new file mode 100644 index 0000000000..b221961a43 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-1.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn not called for indexes never + been assigned values +---*/ + +var callCnt = 0.; + +function callbackfn(val, Idx, obj) +{ + callCnt++; + return true; +} + +var arr = new Array(10); +arr[1] = undefined; +arr.every(callbackfn); + +assert.sameValue(callCnt, 1, 'callCnt'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-10.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-10.js new file mode 100644 index 0000000000..67d49de5dd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-10.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. 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 - deleting property of prototype causes + prototype index property not to be visited on an Array-like Object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return idx !== 1; +} +var arr = { + 2: 2, + length: 20 +}; + +Object.defineProperty(arr, "0", { + get: function() { + delete Object.prototype[1]; + return 0; + }, + configurable: true +}); + +Object.prototype[1] = 1; + +assert(Array.prototype.every.call(arr, callbackfn), 'Array.prototype.every.call(arr, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-11.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-11.js new file mode 100644 index 0000000000..5b92707559 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-11.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. 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 - deleting property of prototype causes + prototype index property not to be visited on an Array +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return idx !== 1; +} +var arr = [0, , 2]; + +Object.defineProperty(arr, "0", { + get: function() { + delete Array.prototype[1]; + return 0; + }, + configurable: true +}); + +Array.prototype[1] = 1; + +assert(arr.every(callbackfn), 'arr.every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-12.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-12.js new file mode 100644 index 0000000000..77d666ec9c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-12.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. 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 - deleting own property with prototype + property causes prototype index property to be visited on an + Array-like object +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 1 && val === 1) { + return false; + } else { + return true; + } +} +var arr = { + 0: 0, + 1: 111, + 2: 2, + length: 10 +}; + +Object.defineProperty(arr, "0", { + get: function() { + delete arr[1]; + return 0; + }, + configurable: true +}); + +Object.prototype[1] = 1; + +assert.sameValue(Array.prototype.every.call(arr, callbackfn), false, 'Array.prototype.every.call(arr, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-13.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-13.js new file mode 100644 index 0000000000..0fa44eca4d --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-13.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. 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 - deleting own property with prototype + property causes prototype index property to be visited on an Array +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 1 && val === 1) { + return false; + } else { + return true; + } +} +var arr = [0, 111, 2]; + +Object.defineProperty(arr, "0", { + get: function() { + delete arr[1]; + return 0; + }, + configurable: true +}); + +Array.prototype[1] = 1; + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-14.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-14.js new file mode 100644 index 0000000000..19b1312ebd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-14.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. 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 - decreasing length of array causes index + property not to be visited +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return idx !== 3; +} +var arr = [0, 1, 2, "last"]; + +Object.defineProperty(arr, "0", { + get: function() { + arr.length = 3; + return 0; + }, + configurable: true +}); + +assert(arr.every(callbackfn), 'arr.every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-15.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-15.js new file mode 100644 index 0000000000..fce7ac918e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-15.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. 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 - decreasing length of array with prototype + property causes prototype index property to be visited +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 2 && val === "prototype") { + return false; + } else { + return true; + } +} +var arr = [0, 1, 2]; + +Object.defineProperty(Array.prototype, "2", { + get: function() { + return "prototype"; + }, + configurable: true +}); + +Object.defineProperty(arr, "1", { + get: function() { + arr.length = 2; + return 1; + }, + configurable: true +}); + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-16.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-16.js new file mode 100644 index 0000000000..e60d1682bb --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-16.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. 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 - decreasing length of array does not delete + non-configurable properties +flags: [noStrict] +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 2 && val === "unconfigurable") { + return false; + } else { + return true; + } +} + +var arr = [0, 1, 2]; + +Object.defineProperty(arr, "2", { + get: function() { + return "unconfigurable"; + }, + configurable: false +}); + +Object.defineProperty(arr, "1", { + get: function() { + arr.length = 2; + return 1; + }, + configurable: true +}); + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-2.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-2.js new file mode 100644 index 0000000000..25914b29bd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-2.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - added properties in step 2 are visible here +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 2 && val === "length") { + return false; + } else { + return true; + } +} + +var arr = {}; + +Object.defineProperty(arr, "length", { + get: function() { + arr[2] = "length"; + return 3; + }, + configurable: true +}); + +assert.sameValue(Array.prototype.every.call(arr, callbackfn), false, 'Array.prototype.every.call(arr, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-3.js new file mode 100644 index 0000000000..73a2623d5f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-3.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. 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 - deleted properties in step 2 are visible + here +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return idx !== 2; +} +var arr = { + 2: 6.99, + 8: 19 +}; + +Object.defineProperty(arr, "length", { + get: function() { + delete arr[2]; + return 10; + }, + configurable: true +}); + +assert(Array.prototype.every.call(arr, callbackfn), 'Array.prototype.every.call(arr, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-4.js new file mode 100644 index 0000000000..2b87ad1e0d --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-4.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. 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 - properties added into own object after + current position are visited on an Array-like object +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 1 && val === 1) { + return false; + } else { + return true; + } +} + +var arr = { + length: 2 +}; + +Object.defineProperty(arr, "0", { + get: function() { + Object.defineProperty(arr, "1", { + get: function() { + return 1; + }, + configurable: true + }); + return 0; + }, + configurable: true +}); + +assert.sameValue(Array.prototype.every.call(arr, callbackfn), false, 'Array.prototype.every.call(arr, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-5.js new file mode 100644 index 0000000000..cda8b9df39 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-5.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. 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 - properties added into own object after + current position are visited on an Array +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 1 && val === 1) { + return false; + } else { + return true; + } +} + +var arr = [0, , 2]; + +Object.defineProperty(arr, "0", { + get: function() { + Object.defineProperty(arr, "1", { + get: function() { + return 1; + }, + configurable: true + }); + return 0; + }, + configurable: true +}); + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-6.js new file mode 100644 index 0000000000..727635b49d --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-6.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. 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 - properties can be added to prototype after + current position are visited on an Array-like object +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 1 && val === 6.99) { + return false; + } else { + return true; + } +} +var arr = { + length: 2 +}; + +Object.defineProperty(arr, "0", { + get: function() { + Object.defineProperty(Object.prototype, "1", { + get: function() { + return 6.99; + }, + configurable: true + }); + return 0; + }, + configurable: true +}); + +assert.sameValue(Array.prototype.every.call(arr, callbackfn), false, 'Array.prototype.every.call(arr, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-7.js new file mode 100644 index 0000000000..9ff0cf2689 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-7.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. 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 - properties can be added to prototype after + current position are visited on an Array +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 1 && val === 6.99) { + return false; + } else { + return true; + } +} +var arr = [0, , 2]; + +Object.defineProperty(arr, "0", { + get: function() { + Object.defineProperty(Array.prototype, "1", { + get: function() { + return 6.99; + }, + configurable: true + }); + return 0; + }, + configurable: true +}); + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-8.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-8.js new file mode 100644 index 0000000000..f57a6a8d79 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-8.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. 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 - deleting own property causes index + property not to be visited on an Array-like object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return idx !== 1; +} +var obj = { + length: 2 +}; + +Object.defineProperty(obj, "1", { + get: function() { + return 6.99; + }, + configurable: true +}); + +Object.defineProperty(obj, "0", { + get: function() { + delete obj[1]; + return 0; + }, + configurable: true +}); + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-9.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-9.js new file mode 100644 index 0000000000..af743c4c9a --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-b-9.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. 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 - deleting own property causes index + property not to be visited on an Array +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return idx !== 1; +} +var arr = [1, 2]; + +Object.defineProperty(arr, "1", { + get: function() { + return "6.99"; + }, + configurable: true +}); + +Object.defineProperty(arr, "0", { + get: function() { + delete arr[1]; + return 0; + }, + configurable: true +}); + +assert(arr.every(callbackfn), 'arr.every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-1.js new file mode 100644 index 0000000000..a3ec312a6f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-1.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own data + property on an Array-like object +---*/ + +var kValue = {}; + +function callbackfn(val, idx, obj) { + if (idx === 5) { + return val !== kValue; + } else { + return true; + } +} + +var obj = { + 5: kValue, + length: 100 +}; + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-10.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-10.js new file mode 100644 index 0000000000..e6ce8319dc --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-10.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own accessor + property on an Array +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 2) { + return val !== 12; + } else { + return true; + } +} + +var arr = []; + +Object.defineProperty(arr, "2", { + get: function() { + return 12; + }, + configurable: true +}); + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-11.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-11.js new file mode 100644 index 0000000000..9dbb01c5c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-11.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own accessor + property that overrides an inherited data property on an + Array-like object +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 0) { + return val === 5; + } else { + return true; + } +} + +var proto = { + 0: 5, + 1: 6 +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child.length = 10; + +Object.defineProperty(child, "0", { + get: function() { + return 11; + }, + configurable: true +}); + +assert.sameValue(Array.prototype.every.call(child, callbackfn), false, 'Array.prototype.every.call(child, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-12.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-12.js new file mode 100644 index 0000000000..f84e20f1bc --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-12.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own accessor + property that overrides an inherited data property on an Array +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 0) { + return val === 10; + } else { + return true; + } +} + +var arr = []; + +Array.prototype[0] = 10; + +Object.defineProperty(arr, "0", { + get: function() { + return 111; + }, + configurable: true +}); + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-13.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-13.js new file mode 100644 index 0000000000..1189f25845 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-13.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own accessor + property that overrides an inherited accessor property on an + Array-like object +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 1) { + return val === 6; + } else { + return true; + } +} + +var proto = {}; + +Object.defineProperty(proto, "1", { + get: function() { + return 6; + }, + configurable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child.length = 10; + +Object.defineProperty(child, "1", { + get: function() { + return 12; + }, + configurable: true +}); + + +assert.sameValue(Array.prototype.every.call(child, callbackfn), false, 'Array.prototype.every.call(child, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-14.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-14.js new file mode 100644 index 0000000000..a02801f02d --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-14.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own accessor + property that overrides an inherited accessor property on an Array +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 0) { + return val === 5; + } else { + return true; + } +} + +var arr = []; + +Object.defineProperty(Array.prototype, "0", { + get: function() { + return 5; + }, + configurable: true +}); + +Object.defineProperty(arr, "0", { + get: function() { + return 11; + }, + configurable: true +}); + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-15.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-15.js new file mode 100644 index 0000000000..eafb0d8281 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-15.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is inherited + accessor property on an Array-like object +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 1) { + return val !== 11; + } else { + return true; + } +} + +var proto = {}; + +Object.defineProperty(proto, "1", { + get: function() { + return 11; + }, + configurable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child.length = 20; + +assert.sameValue(Array.prototype.every.call(child, callbackfn), false, 'Array.prototype.every.call(child, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-16.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-16.js new file mode 100644 index 0000000000..91b7955ae5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-16.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is inherited + accessor property on an Array +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 0) { + return val !== 11; + } else { + return true; + } +} + +Object.defineProperty(Array.prototype, "0", { + get: function() { + return 11; + }, + configurable: true +}); + +assert.sameValue([, , , ].every(callbackfn), false, '[, , , ].every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-17.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-17.js new file mode 100644 index 0000000000..0b2a3ca6e0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-17.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own accessor + property without a get function on an Array-like object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return typeof val === "undefined"; +} + +var obj = { + length: 2 +}; +Object.defineProperty(obj, "1", { + set: function() {}, + configurable: true +}); + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-18.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-18.js new file mode 100644 index 0000000000..0a54c4f918 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-18.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own accessor + property without a get function on an Array +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return typeof val === "undefined"; +} + +var arr = []; + +Object.defineProperty(arr, "0", { + set: function() {}, + configurable: true +}); + +assert(arr.every(callbackfn), 'arr.every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-19.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-19.js new file mode 100644 index 0000000000..760a06ae6e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-19.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own accessor + property without a get function that overrides an inherited + accessor property on an Array-like object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return typeof val === "undefined"; +} + +var obj = { + length: 2 +}; +Object.defineProperty(obj, "1", { + set: function() {}, + configurable: true +}); + +Object.prototype[1] = 10; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-2.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-2.js new file mode 100644 index 0000000000..98b6c2bdbd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-2.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own data + property on an Array +---*/ + +var called = 0; + +function callbackfn(val, idx, obj) { + called++; + return val === 11; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert.sameValue(called, 1, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-20.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-20.js new file mode 100644 index 0000000000..e321a06144 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-20.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own accessor + property without a get function that overrides an inherited + accessor property on an Array +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return typeof val === "undefined"; +} + +var arr = []; + +Object.defineProperty(arr, "0", { + set: function() {}, + configurable: true +}); + +Array.prototype[0] = 100; + +assert(arr.every(callbackfn), 'arr.every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-21.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-21.js new file mode 100644 index 0000000000..4eb8479bf3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-21.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is inherited + accessor property without a get function on an Array-like object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return typeof val === "undefined"; +} + +var proto = {}; +Object.defineProperty(proto, "1", { + set: function() {}, + configurable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child.length = 2; + +assert(Array.prototype.every.call(child, callbackfn), 'Array.prototype.every.call(child, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-22.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-22.js new file mode 100644 index 0000000000..ce383847fa --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-22.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is inherited + accessor property without a get function on an Array +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return typeof val === "undefined"; +} + +Object.defineProperty(Array.prototype, "0", { + set: function() {}, + configurable: true +}); + +assert([, ].every(callbackfn), '[, ].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-25.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-25.js new file mode 100644 index 0000000000..89bdfc77b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-25.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 - This object is the Arguments object which + implements its own property get method (number of arguments is + less than number of parameters) +---*/ + +var called = 0; + +function callbackfn(val, idx, obj) { + called++; + return val === 11; +} + +var func = function(a, b) { + return Array.prototype.every.call(arguments, callbackfn); +}; + +assert(func(11), 'func(11) !== true'); +assert.sameValue(called, 1, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-26.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-26.js new file mode 100644 index 0000000000..95085b4dc5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-26.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. 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 - This object is the Arguments object which + implements its own property get method (number of arguments equals + number of parameters) +---*/ + +var called = 0; + +function callbackfn(val, idx, obj) { + called++; + if (idx === 0) { + return val === 11; + } else if (idx === 1) { + return val === 9; + } else { + return false; + } +} + +var func = function(a, b) { + return Array.prototype.every.call(arguments, callbackfn); +}; + +assert(func(11, 9), 'func(11, 9) !== true'); +assert.sameValue(called, 2, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-27.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-27.js new file mode 100644 index 0000000000..5828d3d03a --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-27.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. 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 - This object is the Arguments object which + implements its own property get method (number of arguments is + greater than number of parameters) +---*/ + +var called = 0; + +function callbackfn(val, idx, obj) { + called++; + if (idx < 2) { + return val > 10; + } else if (idx === 2) { + return val < 10; + } else { + return false; + } +} + +var func = function(a, b) { + return Array.prototype.every.call(arguments, callbackfn); +}; + +assert(func(11, 12, 9), 'func(11, 12, 9) !== true'); +assert.sameValue(called, 3, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-28.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-28.js new file mode 100644 index 0000000000..13fc6575d4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-28.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. 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 - element changed by getter on previous + iterations is observed on an Array +---*/ + +var preIterVisible = false; +var arr = []; + +function callbackfn(val, idx, obj) { + return val > 10; +} + +Object.defineProperty(arr, "0", { + get: function() { + preIterVisible = true; + return 11; + }, + configurable: true +}); + +Object.defineProperty(arr, "1", { + get: function() { + if (preIterVisible) { + return 9; + } else { + return 11; + } + }, + configurable: true +}); + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-29.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-29.js new file mode 100644 index 0000000000..ec59d0df3e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-29.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. 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 - element changed by getter on previous + iterations is observed on an Array-like object +---*/ + +function callbackfn(val, idx, obj) { + return val > 10; +} + +var preIterVisible = false; +var obj = { + length: 2 +}; + +Object.defineProperty(obj, "0", { + get: function() { + preIterVisible = true; + return 11; + }, + configurable: true +}); + +Object.defineProperty(obj, "1", { + get: function() { + if (preIterVisible) { + return 9; + } else { + return 13; + } + }, + configurable: true +}); + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-3.js new file mode 100644 index 0000000000..5d51ec7e94 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-3.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own data + property that overrides an inherited data property on an Array +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 5) { + return val === 100; + } else { + return true; + } +} + +var proto = { + 0: 11, + 5: 100 +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child[5] = "abc"; +child.length = 10; + +assert.sameValue(Array.prototype.every.call(child, callbackfn), false, 'Array.prototype.every.call(child, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-30.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-30.js new file mode 100644 index 0000000000..1827b8392c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-30.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. 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 - unnhandled exceptions happened in getter + terminate iteration on an Array-like object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + if (idx > 1) { + accessed = true; + } + return true; +} + +var obj = { + 0: 11, + 5: 10, + 10: 8, + length: 20 +}; +Object.defineProperty(obj, "1", { + get: function() { + throw new RangeError("unhandle exception happened in getter"); + }, + configurable: true +}); +assert.throws(RangeError, function() { + Array.prototype.every.call(obj, callbackfn); +}); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-31.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-31.js new file mode 100644 index 0000000000..b31a514d9b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-31.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. 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 - unhandled exceptions happened in getter + terminate iteration on an Array +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + if (idx > 1) { + accessed = true; + } + return true; +} + +var arr = []; +arr[5] = 10; +arr[10] = 100; + +Object.defineProperty(arr, "1", { + get: function() { + throw new RangeError("unhandle exception happened in getter"); + }, + configurable: true +}); +assert.throws(RangeError, function() { + arr.every(callbackfn); +}); +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-4.js new file mode 100644 index 0000000000..c80150753e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-4.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own data + property that overrides an inherited data property on an Array +---*/ + +var called = 0; + +function callbackfn(val, idx, obj) { + called++; + return val === 12; +} + +Array.prototype[0] = 11; +Array.prototype[1] = 11; + +assert([12, 12].every(callbackfn), '[12, 12].every(callbackfn) !== true'); +assert.sameValue(called, 2, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-5.js new file mode 100644 index 0000000000..75da7d1972 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-5.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own data + property that overrides an inherited accessor property on an + Array-like object +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 0) { + return val === 5; + } else { + return true; + } +} + +var proto = {}; + +Object.defineProperty(proto, "0", { + get: function() { + return 5; + }, + configurable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child.length = 2; +Object.defineProperty(child, "0", { + value: 11, + configurable: true +}); +child[1] = 12; + +assert.sameValue(Array.prototype.every.call(child, callbackfn), false, 'Array.prototype.every.call(child, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-6.js new file mode 100644 index 0000000000..b5a7668a9c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-6.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own data + property that overrides an inherited accessor property on an Array +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return val === 11; +} + +Object.defineProperty(Array.prototype, "0", { + get: function() { + return 9; + }, + configurable: true +}); + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-7.js new file mode 100644 index 0000000000..9b94b838a1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-7.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is inherited data + property on an Array-like object +---*/ + +var kValue = 'abc'; + +function callbackfn(val, idx, obj) { + if (idx === 5) { + return val !== kValue; + } else { + return true; + } +} + +var proto = { + 5: kValue +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child.length = 10; + +assert.sameValue(Array.prototype.every.call(child, callbackfn), false, 'Array.prototype.every.call(child, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-8.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-8.js new file mode 100644 index 0000000000..d3acaa169d --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-8.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is inherited data + property on an Array +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 1) { + return val !== 13; + } else { + return true; + } +} + +Array.prototype[1] = 13; + +assert.sameValue([, , , ].every(callbackfn), false, '[, , , ].every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-9.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-9.js new file mode 100644 index 0000000000..5676f4d329 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-i-9.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. 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 - element to be retrieved is own accessor + property on an Array-like object +---*/ + +function callbackfn(val, idx, obj) { + if (idx === 0) { + return val !== 11; + } else { + return true; + } +} + +var obj = { + 10: 10, + length: 20 +}; + +Object.defineProperty(obj, "0", { + get: function() { + return 11; + }, + configurable: true +}); + + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-1.js new file mode 100644 index 0000000000..cafd32233c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-1.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn called with correct parameters +---*/ + +function callbackfn(val, Idx, obj) +{ + if (obj[Idx] === val) + return true; +} + +var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + + +assert.sameValue(arr.every(callbackfn), true, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-10.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-10.js new file mode 100644 index 0000000000..8e70a78688 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-10.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn is called with 1 formal + parameter +---*/ + +var called = 0; + +function callbackfn(val) { + called++; + return val > 10; +} + +assert([11, 12].every(callbackfn), '[11, 12].every(callbackfn) !== true'); +assert.sameValue(called, 2, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-11.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-11.js new file mode 100644 index 0000000000..8f62a39f46 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-11.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn is called with 2 formal + parameter +---*/ + +var called = 0; + +function callbackfn(val, idx) { + called++; + return val > 10 && arguments[2][idx] === val; +} + +assert([11, 12].every(callbackfn), '[11, 12].every(callbackfn) !== true'); +assert.sameValue(called, 2, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-12.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-12.js new file mode 100644 index 0000000000..41a1faeb43 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-12.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn is called with 3 formal + parameter +---*/ + +var called = 0; + +function callbackfn(val, idx, obj) { + called++; + return val > 10 && obj[idx] === val; +} + +assert([11, 12, 13].every(callbackfn), '[11, 12, 13].every(callbackfn) !== true'); +assert.sameValue(called, 3, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-13.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-13.js new file mode 100644 index 0000000000..1744fed957 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-13.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn that uses arguments object to + get parameter value +---*/ + +var called = 0; + +function callbackfn() { + called++; + return arguments[2][arguments[1]] === arguments[0]; +} + +assert([11, 12].every(callbackfn), '[11, 12].every(callbackfn) !== true'); +assert.sameValue(called, 2, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-16.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-16.js new file mode 100644 index 0000000000..f3703a9d63 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-16.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 - 'this' of 'callbackfn' is a Boolean object + when T is not an object (T is a boolean primitive) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return this.valueOf() !== false; +} + +var obj = { + 0: 11, + length: 2 +}; + +assert.sameValue(Array.prototype.every.call(obj, callbackfn, false), false, 'Array.prototype.every.call(obj, callbackfn, false)'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-17.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-17.js new file mode 100644 index 0000000000..c802a549d1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-17.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 -'this' of 'callbackfn' is a Number object + when T is not an object (T is a number primitive) +---*/ + +var accessed = false; + +function callbackfn(val, idx, o) { + accessed = true; + return 5 === this.valueOf(); +} + +var obj = { + 0: 11, + length: 2 +}; + +assert(Array.prototype.every.call(obj, callbackfn, 5), 'Array.prototype.every.call(obj, callbackfn, 5) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-18.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-18.js new file mode 100644 index 0000000000..0efd97e77f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-18.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 - 'this' of 'callbackfn' is an String object + when T is not an object (T is a string primitive) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return 'hello' === this.valueOf(); +} + +var obj = { + 0: 11, + length: 2 +}; + +assert(Array.prototype.every.call(obj, callbackfn, "hello"), 'Array.prototype.every.call(obj, callbackfn, "hello") !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-19.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-19.js new file mode 100644 index 0000000000..074faed23a --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-19.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 - non-indexed properties are not called +---*/ + +var called = 0; + +function callbackfn(val, idx, obj) { + called++; + return val !== 8; +} + +var obj = { + 0: 11, + 10: 12, + non_index_property: 8, + length: 20 +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(called, 2, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-2.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-2.js new file mode 100644 index 0000000000..9ff21a0194 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-2.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn takes 3 arguments +---*/ + +function callbackfn(val, Idx, obj) +{ + if (arguments.length === 3) //verify if callbackfn was called with 3 parameters + return true; +} + +var arr = [0, 1, true, null, new Object(), "five"]; +arr[999999] = -6.6; + + +assert.sameValue(arr.every(callbackfn), true, 'arr.every(callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-20.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-20.js new file mode 100644 index 0000000000..31df2f4e2e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-20.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn called with correct parameters + (thisArg is correct) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return 10 === this.threshold; +} + +var thisArg = { + threshold: 10 +}; + +var obj = { + 0: 11, + length: 1 +}; + +assert(Array.prototype.every.call(obj, callbackfn, thisArg), 'Array.prototype.every.call(obj, callbackfn, thisArg) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-21.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-21.js new file mode 100644 index 0000000000..008fa8586c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-21.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn called with correct parameters + (kValue is correct) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + if (idx === 0) { + return val === 11; + } + + if (idx === 1) { + return val === 12; + } + +} + +var obj = { + 0: 11, + 1: 12, + length: 2 +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-22.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-22.js new file mode 100644 index 0000000000..70d72b873f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-22.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn called with correct parameters + (the index k is correct) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + if (val === 11) { + return idx === 0; + } + + if (val === 12) { + return idx === 1; + } + +} + +var obj = { + 0: 11, + 1: 12, + length: 2 +}; + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-23.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-23.js new file mode 100644 index 0000000000..ac38a0b929 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-23.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn called with correct parameters + (this object O is correct) +---*/ + +var called = 0; +var obj = { + 0: 11, + 1: 12, + length: 2 +}; + +function callbackfn(val, idx, o) { + called++; + return obj === o; +} + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert.sameValue(called, 2, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-3.js new file mode 100644 index 0000000000..a0f62215e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-3.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 immediately returns false if callbackfn + returns false +---*/ + +var callCnt = 0; + +function callbackfn(val, idx, obj) +{ + callCnt++; + if (idx > 5) + return false; + else + return true; +} + +var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + + +assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)'); +assert.sameValue(callCnt, 7, 'callCnt'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-4.js new file mode 100644 index 0000000000..6962bc7c4f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-4.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 - k values are passed in ascending numeric + order +---*/ + +var arr = [0, 1, 2, 3, 4, 5]; +var lastIdx = 0; +var called = 0; + +function callbackfn(val, idx, o) { + called++; + if (lastIdx !== idx) { + return false; + } else { + lastIdx++; + return true; + } +} + +assert(arr.every(callbackfn), 'arr.every(callbackfn) !== true'); +assert.sameValue(arr.length, called, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-5.js new file mode 100644 index 0000000000..655134d01a --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-5.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. 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 - k values are accessed during each + iteration and not prior to starting the loop on an Array +---*/ + +var called = 0; +var kIndex = []; + +//By below way, we could verify that k would be setted as 0, 1, ..., length - 1 in order, and each value will be setted one time. +function callbackfn(val, idx, obj) { + called++; + //Each position should be visited one time, which means k is accessed one time during iterations. + if (typeof kIndex[idx] === "undefined") { + //when current position is visited, its previous index should has been visited. + if (idx !== 0 && typeof kIndex[idx - 1] === "undefined") { + return false; + } + kIndex[idx] = 1; + return true; + } else { + return false; + } +} + +assert([11, 12, 13, 14].every(callbackfn, undefined), '[11, 12, 13, 14].every(callbackfn, undefined) !== true'); +assert.sameValue(called, 4, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-6.js new file mode 100644 index 0000000000..16eba872ab --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-6.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. 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 - arguments to callbackfn are self consistent +---*/ + +var accessed = false; +var thisArg = {}; +var obj = { + 0: 11, + length: 1 +}; + +function callbackfn() { + accessed = true; + return this === thisArg && + arguments[0] === 11 && + arguments[1] === 0 && + arguments[2] === obj; +} + +assert(Array.prototype.every.call(obj, callbackfn, thisArg), 'Array.prototype.every.call(obj, callbackfn, thisArg) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-7.js new file mode 100644 index 0000000000..7f6039c2f4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-7.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. 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 - unhandled exceptions happened in + callbackfn terminate iteration +---*/ + +var called = 0; + +function callbackfn(val, idx, obj) { + called++; + if (called === 1) { + throw new Test262Error("Exception occurred in callbackfn"); + } + return true; +} + +var obj = { + 0: 11, + 4: 10, + 10: 8, + length: 20 +}; + +assert.throws(Test262Error, function() { + Array.prototype.every.call(obj, callbackfn); +}); + +assert.sameValue(called, 1, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-8.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-8.js new file mode 100644 index 0000000000..3ca6cfa324 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-8.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. 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 - element changed by callbackfn on previous + iterations is observed +---*/ + +var obj = { + 0: 11, + 1: 12, + length: 2 +}; + +function callbackfn(val, idx, o) { + if (idx === 0) { + obj[idx + 1] = 8; + } + return val > 10; +} + + + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-9.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-9.js new file mode 100644 index 0000000000..e3f1679c60 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-9.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - callbackfn is called with 0 formal + parameter +---*/ + +var called = 0; + +function callbackfn() { + called++; + return true; +} + +assert([11, 12].every(callbackfn), '[11, 12].every(callbackfn) !== true'); +assert.sameValue(called, 2, 'called'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-1.js new file mode 100644 index 0000000000..822414b772 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-1.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is undefined +---*/ + +var accessed = false; +var obj = { + 0: 11, + length: 1 +}; + +function callbackfn(val, idx, o) { + accessed = true; + return undefined; +} + + + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-10.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-10.js new file mode 100644 index 0000000000..ddba79131b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-10.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a number + (value is Infinity) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return Infinity; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-11.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-11.js new file mode 100644 index 0000000000..4e0da36fe9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-11.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a number + (value is -Infinity) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return -Infinity; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-12.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-12.js new file mode 100644 index 0000000000..3849133131 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-12.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a number + (value is NaN) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return NaN; +} + +assert.sameValue([11].every(callbackfn), false, '[11].every(callbackfn)'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-13.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-13.js new file mode 100644 index 0000000000..3edcf5499d --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-13.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is an empty + string +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return ""; +} + +assert.sameValue([11].every(callbackfn), false, '[11].every(callbackfn)'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-14.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-14.js new file mode 100644 index 0000000000..52a5f92bab --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-14.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a non-empty + string +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return "non-empty string"; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-15.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-15.js new file mode 100644 index 0000000000..88c930c3bd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-15.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a Function + object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return function() {}; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-16.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-16.js new file mode 100644 index 0000000000..94f14a52e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-16.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is an Array + object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return []; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-17.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-17.js new file mode 100644 index 0000000000..09bfc4a0f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-17.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a String + object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return new String(); +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-18.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-18.js new file mode 100644 index 0000000000..5de172c4c0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-18.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a Boolean + object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return new Boolean(); +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-19.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-19.js new file mode 100644 index 0000000000..a53fff8bc0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-19.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a Number + object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return new Number(); +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-2.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-2.js new file mode 100644 index 0000000000..be850ac536 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-2.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is null +---*/ + +var accessed = false; +var obj = { + 0: 11, + length: 1 +}; + +function callbackfn(val, idx, obj) { + accessed = true; + return null; +} + + + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-20.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-20.js new file mode 100644 index 0000000000..5f20d29720 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-20.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is the Math + object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return Math; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-21.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-21.js new file mode 100644 index 0000000000..6ce6fa52ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-21.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a Date object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return new Date(); +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-22.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-22.js new file mode 100644 index 0000000000..3fd482cc75 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-22.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a RegExp + object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return new RegExp(); +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-23.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-23.js new file mode 100644 index 0000000000..d18cf83cff --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-23.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is the JSON + object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return JSON; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-24.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-24.js new file mode 100644 index 0000000000..58cad1d777 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-24.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is an Error + object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return new EvalError(); +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-25.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-25.js new file mode 100644 index 0000000000..05680e0df5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-25.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is the + Arguments object +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return arguments; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-27.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-27.js new file mode 100644 index 0000000000..3985d330dd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-27.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is the global + object +---*/ + +var global = this; +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return global; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-28.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-28.js new file mode 100644 index 0000000000..f4fde7c5c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-28.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. 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 - false prevents further side effects +---*/ + +var result = false; +var obj = { + length: 20 +}; + +function callbackfn(val, idx, obj) { + if (idx > 1) { + result = true; + } + return val > 10; +} + +Object.defineProperty(obj, "0", { + get: function() { + return 11; + }, + configurable: true +}); + +Object.defineProperty(obj, "1", { + get: function() { + return 8; + }, + configurable: true +}); + +Object.defineProperty(obj, "2", { + get: function() { + result = true; + return 8; + }, + configurable: true +}); + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); +assert.sameValue(result, false, 'result'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-29.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-29.js new file mode 100644 index 0000000000..77a3b0894f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-29.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value (new Boolean(false)) of + callbackfn is treated as true value +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return new Boolean(false); +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-3.js new file mode 100644 index 0000000000..0a7c070b47 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-3.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a boolean + (value is false) +---*/ + +var accessed = false; +var obj = { + 0: 11, + length: 1 +}; + +function callbackfn(val, idx, obj) { + accessed = true; + return false; +} + +assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-4.js new file mode 100644 index 0000000000..8d090b844c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-4.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a boolean + (value is true) +---*/ + +var accessed = false; +var obj = { + 0: 11, + length: 1 +}; + +function callbackfn(val, idx, obj) { + accessed = true; + return true; +} + + + +assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-5.js new file mode 100644 index 0000000000..1560afa6e0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-5.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a number + (value is 0) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return 0; +} + +assert.sameValue([11].every(callbackfn), false, '[11].every(callbackfn)'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-6.js new file mode 100644 index 0000000000..23eeb249b3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-6.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a number + (value is +0) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return +0; +} + +assert.sameValue([11].every(callbackfn), false, '[11].every(callbackfn)'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-7.js new file mode 100644 index 0000000000..1dbb74c91b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-7.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a nunmber + (value is -0) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return -0; +} + +assert.sameValue([11].every(callbackfn), false, '[11].every(callbackfn)'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-8.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-8.js new file mode 100644 index 0000000000..9998803a04 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-8.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a number + (value is positive number) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return 5; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-9.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-9.js new file mode 100644 index 0000000000..45731e95a5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-7-c-iii-9.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. 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 - return value of callbackfn is a number + (value is negative number) +---*/ + +var accessed = false; + +function callbackfn(val, idx, obj) { + accessed = true; + return -5; +} + +assert([11].every(callbackfn), '[11].every(callbackfn) !== true'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-1.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-1.js new file mode 100644 index 0000000000..e21788de75 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-1.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. 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 returns true if 'length' is 0 (empty array) +---*/ + +function cb() {} +var i = [].every(cb); + +assert.sameValue(i, true, 'i'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-10.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-10.js new file mode 100644 index 0000000000..8be8730c95 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-10.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. 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 - subclassed array when length is reduced +---*/ + +foo.prototype = new Array(1, 2, 3); + +function foo() {} +var f = new foo(); +f.length = 2; + +function cb(val) +{ + if (val > 2) + return false; + else + return true; +} +var i = f.every(cb); + + +assert.sameValue(i, true, 'i'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-11.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-11.js new file mode 100644 index 0000000000..0ffed8116e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-11.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 returns true when all calls to callbackfn + return true +---*/ + +var callCnt = 0; + +function callbackfn(val, idx, obj) +{ + callCnt++; + return true; +} + +var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + + +assert.sameValue(arr.every(callbackfn), true, 'arr.every(callbackfn)'); +assert.sameValue(callCnt, 10, 'callCnt'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-12.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-12.js new file mode 100644 index 0000000000..f26076a8a5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-12.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. 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 doesn't mutate the array on which it is + called on +---*/ + +function callbackfn(val, idx, obj) +{ + return true; +} +var arr = [1, 2, 3, 4, 5]; +arr.every(callbackfn); + +assert.sameValue(arr[0], 1, 'arr[0]'); +assert.sameValue(arr[1], 2, 'arr[1]'); +assert.sameValue(arr[2], 3, 'arr[2]'); +assert.sameValue(arr[3], 4, 'arr[3]'); +assert.sameValue(arr[4], 5, 'arr[4]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-13.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-13.js new file mode 100644 index 0000000000..73ddb2f547 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-13.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. 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 doesn't visit expandos +---*/ + +var callCnt = 0; + +function callbackfn(val, idx, obj) +{ + callCnt++; + return true; +} + +var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; +arr["i"] = 10; +arr[true] = 11; + + +assert.sameValue(arr.every(callbackfn), true, 'arr.every(callbackfn)'); +assert.sameValue(callCnt, 10, 'callCnt'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-2.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-2.js new file mode 100644 index 0000000000..cfceada732 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-2.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. 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 returns true if 'length' is 0 (subclassed + Array, length overridden to null (type conversion)) +---*/ + +foo.prototype = new Array(1, 2, 3); + +function foo() {} +var f = new foo(); +f.length = null; + +function cb() {} +var i = f.every(cb); + + +assert.sameValue(i, true, 'i'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-3.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-3.js new file mode 100644 index 0000000000..0848d2a83c --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-3.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. 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 returns true if 'length' is 0 (subclassed + Array, length overridden to false (type conversion)) +---*/ + +foo.prototype = new Array(1, 2, 3); + +function foo() {} +var f = new foo(); +f.length = false; + +function cb() {} +var i = f.every(cb); + + +assert.sameValue(i, true, 'i'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-4.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-4.js new file mode 100644 index 0000000000..9e4d263ae7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-4.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. 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 returns true if 'length' is 0 (subclassed + Array, length overridden to 0 (type conversion)) +---*/ + +foo.prototype = new Array(1, 2, 3); + +function foo() {} +var f = new foo(); +f.length = 0; + +function cb() {} +var i = f.every(cb); + + +assert.sameValue(i, true, 'i'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-5.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-5.js new file mode 100644 index 0000000000..df0ff6b2d4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-5.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. 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 returns true if 'length' is 0 (subclassed + Array, length overridden to '0' (type conversion)) +---*/ + +foo.prototype = new Array(1, 2, 3); + +function foo() {} +var f = new foo(); +f.length = '0'; + +function cb() {} +var i = f.every(cb); + + +assert.sameValue(i, true, 'i'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-6.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-6.js new file mode 100644 index 0000000000..2424224c4d --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-6.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. 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 returns true if 'length' is 0 (subclassed + Array, length overridden with obj with valueOf) +---*/ + +foo.prototype = new Array(1, 2, 3); + +function foo() {} +var f = new foo(); + +var o = { + valueOf: function() { + return 0; + } +}; +f.length = o; + +function cb() {} +var i = f.every(cb); + + +assert.sameValue(i, true, 'i'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-7.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-7.js new file mode 100644 index 0000000000..72a6dc4569 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-7.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. 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 returns true if 'length' is 0 (subclassed + Array, length overridden with obj w/o valueOf (toString)) +---*/ + +foo.prototype = new Array(1, 2, 3); + +function foo() {} +var f = new foo(); + +var o = { + toString: function() { + return '0'; + } +}; +f.length = o; + +// objects inherit the default valueOf method of the Object object; +// that simply returns the itself. Since the default valueOf() method +// does not return a primitive value, ES next tries to convert the object +// to a number by calling its toString() method and converting the +// resulting string to a number. +function cb() {} +var i = f.every(cb); + + +assert.sameValue(i, true, 'i'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-8.js b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-8.js new file mode 100644 index 0000000000..c888904a33 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/15.4.4.16-8-8.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. 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 returns true if 'length' is 0 (subclassed + Array, length overridden with [] +---*/ + +foo.prototype = new Array(1, 2, 3); + +function foo() {} +var f = new foo(); + +f.length = []; + +// objects inherit the default valueOf method of the Object object; +// that simply returns the itself. Since the default valueOf() method +// does not return a primitive value, ES next tries to convert the object +// to a number by calling its toString() method and converting the +// resulting string to a number. +// +// The toString( ) method on Array converts the array elements to strings, +// then returns the result of concatenating these strings, with commas in +// between. An array with no elements converts to the empty string, which +// converts to the number 0. If an array has a single element that is a +// number n, the array converts to a string representation of n, which is +// then converted back to n itself. If an array contains more than one element, +// or if its one element is not a number, the array converts to NaN. + +function cb() {} +var i = f.every(cb); + + +assert.sameValue(i, true, 'i'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/browser.js b/js/src/tests/test262/built-ins/Array/prototype/every/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/call-with-boolean.js b/js/src/tests/test262/built-ins/Array/prototype/every/call-with-boolean.js new file mode 100644 index 0000000000..76e4bab1a7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/call-with-boolean.js @@ -0,0 +1,20 @@ +// 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' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/callbackfn-resize-arraybuffer.js b/js/src/tests/test262/built-ins/Array/prototype/every/callbackfn-resize-arraybuffer.js new file mode 100644 index 0000000000..a1a4ee5456 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/callbackfn-resize-arraybuffer.js @@ -0,0 +1,74 @@ +// |reftest| shell-option(--enable-arraybuffer-resizable) skip-if(!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- resizable-arraybuffer is not enabled unconditionally, requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-array.prototype.every +description: TypedArray instance buffer can be resized during iteration +includes: [testTypedArray.js, compareArray.js] +features: [TypedArray, resizable-arraybuffer] +---*/ + +// If the host chooses to throw as allowed by the specification, the observed +// behavior will be identical to the case where `ArrayBuffer.prototype.resize` +// has not been implemented. The following assertion prevents this test from +// passing in runtimes which have not implemented the method. +assert.sameValue(typeof ArrayBuffer.prototype.resize, 'function'); + +testWithTypedArrayConstructors(function(TA) { + var BPE = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(BPE * 3, {maxByteLength: BPE * 4}); + var sample = new TA(buffer); + var expectedElements, expectedIndices, expectedArrays; + var elements, indices, arrays, result; + + elements = []; + indices = []; + arrays = []; + result = Array.prototype.every.call(sample, function(element, index, array) { + if (elements.length === 0) { + try { + buffer.resize(2 * BPE); + expectedElements = [0, 0]; + expectedIndices = [0, 1]; + expectedArrays = [sample, sample]; + } catch (_) { + expectedElements = [0, 0, 0]; + expectedIndices = [0, 1, 2]; + expectedArrays = [sample, sample, sample]; + } + } + + elements.push(element); + indices.push(index); + arrays.push(array); + return true; + }); + + assert.compareArray(elements, expectedElements, 'elements (shrink)'); + assert.compareArray(indices, expectedIndices, 'indices (shrink)'); + assert.compareArray(arrays, expectedArrays, 'arrays (shrink)'); + assert.sameValue(result, true, 'result (shrink)'); + + elements = []; + indices = []; + arrays = []; + result = Array.prototype.every.call(sample, function(element, index, array) { + if (elements.length === 0) { + try { + buffer.resize(4 * BPE); + } catch (_) {} + } + + elements.push(element); + indices.push(index); + arrays.push(array); + return true; + }); + + assert.compareArray(elements, expectedElements, 'elements (grow)'); + assert.compareArray(indices, expectedIndices, 'indices (grow)'); + assert.compareArray(arrays, expectedArrays, 'arrays (grow)'); + assert.sameValue(result, true, 'result (grow)'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/length.js b/js/src/tests/test262/built-ins/Array/prototype/every/length.js new file mode 100644 index 0000000000..65015d9799 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/length.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Copyright (C) 2017 Corey Frang. 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.length value and property descriptor +info: | + Array.prototype.every ( callbackfn [ , thisArg] ) + The length property of the of function is 1. +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + Array.prototype.every.length, 1, + 'The value of `Array.prototype.every.length` is `1`' +); + +verifyNotEnumerable(Array.prototype.every, 'length'); +verifyNotWritable(Array.prototype.every, 'length'); +verifyConfigurable(Array.prototype.every, 'length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/name.js b/js/src/tests/test262/built-ins/Array/prototype/every/name.js new file mode 100644 index 0000000000..5bb10976b6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. 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.name is "every". +info: | + Array.prototype.every ( callbackfn [ , thisArg] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Array.prototype.every.name, "every"); + +verifyNotEnumerable(Array.prototype.every, "name"); +verifyNotWritable(Array.prototype.every, "name"); +verifyConfigurable(Array.prototype.every, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/not-a-constructor.js b/js/src/tests/test262/built-ins/Array/prototype/every/not-a-constructor.js new file mode 100644 index 0000000000..54dee55e8b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/not-a-constructor.js @@ -0,0 +1,35 @@ +// 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: > + Array.prototype.every 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, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Array.prototype.every), + false, + 'isConstructor(Array.prototype.every) must return false' +); + +assert.throws(TypeError, () => { + new Array.prototype.every(() => {}); +}, '`new Array.prototype.every(() => {})` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/prop-desc.js b/js/src/tests/test262/built-ins/Array/prototype/every/prop-desc.js new file mode 100644 index 0000000000..1bc9174eef --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/prop-desc.js @@ -0,0 +1,23 @@ +// Copyright (C) 2017 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.every +description: > + "every" property of Array.prototype +info: | + 17 ECMAScript Standard Built-in Objects + + Every other data property described in clauses 18 through 26 and in Annex B.2 + has the attributes { [[Writable]]: true, [[Enumerable]]: false, + [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(typeof Array.prototype.every, 'function', 'typeof'); + +verifyNotEnumerable(Array.prototype, "every"); +verifyWritable(Array.prototype, "every"); +verifyConfigurable(Array.prototype, "every"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/prototype/every/shell.js b/js/src/tests/test262/built-ins/Array/prototype/every/shell.js new file mode 100644 index 0000000000..05fecd6ef1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/every/shell.js @@ -0,0 +1,161 @@ +// GENERATED, DO NOT EDIT +// file: testTypedArray.js +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + Collection of functions used to assert the correctness of TypedArray objects. +defines: + - floatArrayConstructors + - nonClampedIntArrayConstructors + - intArrayConstructors + - typedArrayConstructors + - TypedArray + - testWithTypedArrayConstructors + - nonAtomicsFriendlyTypedArrayConstructors + - testWithAtomicsFriendlyTypedArrayConstructors + - testWithNonAtomicsFriendlyTypedArrayConstructors + - testTypedArrayConversions +---*/ + +var floatArrayConstructors = [ + Float64Array, + Float32Array +]; + +var nonClampedIntArrayConstructors = [ + Int32Array, + Int16Array, + Int8Array, + Uint32Array, + Uint16Array, + Uint8Array +]; + +var intArrayConstructors = nonClampedIntArrayConstructors.concat([Uint8ClampedArray]); + +// Float16Array is a newer feature +// adding it to this list unconditionally would cause implementations lacking it to fail every test which uses it +if (typeof Float16Array !== 'undefined') { + floatArrayConstructors.push(Float16Array); +} + +/** + * Array containing every non-bigint typed array constructor. + */ + +var typedArrayConstructors = floatArrayConstructors.concat(intArrayConstructors); + +/** + * The %TypedArray% intrinsic constructor function. + */ +var TypedArray = Object.getPrototypeOf(Int8Array); + +/** + * Callback for testing a typed array constructor. + * + * @callback typedArrayConstructorCallback + * @param {Function} Constructor the constructor object to test with. + */ + +/** + * Calls the provided function for every typed array constructor. + * + * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor. + * @param {Array} selected - An optional Array with filtered typed arrays + */ +function testWithTypedArrayConstructors(f, selected) { + var constructors = selected || typedArrayConstructors; + for (var i = 0; i < constructors.length; ++i) { + var constructor = constructors[i]; + try { + f(constructor); + } catch (e) { + e.message += " (Testing with " + constructor.name + ".)"; + throw e; + } + } +} + +var nonAtomicsFriendlyTypedArrayConstructors = floatArrayConstructors.concat([Uint8ClampedArray]); +/** + * Calls the provided function for every non-"Atomics Friendly" typed array constructor. + * + * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor. + * @param {Array} selected - An optional Array with filtered typed arrays + */ +function testWithNonAtomicsFriendlyTypedArrayConstructors(f) { + testWithTypedArrayConstructors(f, nonAtomicsFriendlyTypedArrayConstructors); +} + +/** + * Calls the provided function for every "Atomics Friendly" typed array constructor. + * + * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor. + * @param {Array} selected - An optional Array with filtered typed arrays + */ +function testWithAtomicsFriendlyTypedArrayConstructors(f) { + testWithTypedArrayConstructors(f, [ + Int32Array, + Int16Array, + Int8Array, + Uint32Array, + Uint16Array, + Uint8Array, + ]); +} + +/** + * Helper for conversion operations on TypedArrays, the expected values + * properties are indexed in order to match the respective value for each + * TypedArray constructor + * @param {Function} fn - the function to call for each constructor and value. + * will be called with the constructor, value, expected + * value, and a initial value that can be used to avoid + * a false positive with an equivalent expected value. + */ +function testTypedArrayConversions(byteConversionValues, fn) { + var values = byteConversionValues.values; + var expected = byteConversionValues.expected; + + testWithTypedArrayConstructors(function(TA) { + var name = TA.name.slice(0, -5); + + return values.forEach(function(value, index) { + var exp = expected[name][index]; + var initial = 0; + if (exp === 0) { + initial = 1; + } + fn(TA, value, exp, initial); + }); + }); +} + +/** + * Checks if the given argument is one of the float-based TypedArray constructors. + * + * @param {constructor} ctor - the value to check + * @returns {boolean} + */ +function isFloatTypedArrayConstructor(arg) { + return floatArrayConstructors.indexOf(arg) !== -1; +} + +/** + * Determines the precision of the given float-based TypedArray constructor. + * + * @param {constructor} ctor - the value to check + * @returns {string} "half", "single", or "double" for Float16Array, Float32Array, and Float64Array respectively. + */ +function floatTypedArrayConstructorPrecision(FA) { + if (typeof Float16Array !== "undefined" && FA === Float16Array) { + return "half"; + } else if (FA === Float32Array) { + return "single"; + } else if (FA === Float64Array) { + return "double"; + } else { + throw new Error("Malformed test - floatTypedArrayConstructorPrecision called with non-float TypedArray"); + } +} -- cgit v1.2.3