Skip to content

Commit

Permalink
Add parens to constructor calls
Browse files Browse the repository at this point in the history
  • Loading branch information
koddsson committed Jan 29, 2024
1 parent 2cbc839 commit 74453cd
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 114 deletions.
36 changes: 18 additions & 18 deletions test/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ describe('assert', function () {

it('isArray', function() {
assert.isArray([]);
assert.isArray(new Array);
assert.isArray(new Array());

err(function () {
assert.isArray({}, 'blah');
Expand All @@ -592,7 +592,7 @@ describe('assert', function () {
}, "blah: expected [] not to be an array");

err(function () {
assert.isNotArray(new Array);
assert.isNotArray(new Array());
}, "expected [] not to be an array");
});

Expand Down Expand Up @@ -1412,9 +1412,9 @@ describe('assert', function () {
assert.lengthOf(1, 5);
}, "expected 1 to have property \'length\'");

assert.lengthOf(new Map, 0);
assert.lengthOf(new Map(), 0);

var map = new Map;
var map = new Map();
map.set('a', 1);
map.set('b', 2);

Expand All @@ -1424,9 +1424,9 @@ describe('assert', function () {
assert.lengthOf(map, 3, 'blah');
}, "blah: expected Map{ 'a' => 1, 'b' => 2 } to have a size of 3 but got 2");

assert.lengthOf(new Set, 0);
assert.lengthOf(new Set(), 0);

var set = new Set;
var set = new Set();
set.add(1);
set.add(2);

Expand Down Expand Up @@ -2714,25 +2714,25 @@ describe('assert', function () {

assert[isEmpty]('');
assert[isEmpty]([]);
assert[isEmpty](new FakeArgs);
assert[isEmpty](new FakeArgs());
assert[isEmpty]({});

err(function(){
assert[isEmpty](new WeakMap, 'blah');
assert[isEmpty](new WeakMap(), 'blah');
}, "blah: .empty was passed a weak collection");

err(function(){
assert[isEmpty](new WeakSet, 'blah');
assert[isEmpty](new WeakSet(), 'blah');
}, "blah: .empty was passed a weak collection");

assert[isEmpty](new Map);
assert[isEmpty](new Map());

var map = new Map;
var map = new Map();
map.key = 'val';
assert[isEmpty](map);
assert[isEmpty](new Set);
assert[isEmpty](new Set());

var set = new Set;
var set = new Set();
set.key = 'val';
assert[isEmpty](set);

Expand Down Expand Up @@ -2811,27 +2811,27 @@ describe('assert', function () {
assert[isNotEmpty]({foo: 'bar'});

err(function(){
assert[isNotEmpty](new WeakMap, 'blah');
assert[isNotEmpty](new WeakMap(), 'blah');
}, "blah: .empty was passed a weak collection");

err(function(){
assert[isNotEmpty](new WeakSet, 'blah');
assert[isNotEmpty](new WeakSet(), 'blah');
}, "blah: .empty was passed a weak collection");

var map = new Map();
map.set('a', 1);
assert[isNotEmpty](map);

err(function(){
assert[isNotEmpty](new Map);
assert[isNotEmpty](new Map());
}, "expected Map{} not to be empty");

var set = new Set();
set.add(1);
assert[isNotEmpty](set);

err(function(){
assert[isNotEmpty](new Set);
assert[isNotEmpty](new Set());
}, "expected Set{} not to be empty");

err(function(){
Expand All @@ -2843,7 +2843,7 @@ describe('assert', function () {
}, "expected [] not to be empty");

err(function(){
assert[isNotEmpty](new FakeArgs);
assert[isNotEmpty](new FakeArgs());
}, "expected FakeArgs{} not to be empty");

err(function(){
Expand Down
96 changes: 48 additions & 48 deletions test/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,10 @@ describe('expect', function () {
expect(1).to.have.lengthOf.within(5, 7, 'blah');
}, "blah: expected 1 to have property 'length'");

expect(new Map).to.have.length.within(0, 0);
expect(new Map).to.have.lengthOf.within(0, 0);
expect(new Map()).to.have.length.within(0, 0);
expect(new Map()).to.have.lengthOf.within(0, 0);

var map = new Map;
var map = new Map();
map.set('a', 1);
map.set('b', 2);
map.set('c', 3);
Expand All @@ -656,10 +656,10 @@ describe('expect', function () {
expect(map).to.have.lengthOf.within(5, 7, 'blah');
}, "blah: expected Map{ 'a' => 1, 'b' => 2, 'c' => 3 } to have a size within 5..7");

expect(new Set).to.have.length.within(0, 0);
expect(new Set).to.have.lengthOf.within(0, 0);
expect(new Set()).to.have.length.within(0, 0);
expect(new Set()).to.have.lengthOf.within(0, 0);

var set = new Set;
var set = new Set();
set.add(1);
set.add(2);
set.add(3);
Expand Down Expand Up @@ -808,10 +808,10 @@ describe('expect', function () {
expect(1).to.have.lengthOf.above(0, 'blah');
}, "blah: expected 1 to have property 'length'");

expect(new Map).to.have.length.above(-1);
expect(new Map).to.have.lengthOf.above(-1);
expect(new Map()).to.have.length.above(-1);
expect(new Map()).to.have.lengthOf.above(-1);

var map = new Map;
var map = new Map();
map.set('a', 1);
map.set('b', 2);
map.set('c', 3);
Expand All @@ -827,10 +827,10 @@ describe('expect', function () {
expect(map).to.have.lengthOf.above(5, 'blah');
}, "blah: expected Map{ 'a' => 1, 'b' => 2, 'c' => 3 } to have a size above 5 but got 3");

expect(new Set).to.have.length.above(-1);
expect(new Set).to.have.lengthOf.above(-1);
expect(new Set()).to.have.length.above(-1);
expect(new Set()).to.have.lengthOf.above(-1);

var set = new Set;
var set = new Set();
set.add(1);
set.add(2);
set.add(3);
Expand Down Expand Up @@ -971,10 +971,10 @@ describe('expect', function () {
expect(1).to.have.lengthOf.at.least(0, 'blah');
}, "blah: expected 1 to have property 'length'");

expect(new Map).to.have.length.of.at.least(0);
expect(new Map).to.have.lengthOf.at.least(0);
expect(new Map()).to.have.length.of.at.least(0);
expect(new Map()).to.have.lengthOf.at.least(0);

var map = new Map;
var map = new Map();
map.set('a', 1);
map.set('b', 2);
map.set('c', 3);
Expand All @@ -990,10 +990,10 @@ describe('expect', function () {
expect(map).to.have.lengthOf.at.least(4, 'blah');
}, "blah: expected Map{ 'a' => 1, 'b' => 2, 'c' => 3 } to have a size at least 4 but got 3");

expect(new Set).to.have.length.of.at.least(0);
expect(new Set).to.have.lengthOf.at.least(0);
expect(new Set()).to.have.length.of.at.least(0);
expect(new Set()).to.have.lengthOf.at.least(0);

var set = new Set;
var set = new Set();
set.add(1);
set.add(2);
set.add(3);
Expand Down Expand Up @@ -1088,10 +1088,10 @@ describe('expect', function () {
expect(1).to.have.lengthOf.below(0, 'blah');
}, "blah: expected 1 to have property 'length'");

expect(new Map).to.have.length.below(1);
expect(new Map).to.have.lengthOf.below(1);
expect(new Map()).to.have.length.below(1);
expect(new Map()).to.have.lengthOf.below(1);

var map = new Map;
var map = new Map();
map.set('a', 1);
map.set('b', 2);
map.set('c', 3);
Expand All @@ -1107,10 +1107,10 @@ describe('expect', function () {
expect(map).to.have.lengthOf.below(2, 'blah');
}, "blah: expected Map{ 'a' => 1, 'b' => 2, 'c' => 3 } to have a size below 2 but got 3");

expect(new Set).to.have.length.below(1);
expect(new Set).to.have.lengthOf.below(1);
expect(new Set()).to.have.length.below(1);
expect(new Set()).to.have.lengthOf.below(1);

var set = new Set;
var set = new Set();
set.add(1);
set.add(2);
set.add(3);
Expand Down Expand Up @@ -1255,10 +1255,10 @@ describe('expect', function () {
expect(1).to.have.lengthOf.at.most(0, 'blah');
}, "blah: expected 1 to have property 'length'");

expect(new Map).to.have.length.of.at.most(0);
expect(new Map).to.have.lengthOf.at.most(0);
expect(new Map()).to.have.length.of.at.most(0);
expect(new Map()).to.have.lengthOf.at.most(0);

var map = new Map;
var map = new Map();
map.set('a', 1);
map.set('b', 2);
map.set('c', 3);
Expand All @@ -1274,10 +1274,10 @@ describe('expect', function () {
expect(map).to.have.lengthOf.at.most(2, 'blah');
}, "blah: expected Map{ 'a' => 1, 'b' => 2, 'c' => 3 } to have a size at most 2 but got 3");

expect(new Set).to.have.length.of.at.most(0);
expect(new Set).to.have.lengthOf.at.most(0);
expect(new Set()).to.have.length.of.at.most(0);
expect(new Set()).to.have.lengthOf.at.most(0);

var set = new Set;
var set = new Set();
set.add(1);
set.add(2);
set.add(3);
Expand Down Expand Up @@ -1397,10 +1397,10 @@ describe('expect', function () {
expect('asd').to.not.have.lengthOf(3, 'blah');
}, "blah: expected 'asd' to not have a length of 3");

expect(new Map).to.have.length(0);
expect(new Map).to.have.lengthOf(0);
expect(new Map()).to.have.length(0);
expect(new Map()).to.have.lengthOf(0);

var map = new Map;
var map = new Map();
map.set('a', 1);
map.set('b', 2);
map.set('c', 3);
Expand All @@ -1416,10 +1416,10 @@ describe('expect', function () {
expect(map).to.not.have.lengthOf(3, 'blah');
}, "blah: expected Map{ 'a' => 1, 'b' => 2, 'c' => 3 } to not have a size of 3");

expect(new Set).to.have.length(0);
expect(new Set).to.have.lengthOf(0);
expect(new Set()).to.have.length(0);
expect(new Set()).to.have.lengthOf(0);

var set = new Set;
var set = new Set();
set.add(1);
set.add(2);
set.add(3);
Expand Down Expand Up @@ -1550,50 +1550,50 @@ describe('expect', function () {
expect('foo').not.to.be.empty;
expect([]).to.be.empty;
expect(['foo']).not.to.be.empty;
expect(new FakeArgs).to.be.empty;
expect(new FakeArgs()).to.be.empty;
expect({arguments: 0}).not.to.be.empty;
expect({}).to.be.empty;
expect({foo: 'bar'}).not.to.be.empty;

err(function(){
expect(new WeakMap, 'blah').not.to.be.empty;
expect(new WeakMap(), 'blah').not.to.be.empty;
}, "blah: .empty was passed a weak collection");

err(function(){
expect(new WeakSet, 'blah').not.to.be.empty;
expect(new WeakSet(), 'blah').not.to.be.empty;
}, "blah: .empty was passed a weak collection");

expect(new Map).to.be.empty;
expect(new Map()).to.be.empty;

// Not using Map constructor args because not supported in IE 11.
var map = new Map;
var map = new Map();
map.set('a', 1);
expect(map).not.to.be.empty;

err(function(){
expect(new Map).not.to.be.empty;
expect(new Map()).not.to.be.empty;
}, "expected Map{} not to be empty");

map = new Map;
map = new Map();
map.key = 'val';
expect(map).to.be.empty;

err(function(){
expect(map).not.to.be.empty;
}, "expected Map{} not to be empty");

expect(new Set).to.be.empty;
expect(new Set()).to.be.empty;

// Not using Set constructor args because not supported in IE 11.
var set = new Set;
var set = new Set();
set.add(1);
expect(set).not.to.be.empty;

err(function(){
expect(new Set).not.to.be.empty;
expect(new Set()).not.to.be.empty;
}, "expected Set{} not to be empty");

set = new Set;
set = new Set();
set.key = 'val';
expect(set).to.be.empty;

Expand All @@ -1618,7 +1618,7 @@ describe('expect', function () {
}, "expected [ \'foo\' ] to be empty");

err(function(){
expect(new FakeArgs).not.to.be.empty;
expect(new FakeArgs()).not.to.be.empty;
}, "expected FakeArgs{} not to be empty");

err(function(){
Expand Down
Loading

0 comments on commit 74453cd

Please sign in to comment.