mirror of https://github.com/tc39/test262.git
Transform compareArray -> assert.compareArray: test/language/**/*.js (#3239)
This commit is contained in:
parent
5d3eed6433
commit
8b4382d2f2
|
@ -21,7 +21,7 @@ assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined in `o
|
|||
assert.sameValue(object[1], 'B', "The value of `object[1]` is `'B'`. Defined in `object` as `[1]: 'B'`");
|
||||
assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined in `object` as `c: 'C'`");
|
||||
assert.sameValue(object[2], 'D', "The value of `object[2]` is `'D'`. Defined in `object` as `[ID(2)]: 'D'`");
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c']),
|
||||
"`compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(object),
|
||||
['1', '2', 'a', 'c']
|
||||
);
|
||||
|
|
|
@ -20,7 +20,7 @@ assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined in `o
|
|||
assert.sameValue(object.b, 'B', "The value of `object.b` is `'B'`. Defined in `object` as `['b']: 'B'`");
|
||||
assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined in `object` as `c: 'C'`");
|
||||
assert.sameValue(object.d, 'D', "The value of `object.d` is `'D'`. Defined in `object` as `[ID('d')]: 'D'`");
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd']),
|
||||
"`compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(object),
|
||||
['a', 'b', 'c', 'd']
|
||||
);
|
||||
|
|
|
@ -24,11 +24,11 @@ assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined in `o
|
|||
assert.sameValue(object[sym1], 'B', "The value of `object[sym1]` is `'B'`. Defined in `object` as `[sym1]: 'B'`");
|
||||
assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined in `object` as `c: 'C'`");
|
||||
assert.sameValue(object[sym2], 'D', "The value of `object[sym2]` is `'D'`. Defined in `object` as `[ID(sym2)]: 'D'`");
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(object), ['a', 'c']),
|
||||
"`compareArray(Object.getOwnPropertyNames(object), ['a', 'c'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(object),
|
||||
['a', 'c']
|
||||
);
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2]),
|
||||
"`compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertySymbols(object),
|
||||
[sym1, sym2]
|
||||
);
|
||||
|
|
|
@ -17,7 +17,7 @@ assert.sameValue(
|
|||
0,
|
||||
"The value of `Object.keys(C.prototype).length` is `0`"
|
||||
);
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a']),
|
||||
"`compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(C.prototype),
|
||||
['constructor', 'a']
|
||||
);
|
||||
|
|
|
@ -24,7 +24,7 @@ assert.sameValue(new C()[2](), 'D', "`new C()[2]()` returns `'D'`, from `[ID(2)]
|
|||
|
||||
assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype");
|
||||
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c']),
|
||||
"`compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(C.prototype),
|
||||
['1', '2', 'constructor', 'a', 'c']
|
||||
);
|
||||
|
|
|
@ -22,7 +22,7 @@ assert.sameValue(new C().b(), 'B', "`new C().b()` returns `'B'`. Defined as `['b
|
|||
assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`. Defined as `c() { return 'C'; }`");
|
||||
assert.sameValue(new C().d(), 'D', "`new C().d()` returns `'D'`. Defined as `[ID('d')]() { return 'D'; }`");
|
||||
assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype");
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd']),
|
||||
"`compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(C.prototype),
|
||||
['constructor', 'a', 'b', 'c', 'd']
|
||||
);
|
||||
|
|
|
@ -25,11 +25,11 @@ assert.sameValue(new C()[sym1](), 'B', "`new C()[sym1]()` returns `'B'`. Defined
|
|||
assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`. Defined as `c() { return 'C'; }`");
|
||||
assert.sameValue(new C()[sym2](), 'D', "`new C()[sym2]()` returns `'D'`. Defined as `[ID(sym2)]() { return 'D'; }`");
|
||||
assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype");
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'c']),
|
||||
"`compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'c'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(C.prototype),
|
||||
['constructor', 'a', 'c']
|
||||
);
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertySymbols(C.prototype), [sym1, sym2]),
|
||||
"`compareArray(Object.getOwnPropertySymbols(C.prototype), [sym1, sym2])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertySymbols(C.prototype),
|
||||
[sym1, sym2]
|
||||
);
|
||||
|
|
|
@ -12,7 +12,7 @@ var object = {
|
|||
yield 2;
|
||||
}
|
||||
};
|
||||
assert(
|
||||
compareArray(Object.keys(object), ['a']),
|
||||
"`compareArray(Object.keys(object), ['a'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.keys(object),
|
||||
['a']
|
||||
);
|
||||
|
|
|
@ -21,7 +21,7 @@ assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() {
|
|||
assert.sameValue(object[1](), 'B', "`object[1]()` returns `'B'`. Defined as `[1]() { return 'B'; }`");
|
||||
assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`");
|
||||
assert.sameValue(object[2](), 'D', "`object[2]()` returns `'D'`. Defined as `[ID(2)]() { return 'D'; }`");
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c']),
|
||||
"`compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(object),
|
||||
['1', '2', 'a', 'c']
|
||||
);
|
||||
|
|
|
@ -21,7 +21,7 @@ assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() {
|
|||
assert.sameValue(object.b(), 'B', "`object.b()` returns `'B'`. Defined as `['b']() { return 'B'; }`");
|
||||
assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`");
|
||||
assert.sameValue(object.d(), 'D', "`object.d()` returns `'D'`. Defined as `[ID('d')]() { return 'D'; }`");
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd']),
|
||||
"`compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(object),
|
||||
['a', 'b', 'c', 'd']
|
||||
);
|
||||
|
|
|
@ -24,11 +24,11 @@ assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() {
|
|||
assert.sameValue(object[sym1](), 'B', "`object[sym1]()` returns `'B'`. Defined as `[sym1]() { return 'B'; }`");
|
||||
assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`");
|
||||
assert.sameValue(object[sym2](), 'D', "`object[sym2]()` returns `'D'`. Defined as `[ID(sym2)]() { return 'D'; }`");
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(object), ['a', 'c']),
|
||||
"`compareArray(Object.getOwnPropertyNames(object), ['a', 'c'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(object),
|
||||
['a', 'c']
|
||||
);
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2]),
|
||||
"`compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertySymbols(object),
|
||||
[sym1, sym2]
|
||||
);
|
||||
|
|
|
@ -33,7 +33,7 @@ assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined as `a
|
|||
assert.sameValue(object[1], 'B', "The value of `object[1]` is `'B'`. Defined as `[key1]: 'B'`");
|
||||
assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined as `c: 'C'`");
|
||||
assert.sameValue(object[2], 'D', "The value of `object[2]` is `'D'`. Defined as `[key2]: 'D'`");
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c']),
|
||||
"`compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(object),
|
||||
['1', '2', 'a', 'c']
|
||||
);
|
||||
|
|
|
@ -30,7 +30,7 @@ assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() {
|
|||
assert.sameValue(object.b(), 'B', "`object.b()` returns `'B'`. Defined as `[key1]() { return 'B'; }`");
|
||||
assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`");
|
||||
assert.sameValue(object.d(), 'D', "`object.d()` returns `'D'`. Defined as `[key2]() { return 'D'; }`");
|
||||
assert(
|
||||
compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd']),
|
||||
"`compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd'])` returns `true`"
|
||||
assert.compareArray(
|
||||
Object.getOwnPropertyNames(object),
|
||||
['a', 'b', 'c', 'd']
|
||||
);
|
||||
|
|
|
@ -8,10 +8,10 @@ includes: [compareArray.js]
|
|||
---*/
|
||||
var fn = (a, b, ...c) => c;
|
||||
|
||||
assert(compareArray(fn(), []), "`compareArray(fn(), [])` returns `true`");
|
||||
assert(compareArray(fn(1, 2), []), "`compareArray(fn(1, 2), [])` returns `true`");
|
||||
assert(compareArray(fn(1, 2, 3), [3]),"`compareArray(fn(1, 2, 3), [3])` returns `true`");
|
||||
assert(compareArray(fn(1, 2, 3, 4), [3, 4]),"`compareArray(fn(1, 2, 3, 4), [3, 4])` returns `true`");
|
||||
assert(compareArray(fn(1, 2, 3, 4, 5), [3, 4, 5]),"`compareArray(fn(1, 2, 3, 4, 5), [3, 4, 5])` returns `true`");
|
||||
assert(compareArray(((...args) => args)(), []),"`compareArray(((...args) => args)(), [])` returns `true`");
|
||||
assert(compareArray(((...args) => args)(1,2,3), [1,2,3]),"`compareArray(((...args) => args)(1,2,3), [1,2,3])` returns `true`");
|
||||
assert.compareArray(fn(), []);
|
||||
assert.compareArray(fn(1, 2), []);
|
||||
assert.compareArray(fn(1, 2, 3), [3]);
|
||||
assert.compareArray(fn(1, 2, 3, 4), [3, 4]);
|
||||
assert.compareArray(fn(1, 2, 3, 4, 5), [3, 4, 5]);
|
||||
assert.compareArray(((...args) => args)(), []);
|
||||
assert.compareArray(((...args) => args)(1,2,3), [1,2,3]);
|
||||
|
|
|
@ -10,6 +10,6 @@ function f(a, ...rest) {
|
|||
arguments[0] = 1;
|
||||
assert.sameValue(a, 3, "The value of `a` is `3`");
|
||||
arguments[1] = 2;
|
||||
assert(compareArray(rest, [4, 5]), "`compareArray(rest, [4, 5])` returns `true`");
|
||||
assert.compareArray(rest, [4, 5]);
|
||||
}
|
||||
f(3, 4, 5);
|
||||
|
|
|
@ -18,7 +18,7 @@ class Base {
|
|||
for (var i = 0; i < arguments.length; ++i) {
|
||||
args.push(arguments[i]);
|
||||
}
|
||||
assert(compareArray(args, a), "`compareArray(args, a)` returns `true`");
|
||||
assert.compareArray(args, a);
|
||||
}
|
||||
}
|
||||
class Child extends Base {
|
||||
|
@ -34,7 +34,7 @@ class Child extends Base {
|
|||
for (var i = 0; i < arguments.length; ++i) {
|
||||
args.push(arguments[i]);
|
||||
}
|
||||
assert(compareArray(args, b), "`compareArray(args, b)` returns `true`");
|
||||
assert.compareArray(args, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,11 +43,11 @@ var c = new Child(1, 2, 3);
|
|||
assert.sameValue(c.child.length, 3, "The value of `c.child.length` is `3`");
|
||||
assert.sameValue(c.base.length, 3, "The value of `c.base.length` is `3`");
|
||||
|
||||
assert(
|
||||
compareArray(c.child, [1, 2, 3]),
|
||||
"`compareArray(c.child, [1, 2, 3])` returns `true`"
|
||||
assert.compareArray(
|
||||
c.child,
|
||||
[1, 2, 3]
|
||||
);
|
||||
assert(
|
||||
compareArray(c.base, [1, 2, 3]),
|
||||
"`compareArray(c.base, [1, 2, 3])` returns `true`"
|
||||
assert.compareArray(
|
||||
c.base,
|
||||
[1, 2, 3]
|
||||
);
|
||||
|
|
|
@ -33,7 +33,7 @@ class A {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(Object.getOwnPropertyNames(A), ['length', 'name', 'prototype', 'method']))
|
||||
assert.compareArray(Object.getOwnPropertyNames(A), ['length', 'name', 'prototype', 'method'])
|
||||
|
||||
var attr = 'length';
|
||||
class B {
|
||||
|
@ -45,7 +45,7 @@ class B {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype']))
|
||||
assert.compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype'])
|
||||
|
||||
class C {
|
||||
static get length() {
|
||||
|
@ -53,7 +53,7 @@ class C {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype']))
|
||||
assert.compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype'])
|
||||
|
||||
class D {
|
||||
static set length(_) {
|
||||
|
@ -61,7 +61,7 @@ class D {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype']))
|
||||
assert.compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype'])
|
||||
|
||||
class E {
|
||||
static *length() {
|
||||
|
@ -69,4 +69,4 @@ class E {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype']))
|
||||
assert.compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype'])
|
||||
|
|
|
@ -30,7 +30,7 @@ class A {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(Object.getOwnPropertyNames(A), ['length', 'name', 'prototype', 'method']))
|
||||
assert.compareArray(Object.getOwnPropertyNames(A), ['length', 'name', 'prototype', 'method'])
|
||||
|
||||
var attr = 'name';
|
||||
class B {
|
||||
|
@ -42,7 +42,7 @@ class B {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype']))
|
||||
assert.compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype'])
|
||||
|
||||
class C {
|
||||
static get name() {
|
||||
|
@ -50,7 +50,7 @@ class C {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype']))
|
||||
assert.compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype'])
|
||||
|
||||
class D {
|
||||
static set name(_) {
|
||||
|
@ -58,7 +58,7 @@ class D {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype']))
|
||||
assert.compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype'])
|
||||
|
||||
class E {
|
||||
static *name() {
|
||||
|
@ -66,4 +66,4 @@ class E {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype']))
|
||||
assert.compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype'])
|
||||
|
|
|
@ -32,9 +32,9 @@ class C {
|
|||
}
|
||||
}
|
||||
|
||||
assert(compareArray(['function'], fn), 'body');
|
||||
assert(compareArray(['function'], fnParam), 'parameter');
|
||||
assert(compareArray(['generator function'], gen), 'body');
|
||||
assert(compareArray(['generator function'], genParam), 'parameter');
|
||||
assert(compareArray(['async function'], asyncFn), 'body');
|
||||
assert(compareArray(['async function'], asyncFnParam), 'parameter');
|
||||
assert.compareArray(['function'], fn, 'body');
|
||||
assert.compareArray(['function'], fnParam, 'parameter');
|
||||
assert.compareArray(['generator function'], gen, 'body');
|
||||
assert.compareArray(['generator function'], genParam, 'parameter');
|
||||
assert.compareArray(['async function'], asyncFn, 'body');
|
||||
assert.compareArray(['async function'], asyncFnParam, 'parameter');
|
||||
|
|
|
@ -47,12 +47,12 @@ instance.accessor = 'setter';
|
|||
instance.gen('generator method').next();
|
||||
instance.async('async method');
|
||||
|
||||
assert(compareArray(['method'], method), 'body');
|
||||
assert(compareArray(['method'], methodParam), 'parameter');
|
||||
assert(compareArray([], getter), 'body');
|
||||
assert(compareArray(['setter'], setter), 'body');
|
||||
assert(compareArray(['setter'], setterParam), 'parameter');
|
||||
assert(compareArray(['generator method'], genMethod), 'body');
|
||||
assert(compareArray(['generator method'], genMethodParam), 'parameter');
|
||||
assert(compareArray(['async method'], asyncMethod), 'body');
|
||||
assert(compareArray(['async method'], asyncMethodParam), 'parameter');
|
||||
assert.compareArray(['method'], method, 'body');
|
||||
assert.compareArray(['method'], methodParam, 'parameter');
|
||||
assert.compareArray([], getter, 'body');
|
||||
assert.compareArray(['setter'], setter, 'body');
|
||||
assert.compareArray(['setter'], setterParam, 'parameter');
|
||||
assert.compareArray(['generator method'], genMethod, 'body');
|
||||
assert.compareArray(['generator method'], genMethodParam, 'parameter');
|
||||
assert.compareArray(['async method'], asyncMethod, 'body');
|
||||
assert.compareArray(['async method'], asyncMethodParam, 'parameter');
|
||||
|
|
|
@ -23,4 +23,4 @@ class Sub extends Array {
|
|||
|
||||
var sub = new Sub(42, 'foo');
|
||||
|
||||
assert(compareArray(sub, [42, 'foo']));
|
||||
assert.compareArray(sub, [42, 'foo']);
|
||||
|
|
|
@ -29,5 +29,5 @@ var a2 = new Sub(7);
|
|||
assert.sameValue(a2.length, 7);
|
||||
|
||||
var a3 = new Sub();
|
||||
assert(compareArray(a3, []));
|
||||
assert.compareArray(a3, []);
|
||||
assert.sameValue(a3.length, 0);
|
||||
|
|
Loading…
Reference in New Issue