Merge autoland to mozilla-central. a=merge

This commit is contained in:
Cristian Tuns 2022-04-08 11:55:38 -04:00
Родитель 5444611211 20f36004f4
Коммит 9f4a78b8b9
8019 изменённых файлов: 324950 добавлений и 28890 удалений

Просмотреть файл

@ -10,6 +10,5 @@
// https://drafts.csswg.org/css-conditional/#the-cssconditionrule-interface
[Exposed=Window]
interface CSSConditionRule : CSSGroupingRule {
[SetterThrows]
attribute UTF8String conditionText;
readonly attribute UTF8String conditionText;
};

Просмотреть файл

@ -0,0 +1,14 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-contain-3/#the-csscontainerrule-interface
*/
// https://drafts.csswg.org/css-contain-3/#the-csscontainerrule-interface
[Exposed=Window, Pref="layout.css.container-queries.enabled"]
interface CSSContainerRule : CSSConditionRule {
};

Просмотреть файл

@ -11,7 +11,8 @@ enum CaretChangedReason {
"taponcaret",
"presscaret",
"releasecaret",
"scroll"
"scroll",
"dragcaret"
};
dictionary CaretStateChangedEventInit : EventInit {
@ -23,6 +24,8 @@ dictionary CaretStateChangedEventInit : EventInit {
boolean selectionVisible = false;
boolean selectionEditable = false;
DOMString selectedTextContent = "";
long clientX = 0;
long clientY = 0;
};
[ChromeOnly,
@ -40,4 +43,8 @@ interface CaretStateChangedEvent : Event {
readonly attribute boolean selectionVisible;
readonly attribute boolean selectionEditable;
readonly attribute DOMString selectedTextContent;
[Pref="layout.accessiblecaret.magnifier.enabled"]
readonly attribute long clientX;
[Pref="layout.accessiblecaret.magnifier.enabled"]
readonly attribute long clientY;
};

Просмотреть файл

@ -475,6 +475,7 @@ WEBIDL_FILES = [
"CSS.webidl",
"CSSAnimation.webidl",
"CSSConditionRule.webidl",
"CSSContainerRule.webidl",
"CSSCounterStyleRule.webidl",
"CSSFontFaceRule.webidl",
"CSSFontFeatureValuesRule.webidl",

Просмотреть файл

@ -606,6 +606,34 @@ 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 #
@ -637,112 +665,12 @@ 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
# Not yet updated for https://github.com/tc39/proposal-intl-numberformat-v3/pull/92
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
skip script test262/intl402/NumberFormat/test-option-useGrouping-extended.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
# Missing "SharedArrayBuffer" features tag
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/prop-desc.js
##############################################

Просмотреть файл

@ -25,13 +25,16 @@ UNSUPPORTED_FEATURES = set(
"Intl.DateTimeFormat-quarter",
"Intl.Segmenter",
"Intl.Locale-info",
"Intl.DurationFormat",
"Atomics.waitAsync",
"legacy-regexp",
"json-modules",
"resizable-arraybuffer",
"Temporal",
"callable-boundary-realms",
"ShadowRealm",
"array-find-from-last",
"array-grouping",
"regexp-v-flag",
]
)
FEATURE_CHECK_NEEDED = {
@ -40,7 +43,11 @@ FEATURE_CHECK_NEEDED = {
"SharedArrayBuffer": "!this.hasOwnProperty('SharedArrayBuffer')",
"WeakRef": "!this.hasOwnProperty('WeakRef')",
}
RELEASE_OR_BETA = set([])
RELEASE_OR_BETA = set(
[
"Intl.NumberFormat-v3",
]
)
SHELL_OPTIONS = {
"import-assertions": "--enable-import-assertions",
}
@ -852,7 +859,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Update the test262 test suite.")
parser.add_argument(
"--url",
default="git://github.com/tc39/test262.git",
default="https://github.com/tc39/test262.git",
help="URL to git repository (default: %(default)s)",
)
parser.add_argument(

Просмотреть файл

@ -1,9 +1,8 @@
commit 45a913c057892bdd26f7bc06a59a0c7420f2d3ec
Author: Philip Chimento <pchimento@igalia.com>
Date: Wed Aug 11 12:31:23 2021 -0700
commit d7c0a2076c2b0c1531aef7069d4abe70eec44ee3
Author: Shu-yu Guo <syg@chromium.org>
Date: Mon Apr 4 16:36:56 2022 -0700
Add branding tests from Temporal (#3138)
Remove check for per-comparator call detach check in TypedArray.prototype.sort
Closes: #3137
Co-authored-by: Ms2ger <Ms2ger@igalia.com>
This updates tests in line with the normative change in
https://github.com/tc39/ecma262/pull/2723

Просмотреть файл

@ -21,7 +21,7 @@ assert.throws(
);
assert.throws(
TypeError,
other.TypeError,
function () {
other.RegExp.prototype.compile.call(regexp);
},

Просмотреть файл

@ -12,7 +12,6 @@ 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,12 +10,10 @@ 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,12 +7,10 @@ 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,7 +12,6 @@ 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,7 +12,6 @@ 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,12 +10,10 @@ 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,12 +7,10 @@ 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,7 +12,6 @@ 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,7 +9,6 @@ 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,12 +11,10 @@ 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,19 +9,16 @@ 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,16 +9,13 @@ 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,12 +9,10 @@ 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,23 +10,18 @@ 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,12 +10,10 @@ 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,19 +9,15 @@ 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,12 +11,10 @@ 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,7 +11,6 @@ description: >
is an array index
---*/
//CHECK#1
var x = [];
x[1] = 1;
x[3] = 3;
@ -21,15 +20,12 @@ 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,12 +9,10 @@ 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,7 +9,6 @@ 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,12 +9,10 @@ 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,13 +9,11 @@ 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,13 +9,11 @@ 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,17 +9,14 @@ 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,17 +9,14 @@ 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,7 +9,6 @@ es5id: 15.4_A1.1_T9
description: If Type(value) is Object, evaluate ToPrimitive(value, String)
---*/
//CHECK#1
var x = [];
var object = {
valueOf: function() {
@ -19,7 +18,6 @@ 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() {
@ -32,7 +30,6 @@ 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() {
@ -45,7 +42,6 @@ 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 = {
@ -63,7 +59,6 @@ catch (e) {
assert.notSameValue(e, "error", 'The value of e is not "error"');
}
//CHECK#5
x = [];
var object = {
toString: function() {
@ -73,7 +68,6 @@ 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() {
@ -86,7 +80,6 @@ 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 = {
@ -104,7 +97,6 @@ catch (e) {
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
}
//CHECK#8
try {
x = [];
var object = {

Просмотреть файл

@ -3,8 +3,7 @@
/*---
description: Testing descriptor property of Array.from
includes:
- propertyHelper.js
includes: [propertyHelper.js]
esid: sec-array.from
---*/

Просмотреть файл

@ -0,0 +1,41 @@
// 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,8 +3,7 @@
/*---
description: Testing descriptor property of Array.isArray
includes:
- propertyHelper.js
includes: [propertyHelper.js]
esid: sec-array.isarray
---*/

Просмотреть файл

@ -13,7 +13,6 @@ 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,7 +11,6 @@ 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,7 +8,6 @@ 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,15 +10,12 @@ 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,7 +10,6 @@ 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)));
@ -22,7 +21,6 @@ try {
);
}
//CHECK#2
try {
new Array(4294967296);
throw new Test262Error('#2.1: new Array(4294967296) throw RangeError. Actual: ' + (new Array(4294967296)));
@ -34,7 +32,6 @@ try {
);
}
//CHECK#3
try {
new Array(4294967297);
throw new Test262Error('#3.1: new Array(4294967297) throw RangeError. Actual: ' + (new Array(4294967297)));

Просмотреть файл

@ -10,7 +10,6 @@ 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)));
@ -22,7 +21,6 @@ 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)));
@ -34,7 +32,6 @@ 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,7 +10,6 @@ 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)));
@ -22,7 +21,6 @@ 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)));
@ -34,7 +32,6 @@ 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,7 +8,6 @@ es5id: 15.4.5.1_A1.1_T1
description: length in [4294967296, -1, 1.5]
---*/
//CHECK#1
try {
var x = [];
x.length = 4294967296;
@ -21,7 +20,6 @@ try {
);
}
//CHECK#2
try {
x = [];
x.length = -1;
@ -34,7 +32,6 @@ try {
);
}
//CHECK#3
try {
x = [];
x.length = 1.5;

Просмотреть файл

@ -8,7 +8,6 @@ es5id: 15.4.5.1_A1.1_T2
description: length in [NaN, Infinity, -Infinity, undefined]
---*/
//CHECK#1
try {
var x = [];
x.length = NaN;
@ -21,7 +20,6 @@ try {
);
}
//CHECK#2
try {
x = [];
x.length = Number.POSITIVE_INFINITY;
@ -34,7 +32,6 @@ try {
);
}
//CHECK#3
try {
x = [];
x.length = Number.NEGATIVE_INFINITY;
@ -47,7 +44,6 @@ try {
);
}
//CHECK#4
try {
x = [];
x.length = undefined;

Просмотреть файл

@ -12,12 +12,10 @@ 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,13 +12,11 @@ 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,32 +8,26 @@ 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,7 +8,6 @@ es5id: 15.4.5.1_A1.3_T2
description: Uint32 use ToNumber and ToPrimitve
---*/
//CHECK#1
var x = [];
x.length = {
valueOf: function() {
@ -17,7 +16,6 @@ x.length = {
};
assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
//CHECK#2
x = [];
x.length = {
valueOf: function() {
@ -29,7 +27,6 @@ x.length = {
};
assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
//CHECK#3
x = [];
x.length = {
valueOf: function() {
@ -41,7 +38,6 @@ x.length = {
};
assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
//CHECK#4
try {
x = [];
x.length = {
@ -58,7 +54,6 @@ catch (e) {
assert.notSameValue(e, "error", 'The value of e is not "error"');
}
//CHECK#5
x = [];
x.length = {
toString: function() {
@ -67,7 +62,6 @@ x.length = {
};
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
//CHECK#6
x = [];
x.length = {
valueOf: function() {
@ -79,7 +73,6 @@ x.length = {
}
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
//CHECK#7
try {
x = [];
x.length = {
@ -97,7 +90,6 @@ catch (e) {
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
}
//CHECK#8
try {
x = [];
x.length = {

Просмотреть файл

@ -12,7 +12,6 @@ description: >
is an array index
---*/
//CHECK#1
var x = [0, 1, 2];
x[4294967294] = 4294967294;
x.length = 2;

Просмотреть файл

@ -0,0 +1,34 @@
// |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);

Просмотреть файл

@ -0,0 +1,34 @@
// |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,4 +1,3 @@
// |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.
/*---
@ -14,17 +13,16 @@ info: |
4. Perform CreateDataProperty(unscopableList, "fill", true).
5. Perform CreateDataProperty(unscopableList, "find", true).
6. Perform CreateDataProperty(unscopableList, "findIndex", true).
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.
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.
includes: [propertyHelper.js]
features: [Symbol.unscopables, array-find-from-last]
features: [Symbol.unscopables]
---*/
var unscopables = Array.prototype[Symbol.unscopables];
@ -56,17 +54,6 @@ 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,22 +16,13 @@ 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]),
'compareArray([].concat(ta, ta), [ta, ta]) must return true'
);
assert.compareArray([].concat(ta, ta), [ta, ta]);
ta[Symbol.isConcatSpreadable] = true;
assert.compareArray([].concat(ta), items, '[].concat(new type(items)) returns items');
assert.compareArray([].concat(ta), items);
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'
);
assert.compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]);
ta_by_len[Symbol.isConcatSpreadable] = true;
assert(
compareArray([].concat(ta_by_len), items),
'compareArray([].concat(ta_by_len), items) must return true'
);
assert.compareArray([].concat(ta_by_len), items);
// TypedArray with fake `length`.
ta = new type(1);
@ -43,7 +34,7 @@ function concatTypedArray(type, elems, modulo) {
value: 4000
});
ta[Symbol.isConcatSpreadable] = true;
assert.compareArray([].concat(ta), expected, '[].concat(new type(1)) returns expected');
assert.compareArray([].concat(ta), expected);
}
var max = [Math.pow(2, 8), Math.pow(2, 16), Math.pow(2, 32), false, false];

Просмотреть файл

@ -16,22 +16,13 @@ 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]),
'compareArray([].concat(ta, ta), [ta, ta]) must return true'
);
assert.compareArray([].concat(ta, ta), [ta, ta]);
ta[Symbol.isConcatSpreadable] = true;
assert.compareArray([].concat(ta), items, '[].concat(new type(items)) returns items');
assert.compareArray([].concat(ta), items);
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'
);
assert.compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]);
ta_by_len[Symbol.isConcatSpreadable] = true;
assert(
compareArray([].concat(ta_by_len), items),
'compareArray([].concat(ta_by_len), items) must return true'
);
assert.compareArray([].concat(ta_by_len), items);
// TypedArray with fake `length`.
ta = new type(1);
@ -43,7 +34,7 @@ function concatTypedArray(type, elems, modulo) {
value: 4000
});
ta[Symbol.isConcatSpreadable] = true;
assert.compareArray([].concat(ta), expected, '[].concat(new type(1)) returns expected');
assert.compareArray([].concat(ta), expected);
}
var max = [Math.pow(2, 8), Math.pow(2, 16), Math.pow(2, 32), false, false];
[

Просмотреть файл

@ -16,7 +16,6 @@ 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,7 +16,6 @@ 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,7 +14,6 @@ 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,7 +14,6 @@ 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,7 +16,6 @@ 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,7 +14,6 @@ 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,4 +55,9 @@ 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,20 +31,24 @@ info: |
includes: [compareArray.js]
---*/
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, 0),
['a', 'b', 'c', 'd', '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(0, 2),
['c', 'd', 'e', 'f', 'e', 'f']
);
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(
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(3, 0),
['a', 'b', 'c', 'a', 'b', 'c']
);
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');
assert.compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(1, 4),
[0, 4, 5, 3, 4, 5]
);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,74 @@
// |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);

Просмотреть файл

@ -0,0 +1,124 @@
// 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);
});
});
}

Просмотреть файл

@ -0,0 +1,74 @@
// |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);

Просмотреть файл

@ -0,0 +1,124 @@
// 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);
});
});
}

Просмотреть файл

@ -0,0 +1,76 @@
// |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);

Просмотреть файл

@ -0,0 +1,124 @@
// 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);
});
});
}

Просмотреть файл

@ -0,0 +1,76 @@
// |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);

Просмотреть файл

@ -0,0 +1,124 @@
// 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);
});
});
}

Просмотреть файл

@ -0,0 +1,76 @@
// |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);

Просмотреть файл

@ -0,0 +1,124 @@
// 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);
});
});
}

Просмотреть файл

@ -0,0 +1,76 @@
// |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);

Просмотреть файл

@ -0,0 +1,124 @@
// 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);
});
});
}

Просмотреть файл

@ -0,0 +1,72 @@
// |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);

Просмотреть файл

@ -0,0 +1,124 @@
// 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,13 +7,11 @@ 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,13 +7,11 @@ 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;
@ -21,7 +19,6 @@ 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,13 +7,11 @@ 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;
@ -21,7 +19,6 @@ 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,21 +7,18 @@ 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,34 +15,28 @@ 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,33 +12,27 @@ 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 {
@ -47,25 +41,21 @@ 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,13 +12,11 @@ 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;
@ -26,7 +24,6 @@ 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));
}
@ -34,14 +31,12 @@ 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;
@ -49,7 +44,6 @@ 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,123 +14,82 @@ description: >
var obj = {};
obj.join = Array.prototype.join;
//CHECK#1
obj.length = {
valueOf: function() {
valueOf() {
return 3
}
};
if (obj.join() !== ",,") {
throw new Test262Error('#1: obj.length = {valueOf: function() {return 3}} obj.join() === ",,". Actual: ' + (obj.join()));
}
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
//CHECK#2
obj.length = {
valueOf: function() {
valueOf() {
return 3
},
toString: function() {
toString() {
return 2
}
};
if (obj.join() !== ",,") {
throw new Test262Error('#2: obj.length = {valueOf: function() {return 3}, toString: function() {return 2}} obj.join() === ",,". Actual: ' + (obj.join()));
}
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
//CHECK#3
obj.length = {
valueOf: function() {
valueOf() {
return 3
},
toString: function() {
toString() {
return {}
}
};
if (obj.join() !== ",,") {
throw new Test262Error('#3: obj.length = {valueOf: function() {return 3}, toString: function() {return {}}} obj.join() === ",,". Actual: ' + (obj.join()));
}
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
//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()));
}
}
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: function() {
valueOf() {
return 3
},
toString() {
throw new Test262Error();
}
};
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
obj.length = {
toString() {
return 2
}
};
if (obj.join() !== ",") {
throw new Test262Error('#5: obj.length = {toString: function() {return 2}} obj.join() === ",". Actual: ' + (obj.join()));
}
assert.sameValue(obj.join(), ",", 'obj.join() must return ","');
//CHECK#6
obj.length = {
valueOf: function() {
valueOf() {
return {}
},
toString: function() {
toString() {
return 2
}
}
if (obj.join() !== ",") {
throw new Test262Error('#6: obj.length = {valueOf: function() {return {}}, toString: function() {return 2}} obj.join() === ",". Actual: ' + (obj.join()));
}
assert.sameValue(obj.join(), ",", 'obj.join() must return ","');
//CHECK#7
try {
assert.throws(Test262Error, () => {
obj.length = {
valueOf: function() {
throw "error"
valueOf() {
throw new Test262Error();
},
toString: function() {
toString() {
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));
}
}
});
//CHECK#8
try {
assert.throws(TypeError, () => {
obj.length = {
valueOf: function() {
valueOf() {
return {}
},
toString: function() {
toString() {
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,44 +9,36 @@ 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,139 +10,137 @@ description: >
---*/
var x = new Array(0, 1, 2, 3);
//CHECK#1
var object = {
valueOf: function() {
valueOf() {
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)));
}
//CHECK#2
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"'
);
var object = {
valueOf: function() {
valueOf() {
return "+"
},
toString: function() {
toString() {
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)));
}
//CHECK#3
assert.sameValue(
x.join(object),
"0*1*2*3",
'x.join("{valueOf() {return "+"}, toString() {return "*"}}) must return "0*1*2*3"'
);
var object = {
valueOf: function() {
valueOf() {
return "+"
},
toString: function() {
toString() {
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)));
}
//CHECK#4
assert.sameValue(
x.join(object),
"0+1+2+3",
'x.join({valueOf() {return "+"}, toString() {return {}}}) must return "0+1+2+3"'
);
try {
var object = {
valueOf: function() {
valueOf() {
throw "error"
},
toString: function() {
toString() {
return "*"
}
};
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)));
}
assert.sameValue(
x.join(object),
"0*1*2*3",
'x.join("{valueOf() {throw "error"}, toString() {return "*"}}) must return "0*1*2*3"'
);
}
catch (e) {
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));
}
assert.notSameValue(e, "error", 'The value of e is not "error"');
}
//CHECK#5
var object = {
toString: function() {
toString() {
return "*"
}
};
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)));
}
assert.sameValue(x.join(object), "0*1*2*3", 'x.join({toString() {return "*"}}) must return "0*1*2*3"');
//CHECK#6
var object = {
valueOf: function() {
valueOf() {
return {}
},
toString: function() {
toString() {
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)));
}
//CHECK#7
assert.sameValue(
x.join(object),
"0*1*2*3",
'x.join({valueOf() {return {}}, toString() {return "*"}}) must return "0*1*2*3"'
);
try {
var object = {
valueOf: function() {
valueOf() {
return "+"
},
toString: function() {
toString() {
throw "error"
}
};
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)));
throw new Test262Error('#7.1: var object = {valueOf() {return "+"}, toString() {throw "error"}}; x.join(object) throw "error". Actual: ' + (x.join(object)));
}
catch (e) {
if (e !== "error") {
throw new Test262Error('#7.2: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}}; x.join(object) throw "error". Actual: ' + (e));
}
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
}
//CHECK#8
try {
var object = {
valueOf: function() {
valueOf() {
return {}
},
toString: function() {
toString() {
return {}
}
};
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)));
throw new Test262Error('#8.1: var object = {valueOf() {return {}}, toString() {return {}}}; x.join(object) throw TypeError. Actual: ' + (x.join(object)));
}
catch (e) {
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));
}
assert.sameValue(
e instanceof TypeError,
true,
'The result of evaluating (e instanceof TypeError) is expected to be true'
);
}
//CHECK#9
try {
var object = {
toString: function() {
toString() {
throw "error"
}
};
[].join(object);
throw new Test262Error('#9.1: var object = {toString: function() {throw "error"}}; [].join(object) throw "error". Actual: ' + ([].join(object)));
throw new Test262Error('#9.1: var object = {toString() {throw "error"}}; [].join(object) throw "error". Actual: ' + ([].join(object)));
}
catch (e) {
if (e !== "error") {
throw new Test262Error('#9.2: var object = {toString: function() {throw "error"}}; [].join(object) throw "error". Actual: ' + (e));
}
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
}
reportCompare(0, 0);

Просмотреть файл

@ -9,49 +9,41 @@ 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,18 +7,14 @@ 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);
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()));
}
assert.sameValue(x.join(), "[object Object]", 'x.join() must return "[object Object]"');
//CHECK#2
var object = {
valueOf: function() {
return "+"
@ -28,11 +24,8 @@ var object = {
}
};
var x = new Array(object);
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()));
}
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
//CHECK#3
var object = {
valueOf: function() {
return "+"
@ -42,11 +35,8 @@ var object = {
}
};
var x = new Array(object);
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()));
}
assert.sameValue(x.join(), "+", 'x.join() must return "+"');
//CHECK#4
try {
var object = {
valueOf: function() {
@ -57,30 +47,20 @@ try {
}
};
var x = new Array(object);
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()));
}
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
}
catch (e) {
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));
}
assert.notSameValue(e, "error", 'The value of e is not "error"');
}
//CHECK#5
var object = {
toString: function() {
return "*"
}
};
var x = new Array(object);
if (x.join() !== "*") {
throw new Test262Error('#5: var object = {toString: function() {return "*"}} var x = new Array(object); x.join() === "*". Actual: ' + (x.join()));
}
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
//CHECK#6
var object = {
valueOf: function() {
return {}
@ -90,11 +70,8 @@ var object = {
}
}
var x = new Array(object);
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()));
}
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
//CHECK#7
try {
var object = {
valueOf: function() {
@ -109,12 +86,9 @@ 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) {
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));
}
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
}
//CHECK#8
try {
var object = {
valueOf: function() {
@ -129,9 +103,11 @@ 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) {
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));
}
assert.sameValue(
e instanceof TypeError,
true,
'The result of evaluating (e instanceof TypeError) is expected to be true'
);
}
reportCompare(0, 0);

Просмотреть файл

@ -14,12 +14,10 @@ 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,7 +9,6 @@ description: >
of Array.prototype is Object.prototype
---*/
//CHECK#1
Array.prototype[1] = 1;
var x = [0];
x.length = 2;
@ -17,7 +16,6 @@ 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,7 +7,6 @@ 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));
}

Просмотреть файл

@ -1,23 +0,0 @@
// 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);

Просмотреть файл

@ -0,0 +1,78 @@
// |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);

Просмотреть файл

@ -0,0 +1,124 @@
// 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,19 +9,16 @@ 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();
@ -29,7 +26,6 @@ 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,29 +9,24 @@ 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;
@ -40,29 +35,24 @@ 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,37 +17,31 @@ 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,50 +14,42 @@ 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 {
@ -66,26 +58,22 @@ 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));
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше