Skip to content

Commit

Permalink
Transform compareArray -> assert.compareArray: test/language/**/*.js (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron authored Oct 16, 2021
1 parent 5d3eed6 commit 8b4382d
Show file tree
Hide file tree
Showing 22 changed files with 91 additions and 91 deletions.
6 changes: 3 additions & 3 deletions test/language/computed-property-names/basics/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
6 changes: 3 additions & 3 deletions test/language/computed-property-names/basics/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
12 changes: 6 additions & 6 deletions test/language/computed-property-names/basics/symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
);
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
6 changes: 3 additions & 3 deletions test/language/computed-property-names/class/method/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
6 changes: 3 additions & 3 deletions test/language/computed-property-names/class/method/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
12 changes: 6 additions & 6 deletions test/language/computed-property-names/class/method/symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
);
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
6 changes: 3 additions & 3 deletions test/language/computed-property-names/object/method/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
6 changes: 3 additions & 3 deletions test/language/computed-property-names/object/method/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
12 changes: 6 additions & 6 deletions test/language/computed-property-names/object/method/symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
);
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
14 changes: 7 additions & 7 deletions test/language/rest-parameters/arrow-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
2 changes: 1 addition & 1 deletion test/language/rest-parameters/no-alias-arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
16 changes: 8 additions & 8 deletions test/language/rest-parameters/with-new-target.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
}
}

Expand All @@ -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]
);
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -45,28 +45,28 @@ class B {
}
}

assert(compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype']))
assert.compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype'])

class C {
static get length() {
throw new Test262Error('Static `get` accessor should not be executed during definition');
}
}

assert(compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype']))
assert.compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype'])

class D {
static set length(_) {
throw new Test262Error('Static `set` accessor should not be executed during definition');
}
}

assert(compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype']))
assert.compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype'])

class E {
static *length() {
throw new Test262Error('Static GeneratorMethod should not be executed during definition');
}
}

assert(compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype']))
assert.compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype'])
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -42,28 +42,28 @@ class B {
}
}

assert(compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype']))
assert.compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype'])

class C {
static get name() {
throw new Test262Error('Static `get` accessor should not be executed during definition');
}
}

assert(compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype']))
assert.compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype'])

class D {
static set name(_) {
throw new Test262Error('Static `set` accessor should not be executed during definition');
}
}

assert(compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype']))
assert.compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype'])

class E {
static *name() {
throw new Test262Error('Static GeneratorMethod should not be executed during definition');
}
}

assert(compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype']))
assert.compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype'])
Original file line number Diff line number Diff line change
Expand Up @@ -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');
18 changes: 9 additions & 9 deletions test/language/statements/class/static-init-arguments-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ class Sub extends Array {

var sub = new Sub(42, 'foo');

assert(compareArray(sub, [42, 'foo']));
assert.compareArray(sub, [42, 'foo']);
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 8b4382d

Please sign in to comment.