зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1763609) for causing SM bustages.
Backed out changeset 23f5e75f33bd (bug 1763609) Backed out changeset 6cd80539b341 (bug 1763609) Backed out changeset 9a03b4c954f1 (bug 1763609) Backed out changeset c4ce7383ae07 (bug 1763609)
This commit is contained in:
Родитель
09af1e78c9
Коммит
faaa6997b3
|
@ -606,34 +606,6 @@ fails-if(!xulRuntime.shell) script test262/language/statements/class/subclass-bu
|
|||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1648202
|
||||
skip script test262/built-ins/RegExp/named-groups/non-unicode-property-names-valid.js
|
||||
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1761989
|
||||
skip script test262/built-ins/TypedArrayConstructors/ctors/no-species.js
|
||||
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1763605
|
||||
skip script test262/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-no-throw.js
|
||||
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1763606
|
||||
skip script test262/built-ins/TypedArray/prototype/sort/sort-tonumber.js
|
||||
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1763607
|
||||
skip script test262/intl402/NumberFormat/constructor-roundingIncrement-invalid.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-priority-less-precision.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-500.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-50.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-5.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-20.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-250.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-25.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-5000.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-10.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-200.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-2000.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-100.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-2500.js
|
||||
skip script test262/intl402/NumberFormat/prototype/format/format-rounding-increment-1000.js
|
||||
skip script test262/intl402/PluralRules/prototype/selectRange/nan-arguments-throws.js
|
||||
skip script test262/intl402/PluralRules/prototype/selectRange/undefined-arguments-throws.js
|
||||
|
||||
|
||||
###########################################################
|
||||
# Tests disabled due to issues in test262 importer script #
|
||||
|
@ -665,6 +637,113 @@ skip script test262/language/module-code/top-level-await/await-dynamic-import-re
|
|||
# https://github.com/tc39/ecma402/issues/402
|
||||
skip script test262/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle-default.js
|
||||
|
||||
# https://github.com/tc39/test262/issues/3139
|
||||
skip script test262/intl402/DisplayNames/prototype/of/type-calendar-valid.js
|
||||
|
||||
# Tests not yet updated for https://github.com/tc39/proposal-intl-numberformat-v3
|
||||
skip script test262/intl402/NumberFormat/prototype/resolvedOptions/order.js
|
||||
skip script test262/intl402/NumberFormat/test-option-useGrouping.js
|
||||
skip script test262/intl402/NumberFormat/prototype/resolvedOptions/basic.js
|
||||
skip script test262/intl402/PluralRules/prototype/resolvedOptions/order.js
|
||||
|
||||
# https://github.com/tc39/test262/pull/3199
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Mark.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Arabic.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Currency_Symbol.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Letter.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Balinese.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Dash.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Kannada.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Cased.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Changes_When_Casefolded.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Changes_When_Titlecased.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Emoji_Modifier_Base.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Diacritic.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Han.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Kannada.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Modifier_Symbol.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Telugu.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Ethiopic.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Katakana.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Canadian_Aboriginal.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Takri.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Unassigned.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Kaithi.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/ID_Continue.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Terminal_Punctuation.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Ideographic.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Katakana.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Balinese.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Changes_When_Lowercased.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Bidi_Mirrored.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Lowercase.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Cased_Letter.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Alphabetic.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Other_Symbol.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Spacing_Mark.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Format.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Symbol.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Inherited.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Grapheme_Base.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Uppercase_Letter.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Kaithi.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Adlam.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Canadian_Aboriginal.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Brahmi.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Assigned.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Variation_Selector.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Ahom.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Soft_Dotted.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Ethiopic.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Uppercase.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Default_Ignorable_Code_Point.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Decimal_Number.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Modifier_Letter.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Sentence_Terminal.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Dash_Punctuation.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Ahom.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Nko.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/XID_Continue.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Hiragana.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Arabic.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Extender.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Grapheme_Extend.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Unified_Ideograph.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Common.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Number.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Emoji_Presentation.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Mongolian.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Changes_When_Casemapped.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Close_Punctuation.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/ID_Start.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Latin.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Takri.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Other_Punctuation.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Common.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Glagolitic.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Brahmi.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Changes_When_Uppercased.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Emoji.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Telugu.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Glagolitic.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Open_Punctuation.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Han.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Lowercase_Letter.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Mongolian.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Nonspacing_Mark.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/XID_Start.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Other_Letter.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Inherited.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Tagalog.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Punctuation.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Hiragana.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Syriac.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_-_Latin.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tagalog.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Case_Ignorable.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/General_Category_-_Other.js
|
||||
skip script test262/built-ins/RegExp/property-escapes/generated/Changes_When_NFKC_Casefolded.js
|
||||
|
||||
|
||||
##############################################
|
||||
# Enable Iterator Helpers tests in the shell #
|
||||
|
|
|
@ -25,16 +25,13 @@ UNSUPPORTED_FEATURES = set(
|
|||
"Intl.DateTimeFormat-quarter",
|
||||
"Intl.Segmenter",
|
||||
"Intl.Locale-info",
|
||||
"Intl.DurationFormat",
|
||||
"Atomics.waitAsync",
|
||||
"legacy-regexp",
|
||||
"json-modules",
|
||||
"resizable-arraybuffer",
|
||||
"Temporal",
|
||||
"ShadowRealm",
|
||||
"callable-boundary-realms",
|
||||
"array-find-from-last",
|
||||
"array-grouping",
|
||||
"regexp-v-flag",
|
||||
]
|
||||
)
|
||||
FEATURE_CHECK_NEEDED = {
|
||||
|
@ -43,11 +40,7 @@ FEATURE_CHECK_NEEDED = {
|
|||
"SharedArrayBuffer": "!this.hasOwnProperty('SharedArrayBuffer')",
|
||||
"WeakRef": "!this.hasOwnProperty('WeakRef')",
|
||||
}
|
||||
RELEASE_OR_BETA = set(
|
||||
[
|
||||
"Intl.NumberFormat-v3",
|
||||
]
|
||||
)
|
||||
RELEASE_OR_BETA = set([])
|
||||
SHELL_OPTIONS = {
|
||||
"import-assertions": "--enable-import-assertions",
|
||||
}
|
||||
|
@ -859,7 +852,7 @@ if __name__ == "__main__":
|
|||
parser = argparse.ArgumentParser(description="Update the test262 test suite.")
|
||||
parser.add_argument(
|
||||
"--url",
|
||||
default="https://github.com/tc39/test262.git",
|
||||
default="git://github.com/tc39/test262.git",
|
||||
help="URL to git repository (default: %(default)s)",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
commit d7c0a2076c2b0c1531aef7069d4abe70eec44ee3
|
||||
Author: Shu-yu Guo <syg@chromium.org>
|
||||
Date: Mon Apr 4 16:36:56 2022 -0700
|
||||
commit 45a913c057892bdd26f7bc06a59a0c7420f2d3ec
|
||||
Author: Philip Chimento <pchimento@igalia.com>
|
||||
Date: Wed Aug 11 12:31:23 2021 -0700
|
||||
|
||||
Remove check for per-comparator call detach check in TypedArray.prototype.sort
|
||||
Add branding tests from Temporal (#3138)
|
||||
|
||||
This updates tests in line with the normative change in
|
||||
https://github.com/tc39/ecma262/pull/2723
|
||||
Closes: #3137
|
||||
|
||||
Co-authored-by: Ms2ger <Ms2ger@igalia.com>
|
||||
|
|
|
@ -21,7 +21,7 @@ assert.throws(
|
|||
);
|
||||
|
||||
assert.throws(
|
||||
other.TypeError,
|
||||
TypeError,
|
||||
function () {
|
||||
other.RegExp.prototype.compile.call(regexp);
|
||||
},
|
||||
|
|
|
@ -12,6 +12,7 @@ description: >
|
|||
this property
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype.myproperty = 42;
|
||||
var x = Array();
|
||||
assert.sameValue(x.myproperty, 42, 'The value of x.myproperty is expected to be 42');
|
||||
|
|
|
@ -10,10 +10,12 @@ es5id: 15.4.1_A1.1_T2
|
|||
description: Array.prototype.toString = Object.prototype.toString
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype.toString = Object.prototype.toString;
|
||||
var x = Array();
|
||||
assert.sameValue(x.toString(), "[object Array]", 'x.toString() must return "[object Array]"');
|
||||
|
||||
//CHECK#2
|
||||
Array.prototype.toString = Object.prototype.toString;
|
||||
var x = Array(0, 1, 2);
|
||||
assert.sameValue(x.toString(), "[object Array]", 'x.toString() must return "[object Array]"');
|
||||
|
|
|
@ -7,10 +7,12 @@ es5id: 15.4.1_A1.2_T1
|
|||
description: Checking use Object.prototype.toString
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = Array();
|
||||
x.getClass = Object.prototype.toString;
|
||||
assert.sameValue(x.getClass(), "[object Array]", 'x.getClass() must return "[object Array]"');
|
||||
|
||||
//CHECK#2
|
||||
var x = Array(0, 1, 2);
|
||||
x.getClass = Object.prototype.toString;
|
||||
assert.sameValue(x.getClass(), "[object Array]", 'x.getClass() must return "[object Array]"');
|
||||
|
|
|
@ -12,6 +12,7 @@ es5id: 15.4.1_A2.2_T1
|
|||
description: Checking correct work this algorithm
|
||||
---*/
|
||||
|
||||
//CHECK#
|
||||
var x = Array(
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
|
|
|
@ -12,6 +12,7 @@ description: >
|
|||
this property
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype.myproperty = 1;
|
||||
var x = new Array();
|
||||
assert.sameValue(x.myproperty, 1, 'The value of x.myproperty is expected to be 1');
|
||||
|
|
|
@ -10,10 +10,12 @@ es5id: 15.4.2.1_A1.1_T2
|
|||
description: Array.prototype.toString = Object.prototype.toString
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype.toString = Object.prototype.toString;
|
||||
var x = new Array();
|
||||
assert.sameValue(x.toString(), "[object Array]", 'x.toString() must return "[object Array]"');
|
||||
|
||||
//CHECK#2
|
||||
Array.prototype.toString = Object.prototype.toString;
|
||||
var x = new Array(0, 1, 2);
|
||||
assert.sameValue(x.toString(), "[object Array]", 'x.toString() must return "[object Array]"');
|
||||
|
|
|
@ -7,10 +7,12 @@ es5id: 15.4.2.1_A1.2_T1
|
|||
description: Checking use Object.prototype.toString
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array();
|
||||
x.getClass = Object.prototype.toString;
|
||||
assert.sameValue(x.getClass(), "[object Array]", 'x.getClass() must return "[object Array]"');
|
||||
|
||||
//CHECK#2
|
||||
var x = new Array(0, 1, 2);
|
||||
x.getClass = Object.prototype.toString;
|
||||
assert.sameValue(x.getClass(), "[object Array]", 'x.getClass() must return "[object Array]"');
|
||||
|
|
|
@ -12,6 +12,7 @@ es5id: 15.4.2.1_A2.2_T1
|
|||
description: Checking correct work this algorithm
|
||||
---*/
|
||||
|
||||
//CHECK#
|
||||
var x = new Array(
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
|
|
|
@ -9,6 +9,7 @@ es5id: 15.4.3_A1.1_T2
|
|||
description: Function.prototype.toString = Object.prototype.toString
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Function.prototype.toString = Object.prototype.toString;
|
||||
|
||||
assert.sameValue(
|
||||
|
|
|
@ -11,10 +11,12 @@ es5id: 15.4.5.1_A1.2_T2
|
|||
description: Checking an inherited property
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype[2] = -1;
|
||||
var x = [0, 1, 2];
|
||||
assert.sameValue(x[2], 2, 'The value of x[2] is expected to be 2');
|
||||
|
||||
//CHECK#2
|
||||
x.length = 2;
|
||||
assert.sameValue(x[2], -1, 'The value of x[2] is expected to be -1');
|
||||
|
||||
|
|
|
@ -9,16 +9,19 @@ es5id: 15.4.5.1_A2.1_T1
|
|||
description: P in [4294967295, -1, true]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x[4294967295] = 1;
|
||||
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
|
||||
assert.sameValue(x[4294967295], 1, 'The value of x[4294967295] is expected to be 1');
|
||||
|
||||
//CHECK#2
|
||||
x = [];
|
||||
x[-1] = 1;
|
||||
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
|
||||
assert.sameValue(x[-1], 1, 'The value of x[-1] is expected to be 1');
|
||||
|
||||
//CHECK#3
|
||||
x = [];
|
||||
x[true] = 1;
|
||||
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
|
||||
|
|
|
@ -9,13 +9,16 @@ es5id: 15.4.5.1_A2.2_T1
|
|||
description: length === 100, P in [0, 98, 99]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = Array(100);
|
||||
x[0] = 1;
|
||||
assert.sameValue(x.length, 100, 'The value of x.length is expected to be 100');
|
||||
|
||||
//CHECK#2
|
||||
x[98] = 1;
|
||||
assert.sameValue(x.length, 100, 'The value of x.length is expected to be 100');
|
||||
|
||||
//CHECK#3
|
||||
x[99] = 1;
|
||||
assert.sameValue(x.length, 100, 'The value of x.length is expected to be 100');
|
||||
|
||||
|
|
|
@ -9,10 +9,12 @@ es5id: 15.4.5.1_A2.3_T1
|
|||
description: length = 100, P in [100, 199]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = Array(100);
|
||||
x[100] = 1;
|
||||
assert.sameValue(x.length, 101, 'The value of x.length is expected to be 101');
|
||||
|
||||
//CHECK#2
|
||||
x[199] = 1;
|
||||
assert.sameValue(x.length, 200, 'The value of x.length is expected to be 200');
|
||||
|
||||
|
|
|
@ -10,18 +10,23 @@ es5id: 15.4.5.2_A1_T1
|
|||
description: Checking boundary points
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
|
||||
|
||||
//CHECK#2
|
||||
x[0] = 1;
|
||||
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
|
||||
|
||||
//CHECK#3
|
||||
x[1] = 1;
|
||||
assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
|
||||
|
||||
//CHECK#4
|
||||
x[2147483648] = 1;
|
||||
assert.sameValue(x.length, 2147483649, 'The value of x.length is expected to be 2147483649');
|
||||
|
||||
//CHECK#5
|
||||
x[4294967294] = 1;
|
||||
assert.sameValue(x.length, 4294967295, 'The value of x.length is expected to be 4294967295');
|
||||
|
||||
|
|
|
@ -10,10 +10,12 @@ es5id: 15.4.5.2_A1_T2
|
|||
description: P = "2^32 - 1" is not index array
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x[4294967295] = 1;
|
||||
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
|
||||
|
||||
//CHECK#2
|
||||
var y = [];
|
||||
y[1] = 1;
|
||||
y[4294967295] = 1;
|
||||
|
|
|
@ -9,15 +9,19 @@ es5id: 15.4.5.2_A2_T1
|
|||
description: Checking length property
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
|
||||
|
||||
//CHECK#2
|
||||
x[0] = 1;
|
||||
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
|
||||
|
||||
//CHECK#3
|
||||
x[1] = 1;
|
||||
assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
|
||||
|
||||
//CHECK#4
|
||||
x[9] = 1;
|
||||
assert.sameValue(x.length, 10, 'The value of x.length is expected to be 10');
|
||||
|
||||
|
|
|
@ -11,10 +11,12 @@ description: >
|
|||
is an array index
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x.length = 1;
|
||||
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
|
||||
|
||||
//CHECK#2
|
||||
x[5] = 1;
|
||||
x.length = 10;
|
||||
assert.sameValue(x.length, 10, 'The value of x.length is expected to be 10');
|
||||
|
|
|
@ -11,6 +11,7 @@ description: >
|
|||
is an array index
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x[1] = 1;
|
||||
x[3] = 3;
|
||||
|
@ -20,12 +21,15 @@ assert.sameValue(x.length, 4, 'The value of x.length is expected to be 4');
|
|||
assert.sameValue(x[5], undefined, 'The value of x[5] is expected to equal undefined');
|
||||
assert.sameValue(x[3], 3, 'The value of x[3] is expected to be 3');
|
||||
|
||||
//CHECK#4
|
||||
x.length = new Number(6);
|
||||
assert.sameValue(x[5], undefined, 'The value of x[5] is expected to equal undefined');
|
||||
|
||||
//CHECK#5
|
||||
x.length = 0;
|
||||
assert.sameValue(x[0], undefined, 'The value of x[0] is expected to equal undefined');
|
||||
|
||||
//CHECK#6
|
||||
x.length = 1;
|
||||
assert.sameValue(x[1], undefined, 'The value of x[1] is expected to equal undefined');
|
||||
|
||||
|
|
|
@ -9,10 +9,12 @@ es5id: 15.4.5.2_A3_T3
|
|||
description: "[[Put]] (length, 4294967296)"
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x.length = 4294967295;
|
||||
assert.sameValue(x.length, 4294967295, 'The value of x.length is expected to be 4294967295');
|
||||
|
||||
//CHECK#2
|
||||
try {
|
||||
x = [];
|
||||
x.length = 4294967296;
|
||||
|
|
|
@ -9,6 +9,7 @@ es5id: 15.4_A1.1_T10
|
|||
description: Array index is power of two
|
||||
---*/
|
||||
|
||||
//CHECK#
|
||||
var x = [];
|
||||
var k = 1;
|
||||
for (var i = 0; i < 32; i++) {
|
||||
|
|
|
@ -9,10 +9,12 @@ es5id: 15.4_A1.1_T4
|
|||
description: Checking for string primitive
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x["0"] = 0;
|
||||
assert.sameValue(x[0], 0, 'The value of x[0] is expected to be 0');
|
||||
|
||||
//CHECK#2
|
||||
var y = [];
|
||||
y["1"] = 1;
|
||||
assert.sameValue(y[1], 1, 'The value of y[1] is expected to be 1');
|
||||
|
|
|
@ -9,11 +9,13 @@ es5id: 15.4_A1.1_T5
|
|||
description: Checking for null and undefined
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x[null] = 0;
|
||||
assert.sameValue(x[0], undefined, 'The value of x[0] is expected to equal undefined');
|
||||
assert.sameValue(x["null"], 0, 'The value of x["null"] is expected to be 0');
|
||||
|
||||
//CHECK#3
|
||||
var y = [];
|
||||
y[undefined] = 0;
|
||||
assert.sameValue(y[0], undefined, 'The value of y[0] is expected to equal undefined');
|
||||
|
|
|
@ -9,11 +9,13 @@ es5id: 15.4_A1.1_T6
|
|||
description: Checking for Boolean object
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x[new Boolean(true)] = 1;
|
||||
assert.sameValue(x[1], undefined, 'The value of x[1] is expected to equal undefined');
|
||||
assert.sameValue(x["true"], 1, 'The value of x["true"] is expected to be 1');
|
||||
|
||||
//CHECK#3
|
||||
x[new Boolean(false)] = 0;
|
||||
assert.sameValue(x[0], undefined, 'The value of x[0] is expected to equal undefined');
|
||||
assert.sameValue(x["false"], 0, 'The value of x["false"] is expected to be 0');
|
||||
|
|
|
@ -9,14 +9,17 @@ es5id: 15.4_A1.1_T7
|
|||
description: Checking for Number object
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x[new Number(0)] = 0;
|
||||
assert.sameValue(x[0], 0, 'The value of x[0] is expected to be 0');
|
||||
|
||||
//CHECK#2
|
||||
var y = [];
|
||||
y[new Number(1)] = 1;
|
||||
assert.sameValue(y[1], 1, 'The value of y[1] is expected to be 1');
|
||||
|
||||
//CHECK#3
|
||||
var z = [];
|
||||
z[new Number(1.1)] = 1;
|
||||
assert.sameValue(z["1.1"], 1, 'The value of z["1.1"] is expected to be 1');
|
||||
|
|
|
@ -9,14 +9,17 @@ es5id: 15.4_A1.1_T8
|
|||
description: Checking for Number object
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x[new String("0")] = 0;
|
||||
assert.sameValue(x[0], 0, 'The value of x[0] is expected to be 0');
|
||||
|
||||
//CHECK#2
|
||||
var y = [];
|
||||
y[new String("1")] = 1;
|
||||
assert.sameValue(y[1], 1, 'The value of y[1] is expected to be 1');
|
||||
|
||||
//CHECK#3
|
||||
var z = [];
|
||||
z[new String("1.1")] = 1;
|
||||
assert.sameValue(z["1.1"], 1, 'The value of z["1.1"] is expected to be 1');
|
||||
|
|
|
@ -9,6 +9,7 @@ es5id: 15.4_A1.1_T9
|
|||
description: If Type(value) is Object, evaluate ToPrimitive(value, String)
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
|
@ -18,6 +19,7 @@ var object = {
|
|||
x[object] = 0;
|
||||
assert.sameValue(x["[object Object]"], 0, 'The value of x["[object Object]"] is expected to be 0');
|
||||
|
||||
//CHECK#2
|
||||
x = [];
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
|
@ -30,6 +32,7 @@ var object = {
|
|||
x[object] = 0;
|
||||
assert.sameValue(x[0], 0, 'The value of x[0] is expected to be 0');
|
||||
|
||||
//CHECK#3
|
||||
x = [];
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
|
@ -42,6 +45,7 @@ var object = {
|
|||
x[object] = 0;
|
||||
assert.sameValue(x[1], 0, 'The value of x[1] is expected to be 0');
|
||||
|
||||
//CHECK#4
|
||||
try {
|
||||
x = [];
|
||||
var object = {
|
||||
|
@ -59,6 +63,7 @@ catch (e) {
|
|||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
x = [];
|
||||
var object = {
|
||||
toString: function() {
|
||||
|
@ -68,6 +73,7 @@ var object = {
|
|||
x[object] = 0;
|
||||
assert.sameValue(x[1], 0, 'The value of x[1] is expected to be 0');
|
||||
|
||||
//CHECK#6
|
||||
x = [];
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
|
@ -80,6 +86,7 @@ var object = {
|
|||
x[object] = 0;
|
||||
assert.sameValue(x[1], 0, 'The value of x[1] is expected to be 0');
|
||||
|
||||
//CHECK#7
|
||||
try {
|
||||
x = [];
|
||||
var object = {
|
||||
|
@ -97,6 +104,7 @@ catch (e) {
|
|||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
try {
|
||||
x = [];
|
||||
var object = {
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
/*---
|
||||
description: Testing descriptor property of Array.from
|
||||
includes: [propertyHelper.js]
|
||||
includes:
|
||||
- propertyHelper.js
|
||||
esid: sec-array.from
|
||||
---*/
|
||||
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
// Copyright (c) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.from
|
||||
description: >
|
||||
Creates an array with length that is equal to the value of the
|
||||
length property of the given array-like, regardless of
|
||||
the presence of corresponding indices and values.
|
||||
info: |
|
||||
Array.from ( items [ , mapfn [ , thisArg ] ] )
|
||||
|
||||
7. Let arrayLike be ! ToObject(items).
|
||||
8. Let len be ? LengthOfArrayLike(arrayLike).
|
||||
9. If IsConstructor(C) is true, then
|
||||
a. Let A be ? Construct(C, « 𝔽(len) »).
|
||||
10. Else,
|
||||
a. Let A be ? ArrayCreate(len).
|
||||
|
||||
includes: [compareArray.js]
|
||||
---*/
|
||||
|
||||
const length = 5;
|
||||
|
||||
const newlyCreatedArray = Array.from({ length });
|
||||
assert.sameValue(
|
||||
newlyCreatedArray.length,
|
||||
length,
|
||||
"The newly created array's length is equal to the value of the length property for the provided array like object"
|
||||
);
|
||||
assert.compareArray(newlyCreatedArray, [undefined, undefined, undefined, undefined, undefined]);
|
||||
|
||||
const newlyCreatedAndMappedArray = Array.from({ length }).map(x => 1);
|
||||
assert.sameValue(
|
||||
newlyCreatedAndMappedArray.length,
|
||||
length,
|
||||
"The newly created and mapped array's length is equal to the value of the length property for the provided array like object"
|
||||
);
|
||||
assert.compareArray(newlyCreatedAndMappedArray, [1, 1, 1, 1, 1]);
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
/*---
|
||||
description: Testing descriptor property of Array.isArray
|
||||
includes: [propertyHelper.js]
|
||||
includes:
|
||||
- propertyHelper.js
|
||||
esid: sec-array.isarray
|
||||
---*/
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ description: >
|
|||
this property
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype.myproperty = 1;
|
||||
var x = new Array(0);
|
||||
assert.sameValue(x.myproperty, 1, 'The value of x.myproperty is expected to be 1');
|
||||
|
|
|
@ -11,6 +11,7 @@ es5id: 15.4.2.2_A1.1_T2
|
|||
description: Array.prototype.toString = Object.prototype.toString
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype.toString = Object.prototype.toString;
|
||||
var x = new Array(0);
|
||||
assert.sameValue(x.toString(), "[object Array]", 'x.toString() must return "[object Array]"');
|
||||
|
|
|
@ -8,6 +8,7 @@ es5id: 15.4.2.2_A1.2_T1
|
|||
description: Checking use Object.prototype.toString
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array(0);
|
||||
assert.sameValue(Object.prototype.toString.call(x), "[object Array]", 'Object.prototype.toString.call(new Array(0)) must return "[object Array]"');
|
||||
|
||||
|
|
|
@ -10,12 +10,15 @@ es5id: 15.4.2.2_A2.1_T1
|
|||
description: Array constructor is given one argument
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array(0);
|
||||
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
|
||||
|
||||
//CHECK#2
|
||||
var x = new Array(1);
|
||||
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
|
||||
|
||||
//CHECK#3
|
||||
var x = new Array(4294967295);
|
||||
assert.sameValue(x.length, 4294967295, 'The value of x.length is expected to be 4294967295');
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ es5id: 15.4.2.2_A2.2_T1
|
|||
description: Use try statement. len = -1, 4294967296, 4294967297
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
try {
|
||||
new Array(-1);
|
||||
throw new Test262Error('#1.1: new Array(-1) throw RangeError. Actual: ' + (new Array(-1)));
|
||||
|
@ -21,6 +22,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
try {
|
||||
new Array(4294967296);
|
||||
throw new Test262Error('#2.1: new Array(4294967296) throw RangeError. Actual: ' + (new Array(4294967296)));
|
||||
|
@ -32,6 +34,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
try {
|
||||
new Array(4294967297);
|
||||
throw new Test262Error('#3.1: new Array(4294967297) throw RangeError. Actual: ' + (new Array(4294967297)));
|
||||
|
|
|
@ -10,6 +10,7 @@ es5id: 15.4.2.2_A2.2_T2
|
|||
description: Use try statement. len = NaN, +/-Infinity
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
try {
|
||||
new Array(NaN);
|
||||
throw new Test262Error('#1.1: new Array(NaN) throw RangeError. Actual: ' + (new Array(NaN)));
|
||||
|
@ -21,6 +22,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
try {
|
||||
new Array(Number.POSITIVE_INFINITY);
|
||||
throw new Test262Error('#2.1: new Array(Number.POSITIVE_INFINITY) throw RangeError. Actual: ' + (new Array(Number.POSITIVE_INFINITY)));
|
||||
|
@ -32,6 +34,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
try {
|
||||
new Array(Number.NEGATIVE_INFINITY);
|
||||
throw new Test262Error('#3.1: new Array(Number.NEGATIVE_INFINITY) throw RangeError. Actual: ' + (new Array(Number.NEGATIVE_INFINITY)));
|
||||
|
|
|
@ -10,6 +10,7 @@ es5id: 15.4.2.2_A2.2_T3
|
|||
description: Use try statement. len = 1.5, Number.MAX_VALUE, Number.MIN_VALUE
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
try {
|
||||
new Array(1.5);
|
||||
throw new Test262Error('#1.1: new Array(1.5) throw RangeError. Actual: ' + (new Array(1.5)));
|
||||
|
@ -21,6 +22,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
try {
|
||||
new Array(Number.MAX_VALUE);
|
||||
throw new Test262Error('#2.1: new Array(Number.MAX_VALUE) throw RangeError. Actual: ' + (new Array(Number.MAX_VALUE)));
|
||||
|
@ -32,6 +34,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
try {
|
||||
new Array(Number.MIN_VALUE);
|
||||
throw new Test262Error('#3.1: new Array(Number.MIN_VALUE) throw RangeError. Actual: ' + (new Array(Number.MIN_VALUE)));
|
||||
|
|
|
@ -8,6 +8,7 @@ es5id: 15.4.5.1_A1.1_T1
|
|||
description: length in [4294967296, -1, 1.5]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
try {
|
||||
var x = [];
|
||||
x.length = 4294967296;
|
||||
|
@ -20,6 +21,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
try {
|
||||
x = [];
|
||||
x.length = -1;
|
||||
|
@ -32,6 +34,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
try {
|
||||
x = [];
|
||||
x.length = 1.5;
|
||||
|
|
|
@ -8,6 +8,7 @@ es5id: 15.4.5.1_A1.1_T2
|
|||
description: length in [NaN, Infinity, -Infinity, undefined]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
try {
|
||||
var x = [];
|
||||
x.length = NaN;
|
||||
|
@ -20,6 +21,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
try {
|
||||
x = [];
|
||||
x.length = Number.POSITIVE_INFINITY;
|
||||
|
@ -32,6 +34,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
try {
|
||||
x = [];
|
||||
x.length = Number.NEGATIVE_INFINITY;
|
||||
|
@ -44,6 +47,7 @@ try {
|
|||
);
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
try {
|
||||
x = [];
|
||||
x.length = undefined;
|
||||
|
|
|
@ -12,10 +12,12 @@ es5id: 15.4.5.1_A1.2_T1
|
|||
description: Change length of array
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [0, , 2, , 4];
|
||||
x.length = 4;
|
||||
assert.sameValue(x[4], undefined, 'The value of x[4] is expected to equal undefined');
|
||||
|
||||
//CHECK#2
|
||||
x.length = 3;
|
||||
assert.sameValue(x[3], undefined, 'The value of x[3] is expected to equal undefined');
|
||||
assert.sameValue(x[2], 2, 'The value of x[2] is expected to be 2');
|
||||
|
|
|
@ -12,11 +12,13 @@ es5id: 15.4.5.1_A1.2_T3
|
|||
description: Checking an inherited property
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype[2] = 2;
|
||||
var x = [0, 1];
|
||||
x.length = 3;
|
||||
assert.sameValue(x.hasOwnProperty('2'), false, 'x.hasOwnProperty("2") must return false');
|
||||
|
||||
//CHECK#2
|
||||
x.length = 2;
|
||||
assert.sameValue(x[2], 2, 'The value of x[2] is expected to be 2');
|
||||
|
||||
|
|
|
@ -8,26 +8,32 @@ es5id: 15.4.5.1_A1.3_T1
|
|||
description: length is object or primitve
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x.length = true;
|
||||
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
|
||||
|
||||
//CHECK#2
|
||||
x = [0];
|
||||
x.length = null;
|
||||
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
|
||||
|
||||
//CHECK#3
|
||||
x = [0];
|
||||
x.length = new Boolean(false);
|
||||
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
|
||||
|
||||
//CHECK#4
|
||||
x = [];
|
||||
x.length = new Number(1);
|
||||
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
|
||||
|
||||
//CHECK#5
|
||||
x = [];
|
||||
x.length = "1";
|
||||
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
|
||||
|
||||
//CHECK#6
|
||||
x = [];
|
||||
x.length = new String("1");
|
||||
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
|
||||
|
|
|
@ -8,6 +8,7 @@ es5id: 15.4.5.1_A1.3_T2
|
|||
description: Uint32 use ToNumber and ToPrimitve
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x.length = {
|
||||
valueOf: function() {
|
||||
|
@ -16,6 +17,7 @@ x.length = {
|
|||
};
|
||||
assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
|
||||
|
||||
//CHECK#2
|
||||
x = [];
|
||||
x.length = {
|
||||
valueOf: function() {
|
||||
|
@ -27,6 +29,7 @@ x.length = {
|
|||
};
|
||||
assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
|
||||
|
||||
//CHECK#3
|
||||
x = [];
|
||||
x.length = {
|
||||
valueOf: function() {
|
||||
|
@ -38,6 +41,7 @@ x.length = {
|
|||
};
|
||||
assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
|
||||
|
||||
//CHECK#4
|
||||
try {
|
||||
x = [];
|
||||
x.length = {
|
||||
|
@ -54,6 +58,7 @@ catch (e) {
|
|||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
x = [];
|
||||
x.length = {
|
||||
toString: function() {
|
||||
|
@ -62,6 +67,7 @@ x.length = {
|
|||
};
|
||||
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
|
||||
|
||||
//CHECK#6
|
||||
x = [];
|
||||
x.length = {
|
||||
valueOf: function() {
|
||||
|
@ -73,6 +79,7 @@ x.length = {
|
|||
}
|
||||
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
|
||||
|
||||
//CHECK#7
|
||||
try {
|
||||
x = [];
|
||||
x.length = {
|
||||
|
@ -90,6 +97,7 @@ catch (e) {
|
|||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
try {
|
||||
x = [];
|
||||
x.length = {
|
||||
|
|
|
@ -12,6 +12,7 @@ description: >
|
|||
is an array index
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [0, 1, 2];
|
||||
x[4294967294] = 4294967294;
|
||||
x.length = 2;
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
// |reftest| skip -- array-find-from-last is not supported
|
||||
// Copyright (C) 2022 Microsoft. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-array.prototype-@@unscopables
|
||||
description: >
|
||||
Initial value of `Symbol.unscopables` property
|
||||
info: |
|
||||
22.1.3.32 Array.prototype [ @@unscopables ]
|
||||
|
||||
...
|
||||
7. Perform CreateDataProperty(unscopableList, "findLast", true).
|
||||
8. Perform CreateDataProperty(unscopableList, "findLastIndex", true).
|
||||
...
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol.unscopables, array-find-from-last]
|
||||
---*/
|
||||
|
||||
var unscopables = Array.prototype[Symbol.unscopables];
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(unscopables), null);
|
||||
|
||||
assert.sameValue(unscopables.findLast, true, '`findLast` property value');
|
||||
verifyEnumerable(unscopables, 'findLast');
|
||||
verifyWritable(unscopables, 'findLast');
|
||||
verifyConfigurable(unscopables, 'findLast');
|
||||
|
||||
assert.sameValue(unscopables.findLastIndex, true, '`findLastIndex` property value');
|
||||
verifyEnumerable(unscopables, 'findLastIndex');
|
||||
verifyWritable(unscopables, 'findLastIndex');
|
||||
verifyConfigurable(unscopables, 'findLastIndex');
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -1,34 +0,0 @@
|
|||
// |reftest| skip -- array-grouping is not supported
|
||||
// Copyright (C) 2022 Chengzhong Wu. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-array.prototype-@@unscopables
|
||||
description: >
|
||||
Initial value of `Symbol.unscopables` property
|
||||
info: |
|
||||
22.1.3.32 Array.prototype [ @@unscopables ]
|
||||
|
||||
...
|
||||
10. Perform ! CreateDataPropertyOrThrow(unscopableList, "groupBy", true).
|
||||
11. Perform ! CreateDataPropertyOrThrow(unscopableList, "groupByToMap", true).
|
||||
...
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol.unscopables, array-grouping]
|
||||
---*/
|
||||
|
||||
var unscopables = Array.prototype[Symbol.unscopables];
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(unscopables), null);
|
||||
|
||||
assert.sameValue(unscopables.groupBy, true, '`groupBy` property value');
|
||||
verifyEnumerable(unscopables, 'groupBy');
|
||||
verifyWritable(unscopables, 'groupBy');
|
||||
verifyConfigurable(unscopables, 'groupBy');
|
||||
|
||||
assert.sameValue(unscopables.groupByToMap, true, '`groupByToMap` property value');
|
||||
verifyEnumerable(unscopables, 'groupByToMap');
|
||||
verifyWritable(unscopables, 'groupByToMap');
|
||||
verifyConfigurable(unscopables, 'groupByToMap');
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -1,3 +1,4 @@
|
|||
// |reftest| skip -- array-find-from-last is not supported
|
||||
// Copyright (C) 2015 Mike Pennisi. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
|
@ -13,16 +14,17 @@ info: |
|
|||
4. Perform CreateDataProperty(unscopableList, "fill", true).
|
||||
5. Perform CreateDataProperty(unscopableList, "find", true).
|
||||
6. Perform CreateDataProperty(unscopableList, "findIndex", true).
|
||||
7. Perform CreateDataProperty(unscopableList, "flat", true).
|
||||
8. Perform CreateDataProperty(unscopableList, "flatMap", true).
|
||||
9. Perform CreateDataProperty(unscopableList, "includes", true).
|
||||
10. Perform CreateDataProperty(unscopableList, "keys", true).
|
||||
11. Perform CreateDataProperty(unscopableList, "values", true).
|
||||
12. Assert: Each of the above calls returns true.
|
||||
13. Return unscopableList.
|
||||
|
||||
7. Perform CreateDataProperty(unscopableList, "findLast", true).
|
||||
8. Perform CreateDataProperty(unscopableList, "findLastIndex", true).
|
||||
9. Perform CreateDataProperty(unscopableList, "flat", true).
|
||||
10. Perform CreateDataProperty(unscopableList, "flatMap", true).
|
||||
11. Perform CreateDataProperty(unscopableList, "includes", true).
|
||||
12. Perform CreateDataProperty(unscopableList, "keys", true).
|
||||
13. Perform CreateDataProperty(unscopableList, "values", true).
|
||||
14. Assert: Each of the above calls returns true.
|
||||
15. Return unscopableList.
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol.unscopables]
|
||||
features: [Symbol.unscopables, array-find-from-last]
|
||||
---*/
|
||||
|
||||
var unscopables = Array.prototype[Symbol.unscopables];
|
||||
|
@ -54,6 +56,17 @@ verifyEnumerable(unscopables, 'findIndex');
|
|||
verifyWritable(unscopables, 'findIndex');
|
||||
verifyConfigurable(unscopables, 'findIndex');
|
||||
|
||||
|
||||
assert.sameValue(unscopables.findLast, true, '`findLast` property value');
|
||||
verifyEnumerable(unscopables, 'findLast');
|
||||
verifyWritable(unscopables, 'findLast');
|
||||
verifyConfigurable(unscopables, 'findLast');
|
||||
|
||||
assert.sameValue(unscopables.findLastIndex, true, '`findLastIndex` property value');
|
||||
verifyEnumerable(unscopables, 'findLastIndex');
|
||||
verifyWritable(unscopables, 'findLastIndex');
|
||||
verifyConfigurable(unscopables, 'findLastIndex');
|
||||
|
||||
assert.sameValue(unscopables.flat, true, '`flat` property value');
|
||||
verifyEnumerable(unscopables, 'flat');
|
||||
verifyWritable(unscopables, 'flat');
|
||||
|
|
|
@ -16,13 +16,22 @@ function concatTypedArray(type, elems, modulo) {
|
|||
ta_by_len[i] = items[i] = modulo === false ? i : elems % modulo;
|
||||
}
|
||||
var ta = new type(items);
|
||||
assert.compareArray([].concat(ta, ta), [ta, ta]);
|
||||
assert(
|
||||
compareArray([].concat(ta, ta), [ta, ta]),
|
||||
'compareArray([].concat(ta, ta), [ta, ta]) must return true'
|
||||
);
|
||||
ta[Symbol.isConcatSpreadable] = true;
|
||||
assert.compareArray([].concat(ta), items);
|
||||
assert.compareArray([].concat(ta), items, '[].concat(new type(items)) returns items');
|
||||
|
||||
assert.compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]);
|
||||
assert(
|
||||
compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]),
|
||||
'compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]) must return true'
|
||||
);
|
||||
ta_by_len[Symbol.isConcatSpreadable] = true;
|
||||
assert.compareArray([].concat(ta_by_len), items);
|
||||
assert(
|
||||
compareArray([].concat(ta_by_len), items),
|
||||
'compareArray([].concat(ta_by_len), items) must return true'
|
||||
);
|
||||
|
||||
// TypedArray with fake `length`.
|
||||
ta = new type(1);
|
||||
|
@ -34,7 +43,7 @@ function concatTypedArray(type, elems, modulo) {
|
|||
value: 4000
|
||||
});
|
||||
ta[Symbol.isConcatSpreadable] = true;
|
||||
assert.compareArray([].concat(ta), expected);
|
||||
assert.compareArray([].concat(ta), expected, '[].concat(new type(1)) returns expected');
|
||||
}
|
||||
|
||||
var max = [Math.pow(2, 8), Math.pow(2, 16), Math.pow(2, 32), false, false];
|
||||
|
|
|
@ -16,13 +16,22 @@ function concatTypedArray(type, elems, modulo) {
|
|||
ta_by_len[i] = items[i] = modulo === false ? i : elems % modulo;
|
||||
}
|
||||
var ta = new type(items);
|
||||
assert.compareArray([].concat(ta, ta), [ta, ta]);
|
||||
assert(
|
||||
compareArray([].concat(ta, ta), [ta, ta]),
|
||||
'compareArray([].concat(ta, ta), [ta, ta]) must return true'
|
||||
);
|
||||
ta[Symbol.isConcatSpreadable] = true;
|
||||
assert.compareArray([].concat(ta), items);
|
||||
assert.compareArray([].concat(ta), items, '[].concat(new type(items)) returns items');
|
||||
|
||||
assert.compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]);
|
||||
assert(
|
||||
compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]),
|
||||
'compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]) must return true'
|
||||
);
|
||||
ta_by_len[Symbol.isConcatSpreadable] = true;
|
||||
assert.compareArray([].concat(ta_by_len), items);
|
||||
assert(
|
||||
compareArray([].concat(ta_by_len), items),
|
||||
'compareArray([].concat(ta_by_len), items) must return true'
|
||||
);
|
||||
|
||||
// TypedArray with fake `length`.
|
||||
ta = new type(1);
|
||||
|
@ -34,7 +43,7 @@ function concatTypedArray(type, elems, modulo) {
|
|||
value: 4000
|
||||
});
|
||||
ta[Symbol.isConcatSpreadable] = true;
|
||||
assert.compareArray([].concat(ta), expected);
|
||||
assert.compareArray([].concat(ta), expected, '[].concat(new type(1)) returns expected');
|
||||
}
|
||||
var max = [Math.pow(2, 8), Math.pow(2, 16), Math.pow(2, 32), false, false];
|
||||
[
|
||||
|
|
|
@ -16,6 +16,7 @@ var y = new Array(0, 1);
|
|||
var z = new Array(2, 3, 4);
|
||||
var arr = x.concat(y, z);
|
||||
|
||||
//CHECK#0
|
||||
arr.getClass = Object.prototype.toString;
|
||||
assert.sameValue(arr.getClass(), "[object Array]", 'arr.getClass() must return "[object Array]"');
|
||||
assert.sameValue(arr[0], 0, 'The value of arr[0] is expected to be 0');
|
||||
|
|
|
@ -16,6 +16,7 @@ var y = new Object();
|
|||
var z = new Array(1, 2);
|
||||
var arr = x.concat(y, z, -1, true, "NaN");
|
||||
|
||||
//CHECK#0
|
||||
arr.getClass = Object.prototype.toString;
|
||||
assert.sameValue(arr.getClass(), "[object Array]", 'arr.getClass() must return "[object Array]"');
|
||||
assert.sameValue(arr[0], 0, 'The value of arr[0] is expected to be 0');
|
||||
|
|
|
@ -14,6 +14,7 @@ description: Checking this algorithm with no items
|
|||
var x = [0, 1];
|
||||
var arr = x.concat();
|
||||
|
||||
//CHECK#0
|
||||
arr.getClass = Object.prototype.toString;
|
||||
assert.sameValue(arr.getClass(), "[object Array]", 'arr.getClass() must return "[object Array]"');
|
||||
assert.sameValue(arr[0], 0, 'The value of arr[0] is expected to be 0');
|
||||
|
|
|
@ -14,6 +14,7 @@ description: Checking this algorithm, items are [], [,]
|
|||
var x = [, 1];
|
||||
var arr = x.concat([], [, ]);
|
||||
|
||||
//CHECK#0
|
||||
arr.getClass = Object.prototype.toString;
|
||||
assert.sameValue(arr.getClass(), "[object Array]", 'arr.getClass() must return "[object Array]"');
|
||||
assert.sameValue(arr[0], undefined, 'The value of arr[0] is expected to equal undefined');
|
||||
|
|
|
@ -16,6 +16,7 @@ var y = new Object();
|
|||
var z = new Array(1, 2);
|
||||
var arr = x.concat(y, z, -1, true, "NaN");
|
||||
|
||||
//CHECK#0
|
||||
arr.getClass = Object.prototype.toString;
|
||||
assert.sameValue(arr.getClass(), "[object Array]", 'arr.getClass() must return "[object Array]"');
|
||||
assert.sameValue(arr[0], x, 'The value of arr[0] is expected to equal the value of x');
|
||||
|
|
|
@ -14,6 +14,7 @@ var x = {};
|
|||
x.concat = Array.prototype.concat;
|
||||
var arr = x.concat();
|
||||
|
||||
//CHECK#0
|
||||
arr.getClass = Object.prototype.toString;
|
||||
assert.sameValue(arr.getClass(), "[object Array]", 'arr.getClass() must return "[object Array]"');
|
||||
assert.sameValue(arr[0], x, 'The value of arr[0] is expected to equal the value of x');
|
||||
|
|
|
@ -55,9 +55,4 @@ assert.compareArray(
|
|||
'[0, 1, 2, 3].copyWithin(1.5, 0) must return [0, 0, 1, 2]'
|
||||
);
|
||||
|
||||
assert.compareArray(
|
||||
[0, 1, 2, 3].copyWithin({}, 1), [1, 2, 3, 3],
|
||||
'[0, 1, 2, 3].copyWithin({}, 1) must return [1, 2, 3, 3]'
|
||||
);
|
||||
|
||||
reportCompare(0, 0);
|
||||
|
|
|
@ -31,24 +31,20 @@ info: |
|
|||
includes: [compareArray.js]
|
||||
---*/
|
||||
|
||||
assert.compareArray(
|
||||
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 0),
|
||||
['a', 'b', 'c', 'd', 'e', 'f']
|
||||
);
|
||||
assert(compareArray(
|
||||
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 0), ['a', 'b', 'c', 'd', 'e', 'f']
|
||||
), 'compareArray( ["a", "b", "c", "d", "e", "f"].copyWithin(0, 0), ["a", "b", "c", "d", "e", "f"] ) must return true');
|
||||
|
||||
assert.compareArray(
|
||||
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 2),
|
||||
['c', 'd', 'e', 'f', 'e', 'f']
|
||||
);
|
||||
assert(compareArray(
|
||||
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 2), ['c', 'd', 'e', 'f', 'e', 'f']
|
||||
), 'compareArray( ["a", "b", "c", "d", "e", "f"].copyWithin(0, 2), ["c", "d", "e", "f", "e", "f"] ) must return true');
|
||||
|
||||
assert.compareArray(
|
||||
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(3, 0),
|
||||
['a', 'b', 'c', 'a', 'b', 'c']
|
||||
);
|
||||
assert(compareArray(
|
||||
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(3, 0), ['a', 'b', 'c', 'a', 'b', 'c']
|
||||
), 'compareArray( ["a", "b", "c", "d", "e", "f"].copyWithin(3, 0), ["a", "b", "c", "a", "b", "c"] ) must return true');
|
||||
|
||||
assert.compareArray(
|
||||
[0, 1, 2, 3, 4, 5].copyWithin(1, 4),
|
||||
[0, 4, 5, 3, 4, 5]
|
||||
);
|
||||
assert(compareArray(
|
||||
[0, 1, 2, 3, 4, 5].copyWithin(1, 4), [0, 4, 5, 3, 4, 5]
|
||||
), 'compareArray( [0, 1, 2, 3, 4, 5].copyWithin(1, 4), [0, 4, 5, 3, 4, 5] ) must return true');
|
||||
|
||||
reportCompare(0, 0);
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
// |reftest| skip -- resizable-arraybuffer is not supported
|
||||
// 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);
|
|
@ -1,124 +0,0 @@
|
|||
// 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:
|
||||
- typedArrayConstructors
|
||||
- floatArrayConstructors
|
||||
- intArrayConstructors
|
||||
- TypedArray
|
||||
- testWithTypedArrayConstructors
|
||||
- testWithAtomicsFriendlyTypedArrayConstructors
|
||||
- testWithNonAtomicsFriendlyTypedArrayConstructors
|
||||
- testTypedArrayConversions
|
||||
---*/
|
||||
|
||||
/**
|
||||
* Array containing every typed array constructor.
|
||||
*/
|
||||
var typedArrayConstructors = [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Int32Array,
|
||||
Int16Array,
|
||||
Int8Array,
|
||||
Uint32Array,
|
||||
Uint16Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray
|
||||
];
|
||||
|
||||
var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
|
||||
var intArrayConstructors = typedArrayConstructors.slice(2, 7);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Uint8ClampedArray
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
// |reftest| skip -- resizable-arraybuffer is not supported
|
||||
// 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.filter
|
||||
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.filter.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.compareArray(result, expectedElements, 'result (shrink)');
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.filter.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.compareArray(result, expectedElements, 'result (grow)');
|
||||
});
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -1,124 +0,0 @@
|
|||
// 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:
|
||||
- typedArrayConstructors
|
||||
- floatArrayConstructors
|
||||
- intArrayConstructors
|
||||
- TypedArray
|
||||
- testWithTypedArrayConstructors
|
||||
- testWithAtomicsFriendlyTypedArrayConstructors
|
||||
- testWithNonAtomicsFriendlyTypedArrayConstructors
|
||||
- testTypedArrayConversions
|
||||
---*/
|
||||
|
||||
/**
|
||||
* Array containing every typed array constructor.
|
||||
*/
|
||||
var typedArrayConstructors = [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Int32Array,
|
||||
Int16Array,
|
||||
Int8Array,
|
||||
Uint32Array,
|
||||
Uint16Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray
|
||||
];
|
||||
|
||||
var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
|
||||
var intArrayConstructors = typedArrayConstructors.slice(2, 7);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Uint8ClampedArray
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
// |reftest| skip -- resizable-arraybuffer is not supported
|
||||
// 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.find
|
||||
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 finalElement, expectedElements, expectedIndices, expectedArrays;
|
||||
var elements, indices, arrays, result;
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.find.call(sample, function(element, index, array) {
|
||||
if (elements.length === 0) {
|
||||
try {
|
||||
buffer.resize(2 * BPE);
|
||||
finalElement = undefined;
|
||||
expectedElements = [0, 0];
|
||||
expectedIndices = [0, 1];
|
||||
expectedArrays = [sample, sample];
|
||||
} catch (_) {
|
||||
finalElement = 0;
|
||||
expectedElements = [0, 0, 0];
|
||||
expectedIndices = [0, 1, 2];
|
||||
expectedArrays = [sample, sample, sample];
|
||||
}
|
||||
}
|
||||
|
||||
elements.push(element);
|
||||
indices.push(index);
|
||||
arrays.push(array);
|
||||
return false;
|
||||
});
|
||||
|
||||
assert.compareArray(elements, [0, 0, finalElement], 'elements (shrink)');
|
||||
assert.compareArray(indices, [0, 1, 2], 'indices (shrink)');
|
||||
assert.compareArray(arrays, [sample, sample, sample], 'arrays (shrink)');
|
||||
assert.sameValue(result, undefined, 'result (shrink)');
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.find.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 false;
|
||||
});
|
||||
|
||||
assert.compareArray(elements, expectedElements, 'elements (grow)');
|
||||
assert.compareArray(indices, expectedIndices, 'indices (grow)');
|
||||
assert.compareArray(arrays, expectedArrays, 'arrays (grow)');
|
||||
assert.sameValue(result, undefined, 'result (grow)');
|
||||
});
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -1,124 +0,0 @@
|
|||
// 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:
|
||||
- typedArrayConstructors
|
||||
- floatArrayConstructors
|
||||
- intArrayConstructors
|
||||
- TypedArray
|
||||
- testWithTypedArrayConstructors
|
||||
- testWithAtomicsFriendlyTypedArrayConstructors
|
||||
- testWithNonAtomicsFriendlyTypedArrayConstructors
|
||||
- testTypedArrayConversions
|
||||
---*/
|
||||
|
||||
/**
|
||||
* Array containing every typed array constructor.
|
||||
*/
|
||||
var typedArrayConstructors = [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Int32Array,
|
||||
Int16Array,
|
||||
Int8Array,
|
||||
Uint32Array,
|
||||
Uint16Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray
|
||||
];
|
||||
|
||||
var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
|
||||
var intArrayConstructors = typedArrayConstructors.slice(2, 7);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Uint8ClampedArray
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
// |reftest| skip -- resizable-arraybuffer is not supported
|
||||
// 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.findindex
|
||||
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 finalElement, expectedElements, expectedIndices, expectedArrays;
|
||||
var elements, indices, arrays, result;
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.findIndex.call(sample, function(element, index, array) {
|
||||
if (elements.length === 0) {
|
||||
try {
|
||||
buffer.resize(2 * BPE);
|
||||
finalElement = undefined;
|
||||
expectedElements = [0, 0];
|
||||
expectedIndices = [0, 1];
|
||||
expectedArrays = [sample, sample];
|
||||
} catch (_) {
|
||||
finalElement = 0;
|
||||
expectedElements = [0, 0, 0];
|
||||
expectedIndices = [0, 1, 2];
|
||||
expectedArrays = [sample, sample, sample];
|
||||
}
|
||||
}
|
||||
|
||||
elements.push(element);
|
||||
indices.push(index);
|
||||
arrays.push(array);
|
||||
return false;
|
||||
});
|
||||
|
||||
assert.compareArray(elements, [0, 0, finalElement], 'elements (shrink)');
|
||||
assert.compareArray(indices, [0, 1, 2], 'indices (shrink)');
|
||||
assert.compareArray(arrays, [sample, sample, sample], 'arrays (shrink)');
|
||||
assert.sameValue(result, -1, 'result (shrink)');
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.findIndex.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 false;
|
||||
});
|
||||
|
||||
assert.compareArray(elements, expectedElements, 'elements (grow)');
|
||||
assert.compareArray(indices, expectedIndices, 'indices (grow)');
|
||||
assert.compareArray(arrays, expectedArrays, 'arrays (grow)');
|
||||
assert.sameValue(result, -1, 'result (grow)');
|
||||
});
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -1,124 +0,0 @@
|
|||
// 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:
|
||||
- typedArrayConstructors
|
||||
- floatArrayConstructors
|
||||
- intArrayConstructors
|
||||
- TypedArray
|
||||
- testWithTypedArrayConstructors
|
||||
- testWithAtomicsFriendlyTypedArrayConstructors
|
||||
- testWithNonAtomicsFriendlyTypedArrayConstructors
|
||||
- testTypedArrayConversions
|
||||
---*/
|
||||
|
||||
/**
|
||||
* Array containing every typed array constructor.
|
||||
*/
|
||||
var typedArrayConstructors = [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Int32Array,
|
||||
Int16Array,
|
||||
Int8Array,
|
||||
Uint32Array,
|
||||
Uint16Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray
|
||||
];
|
||||
|
||||
var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
|
||||
var intArrayConstructors = typedArrayConstructors.slice(2, 7);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Uint8ClampedArray
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
// |reftest| skip -- resizable-arraybuffer is not supported
|
||||
// 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.findlast
|
||||
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 secondElement, expectedElements, expectedIndices, expectedArrays;
|
||||
var elements, indices, arrays, result;
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.findLast.call(sample, function(element, index, array) {
|
||||
if (elements.length === 0) {
|
||||
try {
|
||||
buffer.resize(BPE);
|
||||
secondElement = undefined;
|
||||
expectedElements = [0];
|
||||
expectedIndices = [0];
|
||||
expectedArrays = [sample];
|
||||
} catch (_) {
|
||||
secondElement = 0;
|
||||
expectedElements = [0, 0, 0];
|
||||
expectedIndices = [2, 1, 0];
|
||||
expectedArrays = [sample, sample, sample];
|
||||
}
|
||||
}
|
||||
|
||||
elements.push(element);
|
||||
indices.push(index);
|
||||
arrays.push(array);
|
||||
return false;
|
||||
});
|
||||
|
||||
assert.compareArray(elements, [0, secondElement, 0], 'elements (shrink)');
|
||||
assert.compareArray(indices, [2, 1, 0], 'indices (shrink)');
|
||||
assert.compareArray(arrays, [sample, sample, sample], 'arrays (shrink)');
|
||||
assert.sameValue(result, undefined, 'result (shrink)');
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.findLast.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 false;
|
||||
});
|
||||
|
||||
assert.compareArray(elements, expectedElements, 'elements (grow)');
|
||||
assert.compareArray(indices, expectedIndices, 'indices (grow)');
|
||||
assert.compareArray(arrays, expectedArrays, 'arrays (grow)');
|
||||
assert.sameValue(result, undefined, 'result (grow)');
|
||||
});
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -1,124 +0,0 @@
|
|||
// 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:
|
||||
- typedArrayConstructors
|
||||
- floatArrayConstructors
|
||||
- intArrayConstructors
|
||||
- TypedArray
|
||||
- testWithTypedArrayConstructors
|
||||
- testWithAtomicsFriendlyTypedArrayConstructors
|
||||
- testWithNonAtomicsFriendlyTypedArrayConstructors
|
||||
- testTypedArrayConversions
|
||||
---*/
|
||||
|
||||
/**
|
||||
* Array containing every typed array constructor.
|
||||
*/
|
||||
var typedArrayConstructors = [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Int32Array,
|
||||
Int16Array,
|
||||
Int8Array,
|
||||
Uint32Array,
|
||||
Uint16Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray
|
||||
];
|
||||
|
||||
var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
|
||||
var intArrayConstructors = typedArrayConstructors.slice(2, 7);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Uint8ClampedArray
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
// |reftest| skip -- resizable-arraybuffer is not supported
|
||||
// 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.findlastindex
|
||||
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 secondElement, expectedElements, expectedIndices, expectedArrays;
|
||||
var elements, indices, arrays, result;
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.findLastIndex.call(sample, function(element, index, array) {
|
||||
if (elements.length === 0) {
|
||||
try {
|
||||
buffer.resize(BPE);
|
||||
secondElement = undefined;
|
||||
expectedElements = [0];
|
||||
expectedIndices = [0];
|
||||
expectedArrays = [sample];
|
||||
} catch (_) {
|
||||
secondElement = 0;
|
||||
expectedElements = [0, 0, 0];
|
||||
expectedIndices = [2, 1, 0];
|
||||
expectedArrays = [sample, sample, sample];
|
||||
}
|
||||
}
|
||||
|
||||
elements.push(element);
|
||||
indices.push(index);
|
||||
arrays.push(array);
|
||||
return false;
|
||||
});
|
||||
|
||||
assert.compareArray(elements, [0, secondElement, 0], 'elements (shrink)');
|
||||
assert.compareArray(indices, [2, 1, 0], 'indices (shrink)');
|
||||
assert.compareArray(arrays, [sample, sample, sample], 'arrays (shrink)');
|
||||
assert.sameValue(result, -1, 'result (shrink)');
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.findLastIndex.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 false;
|
||||
});
|
||||
|
||||
assert.compareArray(elements, expectedElements, 'elements (grow)');
|
||||
assert.compareArray(indices, expectedIndices, 'indices (grow)');
|
||||
assert.compareArray(arrays, expectedArrays, 'arrays (grow)');
|
||||
assert.sameValue(result, -1, 'result (grow)');
|
||||
});
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -1,124 +0,0 @@
|
|||
// 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:
|
||||
- typedArrayConstructors
|
||||
- floatArrayConstructors
|
||||
- intArrayConstructors
|
||||
- TypedArray
|
||||
- testWithTypedArrayConstructors
|
||||
- testWithAtomicsFriendlyTypedArrayConstructors
|
||||
- testWithNonAtomicsFriendlyTypedArrayConstructors
|
||||
- testTypedArrayConversions
|
||||
---*/
|
||||
|
||||
/**
|
||||
* Array containing every typed array constructor.
|
||||
*/
|
||||
var typedArrayConstructors = [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Int32Array,
|
||||
Int16Array,
|
||||
Int8Array,
|
||||
Uint32Array,
|
||||
Uint16Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray
|
||||
];
|
||||
|
||||
var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
|
||||
var intArrayConstructors = typedArrayConstructors.slice(2, 7);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Uint8ClampedArray
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
// |reftest| skip -- resizable-arraybuffer is not supported
|
||||
// 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.forEach
|
||||
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.forEach.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);
|
||||
});
|
||||
|
||||
assert.compareArray(elements, expectedElements, 'elements (shrink)');
|
||||
assert.compareArray(indices, expectedIndices, 'indices (shrink)');
|
||||
assert.compareArray(arrays, expectedArrays, 'arrays (shrink)');
|
||||
assert.sameValue(result, undefined, 'result (shrink)');
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.forEach.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);
|
||||
});
|
||||
|
||||
assert.compareArray(elements, expectedElements, 'elements (grow)');
|
||||
assert.compareArray(indices, expectedIndices, 'indices (grow)');
|
||||
assert.compareArray(arrays, expectedArrays, 'arrays (grow)');
|
||||
assert.sameValue(result, undefined, 'result (grow)');
|
||||
});
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -1,124 +0,0 @@
|
|||
// 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:
|
||||
- typedArrayConstructors
|
||||
- floatArrayConstructors
|
||||
- intArrayConstructors
|
||||
- TypedArray
|
||||
- testWithTypedArrayConstructors
|
||||
- testWithAtomicsFriendlyTypedArrayConstructors
|
||||
- testWithNonAtomicsFriendlyTypedArrayConstructors
|
||||
- testTypedArrayConversions
|
||||
---*/
|
||||
|
||||
/**
|
||||
* Array containing every typed array constructor.
|
||||
*/
|
||||
var typedArrayConstructors = [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Int32Array,
|
||||
Int16Array,
|
||||
Int8Array,
|
||||
Uint32Array,
|
||||
Uint16Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray
|
||||
];
|
||||
|
||||
var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
|
||||
var intArrayConstructors = typedArrayConstructors.slice(2, 7);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Uint8ClampedArray
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -7,11 +7,13 @@ esid: sec-array.prototype.join
|
|||
description: Checking this use new Array() and []
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array();
|
||||
if (x.join() !== "") {
|
||||
throw new Test262Error('#1: x = new Array(); x.join() === "". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
x = [];
|
||||
x[0] = 1;
|
||||
x.length = 0;
|
||||
|
|
|
@ -7,11 +7,13 @@ esid: sec-array.prototype.join
|
|||
description: Checking this use new Array() and []
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array(0, 1, 2, 3);
|
||||
if (x.join() !== "0,1,2,3") {
|
||||
throw new Test262Error('#1: x = new Array(0,1,2,3); x.join() === "0,1,2,3". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
x = [];
|
||||
x[0] = 0;
|
||||
x[3] = 3;
|
||||
|
@ -19,6 +21,7 @@ if (x.join() !== "0,,,3") {
|
|||
throw new Test262Error('#2: x = []; x[0] = 0; x[3] = 3; x.join() === "0,,,3". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
x = [];
|
||||
x[0] = 0;
|
||||
if (x.join() !== "0") {
|
||||
|
|
|
@ -7,11 +7,13 @@ esid: sec-array.prototype.join
|
|||
description: Checking this use new Array() and []
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array(0, 1, 2, 3);
|
||||
if (x.join(undefined) !== "0,1,2,3") {
|
||||
throw new Test262Error('#1: x = new Array(0,1,2,3); x.join(undefined) === "0,1,2,3". Actual: ' + (x.join(undefined)));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
x = [];
|
||||
x[0] = 0;
|
||||
x[3] = 3;
|
||||
|
@ -19,6 +21,7 @@ if (x.join(undefined) !== "0,,,3") {
|
|||
throw new Test262Error('#2: x = []; x[0] = 0; x[3] = 3; x.join(undefined) === "0,,,3". Actual: ' + (x.join(undefined)));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
x = [];
|
||||
x[0] = 0;
|
||||
if (x.join(undefined) !== "0") {
|
||||
|
|
|
@ -7,18 +7,21 @@ esid: sec-array.prototype.join
|
|||
description: Checking this use new Array() and []
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x[0] = undefined;
|
||||
if (x.join() !== "") {
|
||||
throw new Test262Error('#1: x = []; x[0] = undefined; x.join() === "". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
x = [];
|
||||
x[0] = null;
|
||||
if (x.join() !== "") {
|
||||
throw new Test262Error('#2: x = []; x[0] = null; x.join() === "". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
x = Array(undefined, 1, null, 3);
|
||||
if (x.join() !== ",1,,3") {
|
||||
throw new Test262Error('#3: x = Array(undefined,1,null,3); x.join() === ",1,,3". Actual: ' + (x.join()));
|
||||
|
|
|
@ -15,28 +15,34 @@ obj.join = Array.prototype.join;
|
|||
if (obj.length !== undefined) {
|
||||
throw new Test262Error('#0: var obj = {}; obj.length === undefined. Actual: ' + (obj.length));
|
||||
} else {
|
||||
//CHECK#1
|
||||
if (obj.join() !== "") {
|
||||
throw new Test262Error('#1: var obj = {}; obj.join = Array.prototype.join; obj.join() === "". Actual: ' + (obj.join()));
|
||||
}
|
||||
//CHECK#2
|
||||
if (obj.length !== undefined) {
|
||||
throw new Test262Error('#2: var obj = {}; obj.join = Array.prototype.join; obj.join(); obj.length === undefined. Actual: ' + (obj.length));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj.length = undefined;
|
||||
if (obj.join() !== "") {
|
||||
throw new Test262Error('#3: var obj = {}; obj.length = undefined; obj.join = Array.prototype.join; obj.join() === ". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (obj.length !== undefined) {
|
||||
throw new Test262Error('#4: var obj = {}; obj.length = undefined; obj.join = Array.prototype.join; obj.join(); obj.length === undefined. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
obj.length = null
|
||||
if (obj.join() !== "") {
|
||||
throw new Test262Error('#5: var obj = {}; obj.length = null; obj.join = Array.prototype.join; obj.join() === "". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (obj.length !== null) {
|
||||
throw new Test262Error('#6: var obj = {}; obj.length = null; obj.join = Array.prototype.join; obj.join(); obj.length === null. Actual: ' + (obj.length));
|
||||
}
|
||||
|
|
|
@ -12,27 +12,33 @@ description: If ToUint32(length) is zero, return the empty string
|
|||
var obj = {};
|
||||
obj.join = Array.prototype.join;
|
||||
|
||||
//CHECK#1
|
||||
obj.length = NaN;
|
||||
if (obj.join() !== "") {
|
||||
throw new Test262Error('#1: var obj = {}; obj.length = NaN; obj.join = Array.prototype.join; obj.join() === "". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
assert.sameValue(obj.length, NaN, "obj.length is NaN");
|
||||
|
||||
//CHECK#5
|
||||
obj.length = Number.NEGATIVE_INFINITY;
|
||||
if (obj.join() !== "") {
|
||||
throw new Test262Error('#5: var obj = {}; obj.length = Number.NEGATIVE_INFINITY; obj.join = Array.prototype.join; obj.join() === "". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (obj.length !== Number.NEGATIVE_INFINITY) {
|
||||
throw new Test262Error('#6: var obj = {}; obj.length = Number.NEGATIVE_INFINITY; obj.join = Array.prototype.join; obj.join(); obj.length === Number.NEGATIVE_INFINITY. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
obj.length = -0;
|
||||
if (obj.join() !== "") {
|
||||
throw new Test262Error('#7: var obj = {}; obj.length = -0; obj.join = Array.prototype.join; obj.join() === "". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
if (obj.length !== -0) {
|
||||
throw new Test262Error('#8: var obj = {}; obj.length = -0; obj.join = Array.prototype.join; obj.join(); obj.length === 0. Actual: ' + (obj.length));
|
||||
} else {
|
||||
|
@ -41,21 +47,25 @@ if (obj.length !== -0) {
|
|||
}
|
||||
}
|
||||
|
||||
//CHECK#9
|
||||
obj.length = 0.5;
|
||||
if (obj.join() !== "") {
|
||||
throw new Test262Error('#9: var obj = {}; obj.length = 0.5; obj.join = Array.prototype.join; obj.join() === "". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#10
|
||||
if (obj.length !== 0.5) {
|
||||
throw new Test262Error('#10: var obj = {}; obj.length = 0.5; obj.join = Array.prototype.join; obj.join(); obj.length === 0.5. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#11
|
||||
var x = new Number(0);
|
||||
obj.length = x;
|
||||
if (obj.join() !== "") {
|
||||
throw new Test262Error('#11: var x = new Number(0); var obj = {}; obj.length = x; obj.join = Array.prototype.join; obj.join() === "". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#12
|
||||
if (obj.length !== x) {
|
||||
throw new Test262Error('#12: var x = new Number(0); var obj = {}; obj.length = x; obj.join = Array.prototype.join; obj.join(); obj.length === x. Actual: ' + (obj.length));
|
||||
}
|
||||
|
|
|
@ -12,11 +12,13 @@ description: If ToUint32(length) is zero, return the empty string
|
|||
var obj = {};
|
||||
obj.join = Array.prototype.join;
|
||||
|
||||
//CHECK#1
|
||||
obj.length = 4.5;
|
||||
if (obj.join() !== ",,,") {
|
||||
throw new Test262Error('#1: var obj = {}; obj.length = 4.5; obj.join = Array.prototype.join; obj.join() === ",,,". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
obj[0] = undefined;
|
||||
obj[1] = 1;
|
||||
obj[2] = null;
|
||||
|
@ -24,6 +26,7 @@ if (obj.join() !== ",1,,") {
|
|||
throw new Test262Error('#1: var obj = {}; obj.length = 4.5; obj[0] = undefined; obj[1] = 1; obj[2] = null; obj.join = Array.prototype.join; obj.join() === ",1,,". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (obj.length !== 4.5) {
|
||||
throw new Test262Error('#1: var obj = {}; obj.length = 4.5; obj[0] = undefined; obj[1] = 1; obj[2] = null; obj.join = Array.prototype.join; obj.join(); obj.length === 4.5. Actual: ' + (obj.length));
|
||||
}
|
||||
|
@ -31,12 +34,14 @@ if (obj.length !== 4.5) {
|
|||
var obj = {};
|
||||
obj.join = Array.prototype.join;
|
||||
|
||||
//CHECK#4
|
||||
var x = new Number(4.5);
|
||||
obj.length = x;
|
||||
if (obj.join() !== ",,,") {
|
||||
throw new Test262Error('#4: var obj = {}; var x = new Number(4.5); obj.length = x; obj.join = Array.prototype.join; obj.join() === ",,,". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
obj[0] = undefined;
|
||||
obj[1] = 1;
|
||||
obj[2] = null;
|
||||
|
@ -44,6 +49,7 @@ if (obj.join() !== ",1,,") {
|
|||
throw new Test262Error('#5: var obj = {}; var x = new Number(4.5); obj.length = x; obj[0] = undefined; obj[1] = 1; obj[2] = null; obj.join = Array.prototype.join; obj.join() === ",1,,". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (obj.length !== x) {
|
||||
throw new Test262Error('#6: var obj = {}; var x = new Number(4.5); obj.length = x; obj[0] = undefined; obj[1] = 1; obj[2] = null; obj.join = Array.prototype.join; obj.join(); obj.length === x. Actual: ' + (obj.length));
|
||||
}
|
||||
|
|
|
@ -14,82 +14,123 @@ description: >
|
|||
var obj = {};
|
||||
obj.join = Array.prototype.join;
|
||||
|
||||
//CHECK#1
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return 3
|
||||
}
|
||||
};
|
||||
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
|
||||
if (obj.join() !== ",,") {
|
||||
throw new Test262Error('#1: obj.length = {valueOf: function() {return 3}} obj.join() === ",,". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return 3
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return 2
|
||||
}
|
||||
};
|
||||
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
|
||||
if (obj.join() !== ",,") {
|
||||
throw new Test262Error('#2: obj.length = {valueOf: function() {return 3}, toString: function() {return 2}} obj.join() === ",,". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return 3
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
|
||||
if (obj.join() !== ",,") {
|
||||
throw new Test262Error('#3: obj.length = {valueOf: function() {return 3}, toString: function() {return {}}} obj.join() === ",,". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
return 3
|
||||
},
|
||||
toString() {
|
||||
throw new Test262Error();
|
||||
//CHECK#4
|
||||
try {
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
return 3
|
||||
},
|
||||
toString: function() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
if (obj.join() !== ",,") {
|
||||
throw new Test262Error('#4.1: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.join() === ",". Actual: ' + (obj.join()));
|
||||
}
|
||||
};
|
||||
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
|
||||
}
|
||||
catch (e) {
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.join() not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.join() not throw Error. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
obj.length = {
|
||||
toString() {
|
||||
toString: function() {
|
||||
return 2
|
||||
}
|
||||
};
|
||||
assert.sameValue(obj.join(), ",", 'obj.join() must return ","');
|
||||
if (obj.join() !== ",") {
|
||||
throw new Test262Error('#5: obj.length = {toString: function() {return 2}} obj.join() === ",". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return {}
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return 2
|
||||
}
|
||||
}
|
||||
assert.sameValue(obj.join(), ",", 'obj.join() must return ","');
|
||||
if (obj.join() !== ",") {
|
||||
throw new Test262Error('#6: obj.length = {valueOf: function() {return {}}, toString: function() {return 2}} obj.join() === ",". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
assert.throws(Test262Error, () => {
|
||||
//CHECK#7
|
||||
try {
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
throw new Test262Error();
|
||||
valueOf: function() {
|
||||
throw "error"
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return 2
|
||||
}
|
||||
};
|
||||
obj.join();
|
||||
});
|
||||
throw new Test262Error('#7.1: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 2}}; obj.join() throw "error". Actual: ' + (obj.join()));
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 2}}; obj.join() throw "error". Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
//CHECK#8
|
||||
try {
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return {}
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
obj.join();
|
||||
});
|
||||
throw new Test262Error('#8.1: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.join() throw TypeError. Actual: ' + (obj.join()));
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8,2: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.join() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
reportCompare(0, 0);
|
||||
|
|
|
@ -9,36 +9,44 @@ description: >
|
|||
undefind, NaN]
|
||||
---*/
|
||||
|
||||
//CHECK#0
|
||||
var x = new Array(0, 1, 2, 3);
|
||||
if (x.join("") !== "0123") {
|
||||
throw new Test262Error('#0: x = new Array(0,1,2,3); x.join("") === "0123". Actual: ' + (x.join("")));
|
||||
}
|
||||
|
||||
//CHECK#1
|
||||
x = new Array(0, 1, 2, 3);
|
||||
if (x.join("\\") !== "0\\1\\2\\3") {
|
||||
throw new Test262Error('#1: x = new Array(0,1,2,3); x.join("\\") === "0\\1\\2\\3". Actual: ' + (x.join("\\")));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (x.join("&") !== "0&1&2&3") {
|
||||
throw new Test262Error('#2: x = new Array(0,1,2,3); x.join("&") === "0&1&2&3". Actual: ' + (x.join("&")));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (x.join(true) !== "0true1true2true3") {
|
||||
throw new Test262Error('#3: x = new Array(0,1,2,3); x.join(true) === "0true1true2true3". Actual: ' + (x.join(true)));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (x.join(Infinity) !== "0Infinity1Infinity2Infinity3") {
|
||||
throw new Test262Error('#4: x = new Array(0,1,2,3); x.join(Infinity) === "0Infinity1Infinity2Infinity3". Actual: ' + (x.join(Infinity)));
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if (x.join(null) !== "0null1null2null3") {
|
||||
throw new Test262Error('#3: 5 = new Array(0,1,2,3); x.join(null) === "0null1null2null3". Actual: ' + (x.join(null)));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (x.join(undefined) !== "0,1,2,3") {
|
||||
throw new Test262Error('#6: x = new Array(0,1,2,3); x.join(undefined) === "0,1,2,3". Actual: ' + (x.join(undefined)));
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
if (x.join(NaN) !== "0NaN1NaN2NaN3") {
|
||||
throw new Test262Error('#7: x = new Array(0,1,2,3); x.join(NaN) === "0NaN1NaN2NaN3". Actual: ' + (x.join(NaN)));
|
||||
}
|
||||
|
|
|
@ -10,137 +10,139 @@ description: >
|
|||
---*/
|
||||
|
||||
var x = new Array(0, 1, 2, 3);
|
||||
//CHECK#1
|
||||
var object = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return "+"
|
||||
}
|
||||
};
|
||||
if (x.join(object) !== "0[object Object]1[object Object]2[object Object]3") {
|
||||
throw new Test262Error('#1: var object = {valueOf: function() {return "+"}}; x.join(object) === "0[object Object]1[object Object]2[object Object]3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
x.join(object),
|
||||
"0[object Object]1[object Object]2[object Object]3",
|
||||
'x.join({valueOf() {return "+"}}) must return "0[object Object]1[object Object]2[object Object]3"'
|
||||
);
|
||||
|
||||
//CHECK#2
|
||||
var object = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return "+"
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
if (x.join(object) !== "0*1*2*3") {
|
||||
throw new Test262Error('#2: var object = {valueOf: function() {return "+"}, toString: function() {return "*"}}; x.join(object) === "0*1*2*3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
x.join(object),
|
||||
"0*1*2*3",
|
||||
'x.join("{valueOf() {return "+"}, toString() {return "*"}}) must return "0*1*2*3"'
|
||||
);
|
||||
|
||||
//CHECK#3
|
||||
var object = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return "+"
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
if (x.join(object) !== "0+1+2+3") {
|
||||
throw new Test262Error('#3: var object = {valueOf: function() {return "+"}, toString: function() {return {}}}; x.join(object) === "0+1+2+3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
x.join(object),
|
||||
"0+1+2+3",
|
||||
'x.join({valueOf() {return "+"}, toString() {return {}}}) must return "0+1+2+3"'
|
||||
);
|
||||
|
||||
//CHECK#4
|
||||
try {
|
||||
var object = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
throw "error"
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(
|
||||
x.join(object),
|
||||
"0*1*2*3",
|
||||
'x.join("{valueOf() {throw "error"}, toString() {return "*"}}) must return "0*1*2*3"'
|
||||
);
|
||||
if (x.join(object) !== "0*1*2*3") {
|
||||
throw new Test262Error('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}}; x.join(object) === "0*1*2*3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}}; x.join(object) not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}}; x.join(object) not throw Error. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
var object = {
|
||||
toString() {
|
||||
toString: function() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
assert.sameValue(x.join(object), "0*1*2*3", 'x.join({toString() {return "*"}}) must return "0*1*2*3"');
|
||||
if (x.join(object) !== "0*1*2*3") {
|
||||
throw new Test262Error('#5: var object = {toString: function() {return "*"}}; x.join(object) === "0*1*2*3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
var object = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return {}
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return "*"
|
||||
}
|
||||
}
|
||||
if (x.join(object) !== "0*1*2*3") {
|
||||
throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return "*"}}; x.join(object) === "0*1*2*3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
x.join(object),
|
||||
"0*1*2*3",
|
||||
'x.join({valueOf() {return {}}, toString() {return "*"}}) must return "0*1*2*3"'
|
||||
);
|
||||
|
||||
//CHECK#7
|
||||
try {
|
||||
var object = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return "+"
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
x.join(object);
|
||||
throw new Test262Error('#7.1: var object = {valueOf() {return "+"}, toString() {throw "error"}}; x.join(object) throw "error". Actual: ' + (x.join(object)));
|
||||
throw new Test262Error('#7.1: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}}; x.join(object) throw "error". Actual: ' + (x.join(object)));
|
||||
}
|
||||
catch (e) {
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}}; x.join(object) throw "error". Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
try {
|
||||
var object = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return {}
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
x.join(object);
|
||||
throw new Test262Error('#8.1: var object = {valueOf() {return {}}, toString() {return {}}}; x.join(object) throw TypeError. Actual: ' + (x.join(object)));
|
||||
throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; x.join(object) throw TypeError. Actual: ' + (x.join(object)));
|
||||
}
|
||||
catch (e) {
|
||||
assert.sameValue(
|
||||
e instanceof TypeError,
|
||||
true,
|
||||
'The result of evaluating (e instanceof TypeError) is expected to be true'
|
||||
);
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; x.join(object) throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#9
|
||||
try {
|
||||
var object = {
|
||||
toString() {
|
||||
toString: function() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
[].join(object);
|
||||
throw new Test262Error('#9.1: var object = {toString() {throw "error"}}; [].join(object) throw "error". Actual: ' + ([].join(object)));
|
||||
throw new Test262Error('#9.1: var object = {toString: function() {throw "error"}}; [].join(object) throw "error". Actual: ' + ([].join(object)));
|
||||
}
|
||||
catch (e) {
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#9.2: var object = {toString: function() {throw "error"}}; [].join(object) throw "error". Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
reportCompare(0, 0);
|
||||
|
|
|
@ -9,41 +9,49 @@ description: >
|
|||
Infinity, null, undefind, NaN]
|
||||
---*/
|
||||
|
||||
//CHECK#0
|
||||
var x = new Array("", "", "");
|
||||
if (x.join("") !== "") {
|
||||
throw new Test262Error('#0: var x = new Array("","",""); x.join("") === "". Actual: ' + (x.join("")));
|
||||
}
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array("\\", "\\", "\\");
|
||||
if (x.join("\\") !== "\\\\\\\\\\") {
|
||||
throw new Test262Error('#1: var x = new Array("\\","\\","\\"); x.join("\\") === "\\\\\\\\\\". Actual: ' + (x.join("\\")));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var x = new Array("&", "&", "&");
|
||||
if (x.join("&") !== "&&&&&") {
|
||||
throw new Test262Error('#2: var x = new Array("&", "&", "&"); x.join("&") === "&&&&&". Actual: ' + (x.join("&")));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
var x = new Array(true, true, true);
|
||||
if (x.join() !== "true,true,true") {
|
||||
throw new Test262Error('#3: var x = new Array(true,true,true); x.join(true,true,true) === "true,true,true". Actual: ' + (x.join(true, true, true)));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
var x = new Array(null, null, null);
|
||||
if (x.join() !== ",,") {
|
||||
throw new Test262Error('#4: var x = new Array(null,null,null); x.join(null,null,null) === ",,". Actual: ' + (x.join(null, null, null)));
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
var x = new Array(undefined, undefined, undefined);
|
||||
if (x.join() !== ",,") {
|
||||
throw new Test262Error('#5: var x = new Array(undefined,undefined,undefined); x.join(undefined,undefined,undefined) === ",,". Actual: ' + (x.join(undefined, undefined, undefined)));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
var x = new Array(Infinity, Infinity, Infinity);
|
||||
if (x.join() !== "Infinity,Infinity,Infinity") {
|
||||
throw new Test262Error('#6: var x = new Array(Infinity,Infinity,Infinity); x.join(Infinity,Infinity,Infinity) === "Infinity,Infinity,Infinity". Actual: ' + (x.join(Infinity, Infinity, Infinity)));
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
var x = new Array(NaN, NaN, NaN);
|
||||
if (x.join() !== "NaN,NaN,NaN") {
|
||||
throw new Test262Error('#7: var x = new Array(NaN,NaN,NaN); x.join(NaN,NaN,NaN) === "NaN,NaN,NaN". Actual: ' + (x.join(NaN, NaN, NaN)));
|
||||
|
|
|
@ -7,14 +7,18 @@ esid: sec-array.prototype.join
|
|||
description: If Type(argument) is Object, evaluate ToPrimitive(argument, String)
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
return "+"
|
||||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
assert.sameValue(x.join(), "[object Object]", 'x.join() must return "[object Object]"');
|
||||
if (x.join() !== "[object Object]") {
|
||||
throw new Test262Error('#1: var object = {valueOf: function() {return "+"}} var x = new Array(object); x.join() === "[object Object]". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
return "+"
|
||||
|
@ -24,8 +28,11 @@ var object = {
|
|||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
|
||||
if (x.join() !== "*") {
|
||||
throw new Test262Error('#2: var object = {valueOf: function() {return "+"}, toString: function() {return "*"}} var x = new Array(object); x.join() === "*". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
return "+"
|
||||
|
@ -35,8 +42,11 @@ var object = {
|
|||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
assert.sameValue(x.join(), "+", 'x.join() must return "+"');
|
||||
if (x.join() !== "+") {
|
||||
throw new Test262Error('#3: var object = {valueOf: function() {return "+"}, toString: function() {return {}}} var x = new Array(object); x.join() === "+". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
try {
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
|
@ -47,20 +57,30 @@ try {
|
|||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
|
||||
if (x.join() !== "*") {
|
||||
throw new Test262Error('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}} var x = new Array(object); x.join() === "*". Actual: ' + (x.join()));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}} var x = new Array(object); x.join() not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}} var x = new Array(object); x.join() not throw Error. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
var object = {
|
||||
toString: function() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
|
||||
if (x.join() !== "*") {
|
||||
throw new Test262Error('#5: var object = {toString: function() {return "*"}} var x = new Array(object); x.join() === "*". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
return {}
|
||||
|
@ -70,8 +90,11 @@ var object = {
|
|||
}
|
||||
}
|
||||
var x = new Array(object);
|
||||
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
|
||||
if (x.join() !== "*") {
|
||||
throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return "*"}} var x = new Array(object); x.join() === "*". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
try {
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
|
@ -86,9 +109,12 @@ try {
|
|||
throw new Test262Error('#7.1: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}} var x = new Array(object); x.join() throw "error". Actual: ' + (x.join()));
|
||||
}
|
||||
catch (e) {
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}} var x = new Array(object); x.join() throw "error". Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
try {
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
|
@ -103,11 +129,9 @@ try {
|
|||
throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}} var x = new Array(object); x.join() throw TypeError. Actual: ' + (x.join()));
|
||||
}
|
||||
catch (e) {
|
||||
assert.sameValue(
|
||||
e instanceof TypeError,
|
||||
true,
|
||||
'The result of evaluating (e instanceof TypeError) is expected to be true'
|
||||
);
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}} var x = new Array(object); x.join() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
reportCompare(0, 0);
|
||||
|
|
|
@ -14,10 +14,12 @@ obj[1] = "y";
|
|||
obj[2] = "z";
|
||||
obj.length = -4294967294;
|
||||
|
||||
//CHECK#1
|
||||
if (obj.join("") !== "") {
|
||||
throw new Test262Error('#1: var obj = {}; obj.join = Array.prototype.join; obj[0] = "x"; obj[1] = "y"; obj[2] = "z"; obj.length = -4294967294; obj.join("") === "". Actual: ' + (obj.join("")));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (obj.length !== -4294967294) {
|
||||
throw new Test262Error('#2: var obj = {}; obj.join = Array.prototype.join; obj[0] = "x"; obj[1] = "y"; obj[2] = "z"; obj.length = -4294967294; obj.join(""); obj.length === -4294967294. Actual: ' + (obj.length));
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ description: >
|
|||
of Array.prototype is Object.prototype
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype[1] = 1;
|
||||
var x = [0];
|
||||
x.length = 2;
|
||||
|
@ -16,6 +17,7 @@ if (x.join() !== "0,1") {
|
|||
throw new Test262Error('#1: Array.prototype[1] = 1; x = [0]; x.length = 2; x.join() === "0,1". Actual: ' + (x.join()));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
Object.prototype[1] = 1;
|
||||
Object.prototype.length = 2;
|
||||
Object.prototype.join = Array.prototype.join;
|
||||
|
|
|
@ -7,6 +7,7 @@ esid: sec-array.prototype.join
|
|||
description: Checking Array.prototype.join.prototype
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.join.prototype !== undefined) {
|
||||
throw new Test262Error('#1: Array.prototype.join.prototype === undefined. Actual: ' + (Array.prototype.join.prototype));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The join property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.join
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
|
||||
try {
|
||||
new Array.prototype.join();
|
||||
throw new Test262Error('#1.1: new Array.prototype.join() throw TypeError. Actual: ' + (new Array.prototype.join()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.join() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -1,78 +0,0 @@
|
|||
// |reftest| skip -- resizable-arraybuffer is not supported
|
||||
// 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.map
|
||||
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 finalResult, expectedElements, expectedIndices, expectedArrays;
|
||||
var elements, indices, arrays, result;
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.map.call(sample, function(element, index, array) {
|
||||
if (elements.length === 0) {
|
||||
try {
|
||||
buffer.resize(2 * BPE);
|
||||
finalResult = undefined;
|
||||
expectedElements = [0, 0];
|
||||
expectedIndices = [0, 1];
|
||||
expectedArrays = [sample, sample];
|
||||
} catch (_) {
|
||||
finalResult = 2;
|
||||
expectedElements = [0, 0, 0];
|
||||
expectedIndices = [0, 1, 2];
|
||||
expectedArrays = [sample, sample, sample];
|
||||
}
|
||||
}
|
||||
|
||||
elements.push(element);
|
||||
indices.push(index);
|
||||
arrays.push(array);
|
||||
|
||||
return index;
|
||||
});
|
||||
|
||||
assert.compareArray(elements, expectedElements, 'elements (shrink)');
|
||||
assert.compareArray(indices, expectedIndices, 'indices (shrink)');
|
||||
assert.compareArray(arrays, expectedArrays, 'arrays (shrink)');
|
||||
assert.compareArray(result, [0, 1, finalResult], 'result (shrink)');
|
||||
|
||||
elements = [];
|
||||
indices = [];
|
||||
arrays = [];
|
||||
result = Array.prototype.map.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 index;
|
||||
});
|
||||
|
||||
assert.compareArray(elements, expectedElements, 'elements (grow)');
|
||||
assert.compareArray(indices, expectedIndices, 'indices (grow)');
|
||||
assert.compareArray(arrays, expectedArrays, 'arrays (grow)');
|
||||
assert.compareArray(result, expectedIndices, 'result (grow)');
|
||||
});
|
||||
|
||||
reportCompare(0, 0);
|
|
@ -1,124 +0,0 @@
|
|||
// 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:
|
||||
- typedArrayConstructors
|
||||
- floatArrayConstructors
|
||||
- intArrayConstructors
|
||||
- TypedArray
|
||||
- testWithTypedArrayConstructors
|
||||
- testWithAtomicsFriendlyTypedArrayConstructors
|
||||
- testWithNonAtomicsFriendlyTypedArrayConstructors
|
||||
- testTypedArrayConversions
|
||||
---*/
|
||||
|
||||
/**
|
||||
* Array containing every typed array constructor.
|
||||
*/
|
||||
var typedArrayConstructors = [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Int32Array,
|
||||
Int16Array,
|
||||
Int8Array,
|
||||
Uint32Array,
|
||||
Uint16Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray
|
||||
];
|
||||
|
||||
var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
|
||||
var intArrayConstructors = typedArrayConstructors.slice(2, 7);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Uint8ClampedArray
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -9,16 +9,19 @@ esid: sec-array.prototype.pop
|
|||
description: Checking this algorithm
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array();
|
||||
var pop = x.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#1: var x = new Array(); x.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (x.length !== 0) {
|
||||
throw new Test262Error('#2: var x = new Array(); x.pop(); x.length === 0. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
var x = Array(1, 2, 3);
|
||||
x.length = 0;
|
||||
var pop = x.pop();
|
||||
|
@ -26,6 +29,7 @@ if (pop !== undefined) {
|
|||
throw new Test262Error('#2: var x = Array(1,2,3); x.length = 0; x.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (x.length !== 0) {
|
||||
throw new Test262Error('#4: var x = new Array(1,2,3); x.length = 0; x.pop(); x.length === 0. Actual: ' + (x.length));
|
||||
}
|
||||
|
|
|
@ -9,24 +9,29 @@ esid: sec-array.prototype.pop
|
|||
description: Checking this use new Array() and []
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array(0, 1, 2, 3);
|
||||
var pop = x.pop();
|
||||
if (pop !== 3) {
|
||||
throw new Test262Error('#1: x = new Array(0,1,2,3); x.pop() === 3. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (x.length !== 3) {
|
||||
throw new Test262Error('#2: x = new Array(0,1,2,3); x.pop(); x.length == 3');
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (x[3] !== undefined) {
|
||||
throw new Test262Error('#3: x = new Array(0,1,2,3); x.pop(); x[3] == undefined');
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (x[2] !== 2) {
|
||||
throw new Test262Error('#4: x = new Array(0,1,2,3); x.pop(); x[2] == 2');
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
x = [];
|
||||
x[0] = 0;
|
||||
x[3] = 3;
|
||||
|
@ -35,24 +40,29 @@ if (pop !== 3) {
|
|||
throw new Test262Error('#5: x = []; x[0] = 0; x[3] = 3; x.pop() === 3. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (x.length !== 3) {
|
||||
throw new Test262Error('#6: x = []; x[0] = 0; x[3] = 3; x.pop(); x.length == 3');
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
if (x[3] !== undefined) {
|
||||
throw new Test262Error('#7: x = []; x[0] = 0; x[3] = 3; x.pop(); x[3] == undefined');
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
if (x[2] !== undefined) {
|
||||
throw new Test262Error('#8: x = []; x[0] = 0; x[3] = 3; x.pop(); x[2] == undefined');
|
||||
}
|
||||
|
||||
//CHECK#9
|
||||
x.length = 1;
|
||||
var pop = x.pop();
|
||||
if (pop !== 0) {
|
||||
throw new Test262Error('#9: x = []; x[0] = 0; x[3] = 3; x.pop(); x.length = 1; x.pop() === 0. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#10
|
||||
if (x.length !== 0) {
|
||||
throw new Test262Error('#10: x = []; x[0] = 0; x[3] = 3; x.pop(); x.length = 1; x.pop(); x.length === 0. Actual: ' + (x.length));
|
||||
}
|
||||
|
|
|
@ -17,31 +17,37 @@ obj.pop = Array.prototype.pop;
|
|||
if (obj.length !== undefined) {
|
||||
throw new Test262Error('#0: var obj = {}; obj.length === undefined. Actual: ' + (obj.length));
|
||||
} else {
|
||||
//CHECK#1
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#1: var obj = {}; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
//CHECK#2
|
||||
if (obj.length !== 0) {
|
||||
throw new Test262Error('#2: var obj = {}; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj.length = undefined;
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#3: var obj = {}; obj.length = undefined; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (obj.length !== 0) {
|
||||
throw new Test262Error('#4: var obj = {}; obj.length = undefined; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
obj.length = null
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#5: var obj = {}; obj.length = null; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (obj.length !== 0) {
|
||||
throw new Test262Error('#6: var obj = {}; obj.length = null; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
|
|
|
@ -14,42 +14,50 @@ description: >
|
|||
var obj = {};
|
||||
obj.pop = Array.prototype.pop;
|
||||
|
||||
//CHECK#1
|
||||
obj.length = NaN;
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#1: var obj = {}; obj.length = NaN; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (obj.length !== 0) {
|
||||
throw new Test262Error('#2: var obj = {}; obj.length = NaN; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj.length = Number.POSITIVE_INFINITY;
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#3: var obj = {}; obj.length = Number.POSITIVE_INFINITY; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (obj.length !== 9007199254740990) {
|
||||
throw new Test262Error('#4: var obj = {}; obj.length = Number.POSITIVE_INFINITY; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 9007199254740990. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
obj.length = Number.NEGATIVE_INFINITY;
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#5: var obj = {}; obj.length = Number.NEGATIVE_INFINITY; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (obj.length !== 0) {
|
||||
throw new Test262Error('#6: var obj = {}; obj.length = Number.NEGATIVE_INFINITY; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
obj.length = -0;
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#7: var obj = {}; obj.length = -0; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
if (obj.length !== 0) {
|
||||
throw new Test262Error('#8: var obj = {}; obj.length = -0; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 0. Actual: ' + (obj.length));
|
||||
} else {
|
||||
|
@ -58,22 +66,26 @@ if (obj.length !== 0) {
|
|||
}
|
||||
}
|
||||
|
||||
//CHECK#9
|
||||
obj.length = 0.5;
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#9: var obj = {}; obj.length = 0.5; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#10
|
||||
if (obj.length !== 0) {
|
||||
throw new Test262Error('#10: var obj = {}; obj.length = 0.5; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#11
|
||||
obj.length = new Number(0);
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#11: var obj = {}; obj.length = new Number(0); obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#12
|
||||
if (obj.length !== 0) {
|
||||
throw new Test262Error('#12: var obj = {}; obj.length = new Number(0); obj.pop = Array.prototype.pop; obj.pop(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
|
|
|
@ -14,22 +14,26 @@ description: >
|
|||
var obj = {};
|
||||
obj.pop = Array.prototype.pop;
|
||||
|
||||
//CHECK#1
|
||||
obj.length = 2.5;
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#1: var obj = {}; obj.length = 2.5; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (obj.length !== 1) {
|
||||
throw new Test262Error('#2: var obj = {}; obj.length = 2.5; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 1. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj.length = new Number(2);
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#11: var obj = {}; obj.length = new Number(2); obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (obj.length !== 1) {
|
||||
throw new Test262Error('#12: var obj = {}; obj.length = new Number(2); obj.pop = Array.prototype.pop; obj.pop(); obj.length === 1. Actual: ' + (obj.length));
|
||||
}
|
||||
|
|
|
@ -14,113 +14,137 @@ description: >
|
|||
var obj = {};
|
||||
obj.pop = Array.prototype.pop;
|
||||
|
||||
//CHECK#1
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return 1
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
assert.sameValue(pop, -1, 'The value of pop is expected to be -1');
|
||||
if (pop !== -1) {
|
||||
throw new Test262Error('#1: obj[0] = -1; obj.length = {valueOf: function() {return 1}} obj.pop() === -1. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return 1
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return 0
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
assert.sameValue(pop, -1, 'The value of pop is expected to be -1');
|
||||
if (pop !== -1) {
|
||||
throw new Test262Error('#0: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {return 0}} obj.pop() === -1. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return 1
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
assert.sameValue(pop, -1, 'The value of pop is expected to be -1');
|
||||
if (pop !== -1) {
|
||||
throw new Test262Error('#3: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {return {}}} obj.pop() === -1. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return 1
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
assert.sameValue(pop, -1, 'The value of pop is expected to be -1');
|
||||
if (pop !== -1) {
|
||||
throw new Test262Error('#4.1: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.pop() === ",". Actual: ' + (pop));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.pop() not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.pop() not throw Error. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
toString() {
|
||||
toString: function() {
|
||||
return 0
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
assert.sameValue(pop, undefined, 'The value of pop is expected to equal undefined');
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#5: obj[0] = -1; obj.length = {toString: function() {return 0}} obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return {}
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
var pop = obj.pop();
|
||||
assert.sameValue(pop, undefined, 'The value of pop is expected to equal undefined');
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#6: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return 0}} obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
throw "error"
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return 0
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
throw new Test262Error('#7.1: obj[0] = -1; obj.length = {valueOf() {throw "error"}, toString() {return 0}}; obj.pop() throw "error". Actual: ' + (pop));
|
||||
throw new Test262Error('#7.1: obj[0] = -1; obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}}; obj.pop() throw "error". Actual: ' + (pop));
|
||||
}
|
||||
catch (e) {
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: obj[0] = -1; obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}}; obj.pop() throw "error". Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf() {
|
||||
valueOf: function() {
|
||||
return {}
|
||||
},
|
||||
toString() {
|
||||
toString: function() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
throw new Test262Error('#8.1: obj[0] = -1; obj.length = {valueOf() {return {}}, toString() {return {}}} obj.pop() throw TypeError. Actual: ' + (pop));
|
||||
throw new Test262Error('#8.1: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.pop() throw TypeError. Actual: ' + (pop));
|
||||
}
|
||||
catch (e) {
|
||||
assert.sameValue(
|
||||
e instanceof TypeError,
|
||||
true,
|
||||
'The result of evaluating (e instanceof TypeError) is expected to be true'
|
||||
);
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8.2: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.pop() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
|
||||
reportCompare(0, 0);
|
||||
|
|
|
@ -13,19 +13,23 @@ obj[0] = "x";
|
|||
obj[4294967295] = "y";
|
||||
obj.length = 4294967296;
|
||||
|
||||
//CHECK#1
|
||||
var pop = obj.pop();
|
||||
if (pop !== "y") {
|
||||
throw new Test262Error('#1: var obj = {}; obj.pop = Array.prototype.pop; obj[0] = "x"; obj[4294967295] = "y"; obj.length = 4294967296; obj.pop() === "y". Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (obj.length !== 4294967295) {
|
||||
throw new Test262Error('#2: var obj = {}; obj.pop = Array.prototype.pop; obj[0] = "x"; obj[4294967295] = "y"; obj.length = 4294967296; obj.pop(); obj.length === 4294967295. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (obj[0] !== "x") {
|
||||
throw new Test262Error('#3: var obj = {}; obj.pop = Array.prototype.pop; obj[0] = "x"; obj[4294967295] = "y"; obj.length = 4294967296; obj.pop(); obj[0] === "x". Actual: ' + (obj[0]));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (obj[4294967295] !== undefined) {
|
||||
throw new Test262Error('#4: var obj = {}; obj.pop = Array.prototype.pop; obj[0] = "x"; obj[4294967295] = "y"; obj.length = 4294967296; obj.pop(); obj[4294967295] === undefined. Actual: ' + (obj[4294967295]));
|
||||
}
|
||||
|
|
|
@ -13,19 +13,23 @@ obj[0] = "x";
|
|||
obj[4294967296] = "y";
|
||||
obj.length = 4294967297;
|
||||
|
||||
//CHECK#1
|
||||
var pop = obj.pop();
|
||||
if (pop !== "y") {
|
||||
throw new Test262Error('#1: var obj = {}; obj.pop = Array.prototype.pop; obj[0] = "x"; obj[4294967296] = "y"; obj.length = 4294967297; obj.pop() === "y". Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (obj.length !== 4294967296) {
|
||||
throw new Test262Error('#2: var obj = {}; obj.pop = Array.prototype.pop; obj[0] = "x"; obj[4294967296] = "y"; obj.length = 4294967297; obj.pop(); obj.length === 4294967296. Actual: ' + (obj.length));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (obj[0] !== "x") {
|
||||
throw new Test262Error('#3: var obj = {}; obj.pop = Array.prototype.pop; obj[0] = "x"; obj[4294967296] = "y"; obj.length = 4294967297; obj.pop(); obj[0] === "x". Actual: ' + (obj[0]));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (obj[4294967296] !== undefined) {
|
||||
throw new Test262Error('#4: var obj = {}; obj.pop = Array.prototype.pop; obj[0] = "x"; obj[4294967296] = "y"; obj.length = 4294967297; obj.pop(); obj[4294967296] === undefined. Actual: ' + (obj[4294967296]));
|
||||
}
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче