Skip to content

Commit c4e2bbb

Browse files
Trottaddaleax
authored andcommitted
benchmark: use consistent coding style in assert/*
Files in benchmark/assert/* were sometimes using trailing commas for multi-line objects and sometimes not, mixing the approaches in the same file sometimes. Standardize these files to always use trailing commas in multi-line objects. Additionally, remove some unnecessary line-wrapping (so that there are fewer multi-line objects). PR-URL: #25865 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
1 parent 988c714 commit c4e2bbb

9 files changed

+16
-31
lines changed

benchmark/assert/deepequal-buffer.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ const bench = common.createBenchmark(main, {
66
n: [2e4],
77
len: [1e2, 1e3],
88
strict: [0, 1],
9-
method: [
10-
'deepEqual',
11-
'notDeepEqual'
12-
]
9+
method: [ 'deepEqual', 'notDeepEqual' ],
1310
});
1411

1512
function main({ len, n, method, strict }) {

benchmark/assert/deepequal-map.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, {
1414
'deepEqual_mixed',
1515
'notDeepEqual_primitiveOnly',
1616
'notDeepEqual_objectOnly',
17-
'notDeepEqual_mixed'
18-
]
17+
'notDeepEqual_mixed',
18+
],
1919
});
2020

2121
function benchmark(method, n, values, values2) {

benchmark/assert/deepequal-object.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ const bench = common.createBenchmark(main, {
77
n: [5e3],
88
size: [1e2, 1e3, 5e4],
99
strict: [0, 1],
10-
method: [
11-
'deepEqual',
12-
'notDeepEqual'
13-
]
10+
method: [ 'deepEqual', 'notDeepEqual' ],
1411
});
1512

1613
function createObj(source, add = '') {
@@ -21,8 +18,8 @@ function createObj(source, add = '') {
2118
a: [1, 2, 3],
2219
baz: n,
2320
c: {},
24-
b: []
25-
}
21+
b: [],
22+
},
2623
}));
2724
}
2825

benchmark/assert/deepequal-prims-and-objs-big-array-set.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const primValues = {
88
'string': 'a',
99
'number': 1,
1010
'object': { 0: 'a' },
11-
'array': [1, 2, 3]
11+
'array': [1, 2, 3],
1212
};
1313

1414
const bench = common.createBenchmark(main, {
@@ -20,8 +20,8 @@ const bench = common.createBenchmark(main, {
2020
'deepEqual_Array',
2121
'notDeepEqual_Array',
2222
'deepEqual_Set',
23-
'notDeepEqual_Set'
24-
]
23+
'notDeepEqual_Set',
24+
],
2525
});
2626

2727
function run(fn, n, actual, expected) {

benchmark/assert/deepequal-prims-and-objs-big-loop.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@ const primValues = {
66
'string': 'a',
77
'number': 1,
88
'object': { 0: 'a' },
9-
'array': [1, 2, 3]
9+
'array': [1, 2, 3],
1010
};
1111

1212
const bench = common.createBenchmark(main, {
1313
primitive: Object.keys(primValues),
1414
n: [2e4],
1515
strict: [0, 1],
16-
method: [
17-
'deepEqual',
18-
'notDeepEqual',
19-
]
16+
method: [ 'deepEqual', 'notDeepEqual' ],
2017
});
2118

2219
function main({ n, primitive, method, strict }) {

benchmark/assert/deepequal-set.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, {
1414
'deepEqual_mixed',
1515
'notDeepEqual_primitiveOnly',
1616
'notDeepEqual_objectOnly',
17-
'notDeepEqual_mixed'
18-
]
17+
'notDeepEqual_mixed',
18+
],
1919
});
2020

2121
function benchmark(method, n, values, values2) {

benchmark/assert/deepequal-typedarrays.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, {
1616
'deepEqual',
1717
'notDeepEqual',
1818
],
19-
len: [1e2, 5e3]
19+
len: [1e2, 5e3],
2020
});
2121

2222
function main({ type, n, len, method, strict }) {

benchmark/assert/ok.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
const common = require('../common.js');
44
const assert = require('assert');
55

6-
const bench = common.createBenchmark(main, {
7-
n: [1e5]
8-
});
6+
const bench = common.createBenchmark(main, { n: [1e5] });
97

108
function main({ n }) {
119
var i;

benchmark/assert/throws.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ const { throws, doesNotThrow } = require('assert');
55

66
const bench = common.createBenchmark(main, {
77
n: [1e4],
8-
method: [
9-
'doesNotThrow',
10-
'throws_TypeError',
11-
'throws_RegExp'
12-
]
8+
method: [ 'doesNotThrow', 'throws_TypeError', 'throws_RegExp' ],
139
});
1410

1511
function main({ n, method }) {

0 commit comments

Comments
 (0)