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:
parent
4deb23a2f6
commit
3418956349
@ -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 }) {
|
||||
|
@ -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) {
|
||||
|
@ -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: [],
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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 }) {
|
||||
|
@ -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) {
|
||||
|
@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, {
|
||||
'deepEqual',
|
||||
'notDeepEqual',
|
||||
],
|
||||
len: [1e2, 5e3]
|
||||
len: [1e2, 5e3],
|
||||
});
|
||||
|
||||
function main({ type, n, len, method, strict }) {
|
||||
|
@ -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;
|
||||
|
@ -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 }) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user