Skip to content

Commit

Permalink
cleanup testing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ianstormtaylor committed Jul 1, 2014
1 parent 1c17076 commit 7d6d757
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ describe('assert', function(){
try {
assert(false);
throw new Error('fail');
} catch (e) {}
} catch (e) {
if ('fail' == e.message) throw e;
}
});

it('should respect custom msg', function(){
Expand Down Expand Up @@ -45,7 +47,9 @@ describe('assert', function(){
try {
assert.equal({}, {});
throw new Error('fail');
} catch (e) {}
} catch (e) {
if ('fail' == e.message) throw e;
}
});
});

Expand All @@ -62,7 +66,9 @@ describe('assert', function(){
try {
assert.notEqual(true, true);
throw new Error('fail');
} catch (e) {}
} catch (e) {
if ('fail' == e.message) throw e;
}
});
});

Expand All @@ -79,7 +85,9 @@ describe('assert', function(){
try {
var err = assert.deepEqual(['a', 'b'], [1, 2]);
throw new Error('fail');
} catch (e) {}
} catch (e) {
if ('fail' == e.message) throw e;
}
});
});

Expand All @@ -96,7 +104,9 @@ describe('assert', function(){
try {
assert.notDeepEqual(['a', 'b'], ['a', 'b']);
throw new Error('fail');
} catch (e) {}
} catch (e) {
if ('fail' == e.message) throw e;
}
});
});

Expand All @@ -113,7 +123,9 @@ describe('assert', function(){
try {
assert.strictEqual(1, '1');
throw new Error('fail');
} catch (e) {}
} catch (e) {
if ('fail' == e.message) throw e;
}
});
});

Expand All @@ -130,7 +142,9 @@ describe('assert', function(){
try {
var err = assert.notStrictEqual('1', '1');
throw new Error('fail');
} catch (e) {}
} catch (e) {
if ('fail' == e.message) throw e;
}
});
});

Expand All @@ -145,9 +159,11 @@ describe('assert', function(){

it('should fail', function(){
try {
assert.throws(function(){ throw new Error; });
assert.throws(function(){});
throw new Error('fail');
} catch (e) {}
} catch (e) {
if ('fail' == e.message) throw e;
}
});
});

Expand All @@ -164,7 +180,9 @@ describe('assert', function(){
try {
assert.doesNotThrow(function(){ throw new Error; });
throw new Error('fail');
} catch (e) {}
} catch (e) {
if ('fail' == e.message) throw e;
}
});
});
});

0 comments on commit 7d6d757

Please sign in to comment.