mirror of https://github.com/tc39/test262.git
Remove current contents of implementation-contributed
This commit is contained in:
parent
2496577225
commit
a15874163e
|
@ -1,38 +0,0 @@
|
|||
- well-known_symbols_Symbol.toPrimitive.js
|
||||
- Review coverage for Symbol.toPrimitive calls in many expressions. e.g. addition, subtractiong, comparison, etc
|
||||
- WeakSet_iterator_closing.js
|
||||
- Based in the tests at `built-ins/WeakSet/iterator-*`, add cases for verifying the correct get and call order for the iterator next/return/throw, etc
|
||||
- the same is valid for WeakMap, Set, and Map
|
||||
- Unicode_code_point_escapes_in_identifiers.js / Unicode_code_point_escapes_in_strings.js
|
||||
- Needs coverage for cases using unicode code point escapes in:
|
||||
- `language/identifiers`
|
||||
- `language/reserved-words`
|
||||
- `language/literals`
|
||||
- `language/keywords`
|
||||
- `language/directive-prologue`
|
||||
- `language/white-space`
|
||||
- arguments object?
|
||||
- etc
|
||||
- Symbol_JSON.stringify_ignores_symbols.js
|
||||
- Cover Symbol values in JSON.stringify (`built-ins/JSON/stringify`)
|
||||
- Set_-0_key_converts_to_+0.js
|
||||
- `built-ins/Set/will-not-add-duplicate-entry-normalizes-zero.js`: reconsider verifying -0 normalization fetching the values from the Set.
|
||||
- Similar to Map index? Needs to verify
|
||||
- rest_parameters_new_Function_support.js
|
||||
- Add coverage composing fns through `new Function` using rest operators in strings
|
||||
- expand to other function constructors
|
||||
- rest_parameters_cant_be_used_in_setters.js
|
||||
- Couldn't find coverage for rest parameters disallowed in setters, needs double check
|
||||
- Proxy_JSON.stringify_support.js
|
||||
- Is it worth adding JSON.stringify behavior over Proxied objects?
|
||||
- Proxy_internal_set_calls_Array.prototype.push.js / Proxy_internal_set_calls_*.js / Proxy_internal_get_calls_*.js
|
||||
- It is interesting to verify Array/String/RegExp/etc methods calling internals being observed with exotic proxy objects.
|
||||
- This is a coverage for each method, not Proxy.
|
||||
- Rather than add these operations to each method, but most of the Array methods have malstructured legacy tests.
|
||||
- It's recommended to review the coverage and recreate tests, adding cases where calls to internals are observed like in this example.
|
||||
- prototype_of_bound_functions_arrow_functions.js
|
||||
- Add coverage for bound special functions
|
||||
- Add coverage for checking the prototypes...
|
||||
- Add coverage for bound class methods (include static and private)
|
||||
- Object_static_methods_accept_primitives_Object.freeze.js
|
||||
- Needs Coverage Object static methods - e.g. `Object.freeze` - receiving non object values
|
File diff suppressed because it is too large
Load Diff
|
@ -1,106 +0,0 @@
|
|||
- addition-order-evaluation.js:
|
||||
- not exactly covered, but language/expressions/addition/order-of-evalution.js does it for ToNumber vs ToPrimitive checks
|
||||
- language/expressions/addition/
|
||||
- Should check for primitive coercion converting values to primitive to be used before comparing to symbol values
|
||||
- https://tc39.github.io/ecma262/#sec-addition-operator-plus checks for both operands as their primitive values before ToNumber over Symbol values
|
||||
- should cover ToPrimitive before ToNumber
|
||||
- allow-math-ic-b3-code-duplication.js:
|
||||
- Could add cases for addition expressions with primitive operations returning other objects, not really like this specific test, but from @@toPrimitive, valueOf, and toString calls.
|
||||
- apply-second-argument-must-be-array-like.js
|
||||
- Cases should be covered in Function#apply, where the second arg is not an array like value
|
||||
- arguments-bizarre-behavior.js
|
||||
- This is partially covered in a different way: needs to check length of arguments after defineProperty, and checking after the function escope, as a returned result. Enumerability might be a point to consider as well (too specific?)
|
||||
- arith-*-on-varios-types.js
|
||||
- Test262 needs several tests for the Math methods with type coercions on the given arguments
|
||||
- array-*:
|
||||
- Perhaps: add cases of operations on top of proxies object to arrays.
|
||||
- set-*.js / map-*.js / weakmap-set-*.js / weakset-*.js:
|
||||
- Test static return values for before and after adding an item in an WeakSet.
|
||||
- zero-to-string.js:
|
||||
- Number#toString is not checked over literal numbers but number objects only.
|
||||
|
||||
- assign-argument-in-inlined-call.js
|
||||
- No coverage for fn_name.arguments going to inner scopes.
|
||||
- assignment-in-function-call-bracket-node.js
|
||||
- Tests obj computer propety names containing expressions that evaluates to `null`.
|
||||
- async-arrow-function-in-class-heritage.js
|
||||
- Tests class heritage failing with arrow functions (no constructor). Might have coverage, not found yet.
|
||||
- async-arrow-functions-*.js
|
||||
- No tests checking for lexical arguments/new.target/etc in async arrow functions
|
||||
- Async arrow functions needs some refactoring
|
||||
- inferred-names.js
|
||||
- Needs to add tests for multiple anonymous fn forms, verify the .name property is properly set
|
||||
- Web Compat fix: https://github.com/Microsoft/ChakraCore/issues/3407
|
||||
- builtin-function-is-construct-type-none.js
|
||||
- Add a forEach test with a new.target call
|
||||
- Extend it to other methods
|
||||
- >
|
||||
"Built-in Function Objects
|
||||
|
||||
...
|
||||
Built-in function objects that are not identified as constructors do not implement the [[Construct]] internal method unless otherwise specified in the description of a particular function. When a built-in constructor is called as part of a new expression the argumentsList parameter of the invoked [[Construct]] internal method provides the values for the built-in constructor's named parameters.
|
||||
|
||||
Built-in functions that are not constructors do not have a prototype property unless otherwise specified in the description of a particular function."
|
||||
- builtin-function-length.js
|
||||
- Add length property check for function forms in the language folder
|
||||
- computed-accessor.js / computed-accessor-parsing.js
|
||||
- Review the coverage of test/language/computed-property-names
|
||||
- good to use the test generation tool to create cases to be reused for objects and classes, etc
|
||||
- should check type coercion as well, using composed objects too
|
||||
- completion-value.js
|
||||
- v8: add tests for completion value resolution in try/catch/finally blocks (anything returning -2)
|
||||
- `eval('99; do { -99; try { 42 } catch (e) { -1 } finally { -2; break; -3 }; } while (false);')`
|
||||
- `eval('99; do { -99; try { [].x.x } catch (e) { 42; } finally { -2; break; -3 }; } while (false);')`
|
||||
- `eval('99; do { -99; try { 42 } catch (e) { -1 } finally { -2; break; -3 }; -77 } while (false);')`
|
||||
- `eval('99; do { -99; try { [].x.x } catch (e) { 42; } finally { -2; break; -3 }; -77 } while (false);')`
|
||||
- `eval('99; do { -99; try { 42 } catch (e) { -1 } finally { -2; continue; -3 }; } while (false);')`
|
||||
- `eval('99; do { -99; try { [].x.x } catch (e) { 42; } finally { -2; continue; -3 }; } while (false);')`
|
||||
- `eval('99; do { -99; try { 42 } catch (e) { -1 } finally { -2; continue; -3 }; -77 } while (false);')`
|
||||
- `eval('99; do { -99; try { [].x.x } catch (e) { 42; } finally { -2; continue; -3 }; -77 } while (false);')`
|
||||
- expected: 42
|
||||
- actual: -2
|
||||
- sm cases are already covered
|
||||
- concat-append-one-with-sparse-array.js
|
||||
- Append a small value in a very long array - not any specific part of the specs to check - test is slow but maybe worth considering?
|
||||
- create-subclass-structure-may-throw-exception-when-getting-prototype.js
|
||||
- tests are inconsistent in different engines
|
||||
- verify this on the usage for Reflect.construct
|
||||
- custom-iterators.js
|
||||
- it would be interesting to create templates and cases for iteration over objects. Using Symbol.iterator (and Symbol.asyncIterator) in for-of loops, for-of-await loops, Array.from, etc etc etc
|
||||
- The examples in that test file would be interesting to create __iterator like__ objects
|
||||
- ChakraCore is apparently reporting of a wrong error constructor
|
||||
- custom-prototype-may-be-same-to-original-one.js
|
||||
- Tests that Reflect.constructor can use a custom prototype with the same reference for the original one
|
||||
- error-description-on-symbols-should-not-crash.js
|
||||
- Symbols are not callable...
|
||||
- exception-in-to-property-key-should-be-handled-early-in-object-methods.js
|
||||
- Review coverage for Object#hasOwnProperty, add coercions for the this value
|
||||
- function-caller-*.js
|
||||
- Verify .caller behavior for nested functions, retrieving the function body.
|
||||
- Results are diverging from JSC (abrupt completion) to other engines (no error)
|
||||
- global-environment-does-not-trap-unscopables.js
|
||||
- duplicate `language/with/binding-blocked-by-unscopables.js` to assert binding block of the global in inner scopes, deferring references to the local scope.
|
||||
- ignore-promise-species.js
|
||||
- add coverage for Promise.all and race handling a local `@@species`
|
||||
- modify-set-during-iteration.js
|
||||
- Add coverage for iterating Set/Map/WeakSet/WeakMap objects with values being changed during the iteration. (e.g. for-of loops)
|
||||
- module-namespace-access*js
|
||||
- review these tests for import()
|
||||
- private-name-as-anonymous-builtin.js
|
||||
- Review name property for the executor functions in Promise.resolve calls
|
||||
- regress-187006.js
|
||||
- check if we have coverage for regexp `match` setting array values.
|
||||
- regress-179634.js
|
||||
- review coverage for Object.defineProperties
|
||||
- regress-170732.js
|
||||
- review coverage for valid and invalid await expressions
|
||||
- regress-159883.js
|
||||
- review common forms for invalid dates
|
||||
- regress-189317.js
|
||||
- AnnexB defineGetter/Setter being used with built-in functions
|
||||
- cross engine errors
|
||||
- string-to-string-error.js / string-value-of-error.js
|
||||
- Needs coverage for the this value in `String#toString` and `String#valueOf`
|
||||
- Also verify with ordinary objects containing toPrimitive methods.
|
||||
- reserved-word-with-escape.js
|
||||
- Add coverage for checking reserved names - mostly `var` - as global variables, using escape sequences.
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"sourceRevisionAtLastExport": "c3e7eb19",
|
||||
"targetRevisionAtLastExport": "7f1116982d",
|
||||
"curatedFiles": {}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,15 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var map = new Map();
|
||||
map.set(-0, "foo");
|
||||
var k;
|
||||
map.forEach(function (value, key) {
|
||||
k = 1 / key;
|
||||
});
|
||||
return k === Infinity && map.get(+0) == "foo";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return Object.freeze('a') === 'a';
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return Object.getOwnPropertyDescriptor('a', 'foo') === undefined;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var s = Object.getOwnPropertyNames('a');
|
||||
return s.length === 2 &&
|
||||
((s[0] === 'length' && s[1] === '0') || (s[0] === '0' && s[1] === 'length'));
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return Object.getPrototypeOf('a').constructor === String;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return Object.isExtensible('a') === false;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return Object.isFrozen('a') === true;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return Object.isSealed('a') === true;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var s = Object.keys('a');
|
||||
return s.length === 1 && s[0] === '0';
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return Object.preventExtensions('a') === 'a';
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return Object.seal('a') === 'a';
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
return JSON.stringify(new Proxy(['foo'], {})) === '["foo"]';
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.copyWithin -> DeletePropertyOrThrow -> [[Delete]]
|
||||
var del = [];
|
||||
var p = new Proxy([0,0,0,,,,], { deleteProperty: function(o, v) { del.push(v); return delete o[v]; }});
|
||||
p.copyWithin(0,3);
|
||||
return del + '' === "0,1,2";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.pop -> DeletePropertyOrThrow -> [[Delete]]
|
||||
var del = [];
|
||||
var p = new Proxy([0,0,0], { deleteProperty: function(o, v) { del.push(v); return delete o[v]; }});
|
||||
p.pop();
|
||||
return del + '' === "2";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.reverse -> DeletePropertyOrThrow -> [[Delete]]
|
||||
var del = [];
|
||||
var p = new Proxy([0,,2,,4,,], { deleteProperty: function(o, v) { del.push(v); return delete o[v]; }});
|
||||
p.reverse();
|
||||
return del + '' === "0,4,2";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.shift -> DeletePropertyOrThrow -> [[Delete]]
|
||||
var del = [];
|
||||
var p = new Proxy([0,,0,,0,0], { deleteProperty: function(o, v) { del.push(v); return delete o[v]; }});
|
||||
p.shift();
|
||||
return del + '' === "0,2,5";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.splice -> DeletePropertyOrThrow -> [[Delete]]
|
||||
var del = [];
|
||||
var p = new Proxy([0,0,0,0,,0], { deleteProperty: function(o, v) { del.push(v); return delete o[v]; }});
|
||||
p.splice(2,2,0);
|
||||
return del + '' === "3,5";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.unshift -> DeletePropertyOrThrow -> [[Delete]]
|
||||
var del = [];
|
||||
var p = new Proxy([0,0,,0,,0], { deleteProperty: function(o, v) { del.push(v); return delete o[v]; }});
|
||||
p.unshift(0);
|
||||
return del + '' === "5,3";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.concat -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var arr = [1];
|
||||
arr.constructor = undefined;
|
||||
var p = new Proxy(arr, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Array.prototype.concat.call(p,p);
|
||||
return get[0] === "constructor"
|
||||
&& get[1] === Symbol.isConcatSpreadable
|
||||
&& get[2] === "length"
|
||||
&& get[3] === "0"
|
||||
&& get[4] === get[1] && get[5] === get[2] && get[6] === get[3]
|
||||
&& get.length === 7;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.pop -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy([0,1,2,3], { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Array.prototype.pop.call(p);
|
||||
return get + '' === "length,3";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.reverse -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy([0,,2,,4,,], { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Array.prototype.reverse.call(p);
|
||||
return get + '' === "length,0,4,2";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.shift -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy([0,1,2,3], { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Array.prototype.shift.call(p);
|
||||
return get + '' === "length,0,1,2,3";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.splice -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy([0,1,2,3], { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Array.prototype.splice.call(p,1,1);
|
||||
Array.prototype.splice.call(p,1,0,1);
|
||||
return get + '' === "length,constructor,1,2,3,length,constructor,2,1";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.toString -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({ join:Function() }, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Array.prototype.toString.call(p);
|
||||
return get + '' === "join";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype methods -> Get -> [[Get]]
|
||||
var methods = ['copyWithin', 'every', 'fill', 'filter', 'find', 'findIndex', 'forEach',
|
||||
'indexOf', 'join', 'lastIndexOf', 'map', 'reduce', 'reduceRight', 'some'];
|
||||
var get;
|
||||
var p = new Proxy({length: 2, 0: '', 1: ''}, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
for(var i = 0; i < methods.length; i+=1) {
|
||||
get = [];
|
||||
Array.prototype[methods[i]].call(p, Function());
|
||||
if (get + '' !== (
|
||||
methods[i] === 'fill' ? "length" :
|
||||
methods[i] === 'every' ? "length,0" :
|
||||
methods[i] === 'lastIndexOf' || methods[i] === 'reduceRight' ? "length,1,0" :
|
||||
"length,0,1"
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// ClassDefinitionEvaluation -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy(Function(), { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
class C extends p {}
|
||||
return get + '' === "prototype";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// CreateDynamicFunction -> GetPrototypeFromConstructor -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy(Function, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
new p;
|
||||
return get + '' === "prototype";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// CreateListFromArrayLike -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({length:2, 0:0, 1:0}, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Function.prototype.apply({}, p);
|
||||
return get + '' === "length,0,1";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Date.prototype.toJSON -> ToPrimitive -> Get -> [[Get]]
|
||||
// Date.prototype.toJSON -> Invoke -> GetMethod -> GetV -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({toString:Function(),toISOString:Function()}, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Date.prototype.toJSON.call(p);
|
||||
return get[0] === Symbol.toPrimitive && get.slice(1) + '' === "valueOf,toString,toISOString";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Error.prototype.toString -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({}, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Error.prototype.toString.call(p);
|
||||
return get + '' === "name,message";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Function.prototype.bind -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy(Function(), { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Function.prototype.bind.call(p);
|
||||
return get + '' === "length,name";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// HasBinding -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({foo:1}, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
p[Symbol.unscopables] = p;
|
||||
with(p) {
|
||||
typeof foo;
|
||||
}
|
||||
return get[0] === Symbol.unscopables && get.slice(1) + '' === "foo";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// JSON.stringify -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({}, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
JSON.stringify(p);
|
||||
return get + '' === "toJSON";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Object.assign -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({foo:1, bar:2}, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Object.assign({}, p);
|
||||
return get + '' === "foo,bar";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// RegExp.prototype.flags -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({}, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call(p);
|
||||
return get + '' === "global,ignoreCase,multiline,dotAll,unicode,sticky";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// RegExp.prototype.test -> RegExpExec -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({ exec: function() { return null; } }, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
RegExp.prototype.test.call(p);
|
||||
return get + '' === "exec";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// Reviewed
|
||||
// RegExp.prototype.toString -> Get -> [[Get]]
|
||||
function test() {
|
||||
var get = [];
|
||||
var p = new Proxy({}, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
RegExp.prototype.toString.call(p);
|
||||
return get + '' === "source,flags";
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed.")
|
|
@ -1,16 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// RegExp.prototype[Symbol.match] -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({ exec: function() { return null; } }, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
RegExp.prototype[Symbol.match].call(p);
|
||||
p.global = true;
|
||||
RegExp.prototype[Symbol.match].call(p);
|
||||
return get + '' === "flags,exec,flags,exec";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// RegExp.prototype[Symbol.replace] -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({ exec: function() { return null; } }, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
RegExp.prototype[Symbol.replace].call(p);
|
||||
p.global = true;
|
||||
RegExp.prototype[Symbol.replace].call(p);
|
||||
return get + '' === "flags,exec,flags,exec";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// RegExp.prototype[Symbol.search] -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy({ exec: function() { return null; } }, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
RegExp.prototype[Symbol.search].call(p);
|
||||
return get + '' === "lastIndex,exec,lastIndex";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// RegExp.prototype[Symbol.split] -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var constructor = Function();
|
||||
constructor[Symbol.species] = Object;
|
||||
var p = new Proxy({ constructor: constructor, flags: '', exec: function() { return null; } }, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
RegExp.prototype[Symbol.split].call(p, "");
|
||||
return get + '' === "constructor,flags,exec";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// RegExp -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var re = { constructor: null };
|
||||
re[Symbol.match] = true;
|
||||
var p = new Proxy(re, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
RegExp(p);
|
||||
return get[0] === Symbol.match && get.slice(1) + '' === "constructor,source,flags";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// String.prototype.match -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var proxied = {};
|
||||
proxied[Symbol.toPrimitive] = Function();
|
||||
var p = new Proxy(proxied, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
"".match(p);
|
||||
return get[0] === Symbol.match && get[1] === Symbol.toPrimitive && get.length === 2;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// String.prototype.replace functions -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var proxied = {};
|
||||
proxied[Symbol.toPrimitive] = Function();
|
||||
var p = new Proxy(proxied, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
"".replace(p);
|
||||
return get[0] === Symbol.replace && get[1] === Symbol.toPrimitive && get.length === 2;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// String.prototype.search functions -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var proxied = {};
|
||||
proxied[Symbol.toPrimitive] = Function();
|
||||
var p = new Proxy(proxied, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
"".search(p);
|
||||
return get[0] === Symbol.search && get[1] === Symbol.toPrimitive && get.length === 2;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// String.prototype.split functions -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var proxied = {};
|
||||
proxied[Symbol.toPrimitive] = Function();
|
||||
var p = new Proxy(proxied, { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
"".split(p);
|
||||
return get[0] === Symbol.split && get[1] === Symbol.toPrimitive && get.length === 2;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// InstanceofOperator -> GetMethod -> GetV -> [[Get]]
|
||||
// InstanceofOperator -> OrdinaryHasInstance -> Get -> [[Get]]
|
||||
var get = [];
|
||||
var p = new Proxy(Function(), { get: function(o, k) { get.push(k); return o[k]; }});
|
||||
({}) instanceof p;
|
||||
return get[0] === Symbol.hasInstance && get.slice(1) + '' === "prototype";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.copyWithin -> Set -> [[Set]]
|
||||
var set = [];
|
||||
var p = new Proxy([1,2,3,4,5,6], { set: function(o, k, v) { set.push(k); o[k] = v; return true; }});
|
||||
p.copyWithin(0, 3);
|
||||
return set + '' === "0,1,2";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.fill -> Set -> [[Set]]
|
||||
var set = [];
|
||||
var p = new Proxy([1,2,3,4,5,6], { set: function(o, k, v) { set.push(k); o[k] = v; return true; }});
|
||||
p.fill(0, 3);
|
||||
return set + '' === "3,4,5";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.pop -> Set -> [[Set]]
|
||||
var set = [];
|
||||
var p = new Proxy([], { set: function(o, k, v) { set.push(k); o[k] = v; return true; }});
|
||||
p.pop();
|
||||
return set + '' === "length";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.push -> Set -> [[Set]]
|
||||
var set = [];
|
||||
var p = new Proxy([], { set: function(o, k, v) { set.push(k); o[k] = v; return true; }});
|
||||
p.push(0,0,0);
|
||||
return set + '' === "0,1,2,length";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.reverse -> Set -> [[Set]]
|
||||
var set = [];
|
||||
var p = new Proxy([0,0,0,,], { set: function(o, k, v) { set.push(k); o[k] = v; return true; }});
|
||||
p.reverse();
|
||||
return set + '' === "3,1,2";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.shift -> Set -> [[Set]]
|
||||
var set = [];
|
||||
var p = new Proxy([0,0,,0], { set: function(o, k, v) { set.push(k); o[k] = v; return true; }});
|
||||
p.shift();
|
||||
return set + '' === "0,2,length";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.splice -> Set -> [[Set]]
|
||||
var set = [];
|
||||
var p = new Proxy([1,2,3], { set: function(o, k, v) { set.push(k); o[k] = v; return true; }});
|
||||
p.splice(1,0,0);
|
||||
return set + '' === "3,2,1,length";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Array.prototype.unshift -> Set -> [[Set]]
|
||||
var set = [];
|
||||
var p = new Proxy([0,0,,0], { set: function(o, k, v) { set.push(k); o[k] = v; return true; }});
|
||||
p.unshift(0,1);
|
||||
return set + '' === "5,3,2,0,1,length";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
// Object.assign -> Set -> [[Set]]
|
||||
var set = [];
|
||||
var p = new Proxy({}, { set: function(o, k, v) { set.push(k); o[k] = v; return true; }});
|
||||
Object.assign(p, { foo: 1, bar: 2 });
|
||||
return set + '' === "foo,bar";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
var set = new Set();
|
||||
set.add(-0);
|
||||
var k;
|
||||
set.forEach(function (value) {
|
||||
k = 1 / value;
|
||||
});
|
||||
return k === Infinity && set.has(+0);
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
var object = {foo: Symbol()};
|
||||
object[Symbol()] = 1;
|
||||
var array = [Symbol()];
|
||||
return JSON.stringify(object) === '{}' && JSON.stringify(array) === '[null]' && JSON.stringify(Symbol()) === undefined;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
var \u{102C0} = { \u{102C0} : 2 };
|
||||
return \u{102C0}['\ud800\udec0'] === 2;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
// Reviewed
|
||||
function test() {
|
||||
|
||||
return '\u{1d306}' == '\ud834\udf06';
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
// Reviewed
|
||||
var global = this;
|
||||
|
||||
function __createIterableObject(arr, methods) {
|
||||
methods = methods || {};
|
||||
if (typeof Symbol !== 'function' || !Symbol.iterator) {
|
||||
return {};
|
||||
}
|
||||
arr.length++;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
return { value: arr.shift(), done: arr.length <= 0 };
|
||||
},
|
||||
'return': methods['return'],
|
||||
'throw': methods['throw']
|
||||
};
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function(){ return iterator; }
|
||||
return iterable;
|
||||
}
|
||||
|
||||
function test() {
|
||||
|
||||
var closed = false;
|
||||
var iter = global.__createIterableObject([1, 2, 3], {
|
||||
'return': function(){ closed = true; return {}; }
|
||||
});
|
||||
try {
|
||||
new WeakSet(iter);
|
||||
} catch(e){}
|
||||
return closed;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return (() => 5)() === 5;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var b = x => x + "foo";
|
||||
return (b("fee fie foe ") === "fee fie foe foo");
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var d = { x : "bar", y : function() { return z => this.x + z; }};
|
||||
var e = { x : "baz" };
|
||||
return d.y().bind(e, "ley")() === "barley";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return (() => {
|
||||
try { Function("0 || () => 2")(); } catch(e) { return true; }
|
||||
})();
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var f = (function() { return z => arguments[0]; }(5));
|
||||
return f(6) === 5;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
function test() {
|
||||
|
||||
function C() {
|
||||
return x => new.target;
|
||||
}
|
||||
return new C()() === C && C()() === undefined;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
function test() {
|
||||
|
||||
class B {
|
||||
qux() {
|
||||
return "quux";
|
||||
}
|
||||
}
|
||||
class C extends B {
|
||||
baz() {
|
||||
return x => super.qux();
|
||||
}
|
||||
}
|
||||
var arrow = new C().baz();
|
||||
return arrow() === "quux";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var d = { x : "bar", y : function() { return z => this.x + z; }}.y();
|
||||
var e = { x : "baz", y : d };
|
||||
return d("ley") === "barley" && e.y("ley") === "barley";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var c = (v, w, x, y, z) => "" + v + w + x + y + z;
|
||||
return (c(6, 5, 4, 3, 2) === "65432");
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return (() => {
|
||||
try { Function("x\n => 2")(); } catch(e) { return true; }
|
||||
})();
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var a = () => 5;
|
||||
return !a.hasOwnProperty("prototype");
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var d = { x : "foo", y : function() { return () => this.x; }};
|
||||
var e = { x : "bar" };
|
||||
return d.y().call(e) === "foo" && d.y().apply(e) === "foo";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var passed = (function(){ try { qux; } catch(e) { return true; }}());
|
||||
function fn() { passed &= qux === 456; }
|
||||
const qux = 456;
|
||||
fn();
|
||||
return passed;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
function test() {
|
||||
|
||||
'use strict';
|
||||
var passed = (function(){ try { qux; } catch(e) { return true; }}());
|
||||
function fn() { passed &= qux === 456; }
|
||||
const qux = 456;
|
||||
fn();
|
||||
return passed;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return (function(x = 1) {
|
||||
try {
|
||||
eval("(function(a=a){}())");
|
||||
return false;
|
||||
} catch(e) {}
|
||||
try {
|
||||
eval("(function(a=b,b){}())");
|
||||
return false;
|
||||
} catch(e) {}
|
||||
return true;
|
||||
}());
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
var global = this;
|
||||
|
||||
function __createIterableObject(arr, methods) {
|
||||
methods = methods || {};
|
||||
if (typeof Symbol !== 'function' || !Symbol.iterator) {
|
||||
return {};
|
||||
}
|
||||
arr.length++;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
return { value: arr.shift(), done: arr.length <= 0 };
|
||||
},
|
||||
'return': methods['return'],
|
||||
'throw': methods['throw']
|
||||
};
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function(){ return iterator; }
|
||||
return iterable;
|
||||
}
|
||||
|
||||
function test() {
|
||||
|
||||
var closed = false;
|
||||
var iter = __createIterableObject([1, 2, 3], {
|
||||
'return': function(){ closed = true; return {}; }
|
||||
});
|
||||
for (var it of iter) break;
|
||||
return closed;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
var global = this;
|
||||
|
||||
function __createIterableObject(arr, methods) {
|
||||
methods = methods || {};
|
||||
if (typeof Symbol !== 'function' || !Symbol.iterator) {
|
||||
return {};
|
||||
}
|
||||
arr.length++;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
return { value: arr.shift(), done: arr.length <= 0 };
|
||||
},
|
||||
'return': methods['return'],
|
||||
'throw': methods['throw']
|
||||
};
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function(){ return iterator; }
|
||||
return iterable;
|
||||
}
|
||||
|
||||
function test() {
|
||||
|
||||
var closed = false;
|
||||
var iter = __createIterableObject([1, 2, 3], {
|
||||
'return': function(){ closed = true; return {}; }
|
||||
});
|
||||
try {
|
||||
for (var it of iter) throw 0;
|
||||
} catch(e){}
|
||||
return closed;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var arr = [5];
|
||||
for (var item of arr)
|
||||
return item === 5;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var str = "";
|
||||
for (var item of "𠮷𠮶")
|
||||
str += item + " ";
|
||||
return str === "𠮷 𠮶 ";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var result = "";
|
||||
var iterable = (function*(){ yield 1; yield 2; yield 3; }());
|
||||
for (var item of iterable) {
|
||||
result += item;
|
||||
}
|
||||
return result === "123";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
var global = this;
|
||||
|
||||
function __createIterableObject(arr, methods) {
|
||||
methods = methods || {};
|
||||
if (typeof Symbol !== 'function' || !Symbol.iterator) {
|
||||
return {};
|
||||
}
|
||||
arr.length++;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
return { value: arr.shift(), done: arr.length <= 0 };
|
||||
},
|
||||
'return': methods['return'],
|
||||
'throw': methods['throw']
|
||||
};
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function(){ return iterator; }
|
||||
return iterable;
|
||||
}
|
||||
|
||||
function test() {
|
||||
|
||||
var result = "";
|
||||
var iterable = global.__createIterableObject([1, 2, 3]);
|
||||
for (var item of iterable) {
|
||||
result += item;
|
||||
}
|
||||
return result === "123";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
var global = this;
|
||||
|
||||
function __createIterableObject(arr, methods) {
|
||||
methods = methods || {};
|
||||
if (typeof Symbol !== 'function' || !Symbol.iterator) {
|
||||
return {};
|
||||
}
|
||||
arr.length++;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
return { value: arr.shift(), done: arr.length <= 0 };
|
||||
},
|
||||
'return': methods['return'],
|
||||
'throw': methods['throw']
|
||||
};
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function(){ return iterator; }
|
||||
return iterable;
|
||||
}
|
||||
|
||||
function test() {
|
||||
|
||||
var result = "";
|
||||
var iterable = global.__createIterableObject([1, 2, 3]);
|
||||
for (var item of Object.create(iterable)) {
|
||||
result += item;
|
||||
}
|
||||
return result === "123";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var arr = [,,];
|
||||
var count = 0;
|
||||
for (var item of arr)
|
||||
count += (item === undefined);
|
||||
return count === 2;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var str = "";
|
||||
for (var item of "foo")
|
||||
str += item;
|
||||
return str === "foo";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
function test() {
|
||||
|
||||
function * generator(){
|
||||
yield this.x; yield this.y;
|
||||
};
|
||||
var iterator = { g: generator, x: 5, y: 6 }.g();
|
||||
var item = iterator.next();
|
||||
var passed = item.value === 5 && item.done === false;
|
||||
item = iterator.next();
|
||||
passed &= item.value === 6 && item.done === false;
|
||||
item = iterator.next();
|
||||
passed &= item.value === undefined && item.done === true;
|
||||
return passed;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var generator = function * (){
|
||||
yield 5; yield 6;
|
||||
};
|
||||
var iterator = generator();
|
||||
var item = iterator.next();
|
||||
var passed = item.value === 5 && item.done === false;
|
||||
item = iterator.next();
|
||||
passed &= item.value === 6 && item.done === false;
|
||||
item = iterator.next();
|
||||
passed &= item.value === undefined && item.done === true;
|
||||
return passed;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var sent;
|
||||
function * generator(){
|
||||
sent = [yield 5, yield 6];
|
||||
};
|
||||
var iterator = generator();
|
||||
iterator.next();
|
||||
iterator.next("foo");
|
||||
iterator.next("bar");
|
||||
return sent[0] === "foo" && sent[1] === "bar";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
function test() {
|
||||
|
||||
var passed = (function(){ try { qux; } catch(e) { return true; }}());
|
||||
function fn() { passed &= qux === 456; }
|
||||
let qux = 456;
|
||||
fn();
|
||||
return passed;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
function test() {
|
||||
|
||||
'use strict';
|
||||
var passed = (function(){ try { qux; } catch(e) { return true; }}());
|
||||
function fn() { passed &= qux === 456; }
|
||||
let qux = 456;
|
||||
fn();
|
||||
return passed;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return new Date(NaN) + "" === "Invalid Date";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return new RegExp(/./im, "g").global === true;
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function test() {
|
||||
|
||||
return "𐐘".toLowerCase() === "𐑀" && "𐑀".toUpperCase() === "𐐘";
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
function test() {
|
||||
|
||||
try {
|
||||
new (Object.getOwnPropertyDescriptor({get a(){}}, 'a')).get;
|
||||
} catch(e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!test())
|
||||
throw new Error("Test failed");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue