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: https://github.com/nodejs/node/pull/25865
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
This commit is contained in:
Rich Trott 2019-01-31 21:05:17 -08:00
parent 4deb23a2f6
commit 3418956349
9 changed files with 16 additions and 31 deletions

View File

@ -6,10 +6,7 @@ const bench = common.createBenchmark(main, {
n: [2e4],
len: [1e2, 1e3],
strict: [0, 1],
method: [
'deepEqual',
'notDeepEqual'
]
method: [ 'deepEqual', 'notDeepEqual' ],
});
function main({ len, n, method, strict }) {

View File

@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, {
'deepEqual_mixed',
'notDeepEqual_primitiveOnly',
'notDeepEqual_objectOnly',
'notDeepEqual_mixed'
]
'notDeepEqual_mixed',
],
});
function benchmark(method, n, values, values2) {

View File

@ -7,10 +7,7 @@ const bench = common.createBenchmark(main, {
n: [5e3],
size: [1e2, 1e3, 5e4],
strict: [0, 1],
method: [
'deepEqual',
'notDeepEqual'
]
method: [ 'deepEqual', 'notDeepEqual' ],
});
function createObj(source, add = '') {
@ -21,8 +18,8 @@ function createObj(source, add = '') {
a: [1, 2, 3],
baz: n,
c: {},
b: []
}
b: [],
},
}));
}

View File

@ -8,7 +8,7 @@ const primValues = {
'string': 'a',
'number': 1,
'object': { 0: 'a' },
'array': [1, 2, 3]
'array': [1, 2, 3],
};
const bench = common.createBenchmark(main, {
@ -20,8 +20,8 @@ const bench = common.createBenchmark(main, {
'deepEqual_Array',
'notDeepEqual_Array',
'deepEqual_Set',
'notDeepEqual_Set'
]
'notDeepEqual_Set',
],
});
function run(fn, n, actual, expected) {

View File

@ -6,17 +6,14 @@ const primValues = {
'string': 'a',
'number': 1,
'object': { 0: 'a' },
'array': [1, 2, 3]
'array': [1, 2, 3],
};
const bench = common.createBenchmark(main, {
primitive: Object.keys(primValues),
n: [2e4],
strict: [0, 1],
method: [
'deepEqual',
'notDeepEqual',
]
method: [ 'deepEqual', 'notDeepEqual' ],
});
function main({ n, primitive, method, strict }) {

View File

@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, {
'deepEqual_mixed',
'notDeepEqual_primitiveOnly',
'notDeepEqual_objectOnly',
'notDeepEqual_mixed'
]
'notDeepEqual_mixed',
],
});
function benchmark(method, n, values, values2) {

View File

@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, {
'deepEqual',
'notDeepEqual',
],
len: [1e2, 5e3]
len: [1e2, 5e3],
});
function main({ type, n, len, method, strict }) {

View File

@ -3,9 +3,7 @@
const common = require('../common.js');
const assert = require('assert');
const bench = common.createBenchmark(main, {
n: [1e5]
});
const bench = common.createBenchmark(main, { n: [1e5] });
function main({ n }) {
var i;

View File

@ -5,11 +5,7 @@ const { throws, doesNotThrow } = require('assert');
const bench = common.createBenchmark(main, {
n: [1e4],
method: [
'doesNotThrow',
'throws_TypeError',
'throws_RegExp'
]
method: [ 'doesNotThrow', 'throws_TypeError', 'throws_RegExp' ],
});
function main({ n, method }) {