Skip to content

Commit

Permalink
Get rid of paranodEqual assertion library in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dervus committed Jul 5, 2014
1 parent 987adcf commit 4f0ef1e
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 283 deletions.
6 changes: 3 additions & 3 deletions test/functional/dumper.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict';


var assert = require('assert');
var path = require('path');
var jsyaml = require('../../lib/js-yaml');
var helper = require('../support/helper');

var paranoidEqual = require('../support/assert-paranoid-equal').paranoidEqual;
var TEST_SCHEMA = require('../support/schema').TEST_SCHEMA;
var TEST_SCHEMA = require('../support/schema').TEST_SCHEMA;


helper.generateTests({
Expand All @@ -24,7 +24,7 @@ helper.generateTests({
if ('function' === typeof object) {
object.call(this, deserialized);
} else {
paranoidEqual(deserialized, object);
assert.deepEqual(deserialized, object);
}
}
});
6 changes: 3 additions & 3 deletions test/functional/loader.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict';


var assert = require('assert');
var path = require('path');
var jsyaml = require('../../lib/js-yaml');
var helper = require('../support/helper');

var paranoidEqual = require('../support/assert-paranoid-equal').paranoidEqual;
var TEST_SCHEMA = require('../support/schema').TEST_SCHEMA;
var TEST_SCHEMA = require('../support/schema').TEST_SCHEMA;


helper.generateTests({
Expand All @@ -30,7 +30,7 @@ helper.generateTests({
if ('function' === typeof object2) {
object2.call(this, object1);
} else {
paranoidEqual(object1, object2);
assert.deepEqual(object1, object2);
}
}
});
33 changes: 32 additions & 1 deletion test/functional/loader/construct-custom.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use strict';

var assert = require('assert');
var schema = require('../../support/schema');

module.exports = [
var expected = [
new schema.Tag1({ x: 1 }),
new schema.Tag1({ x: 1, y: 2, z: 3 }),
new schema.Tag2({ x: 10 }),
Expand All @@ -11,3 +12,33 @@ module.exports = [
new schema.Tag3({ x: 1, y: 2, z: 3 }),
new schema.Foo({ myParameter: 'foo', myAnotherParameter: [1, 2, 3] })
];

function testHandler(actual) {
assert.strictEqual(Object.prototype.toString.call(actual), '[object Array]');
assert.strictEqual(actual.length, 7);

assert.deepEqual(actual[0], expected[0]);
assert.strictEqual(Object.getPrototypeOf(actual[0]), Object.getPrototypeOf(expected[0]));

assert.deepEqual(actual[1], expected[1]);
assert.strictEqual(Object.getPrototypeOf(actual[1]), Object.getPrototypeOf(expected[1]));

assert.deepEqual(actual[2], expected[2]);
assert.strictEqual(Object.getPrototypeOf(actual[2]), Object.getPrototypeOf(expected[2]));

assert.deepEqual(actual[3], expected[3]);
assert.strictEqual(Object.getPrototypeOf(actual[3]), Object.getPrototypeOf(expected[3]));

assert.deepEqual(actual[4], expected[4]);
assert.strictEqual(Object.getPrototypeOf(actual[4]), Object.getPrototypeOf(expected[4]));

assert.deepEqual(actual[5], expected[5]);
assert.strictEqual(Object.getPrototypeOf(actual[5]), Object.getPrototypeOf(expected[5]));

assert.deepEqual(actual[6], expected[6]);
assert.strictEqual(Object.getPrototypeOf(actual[6]), Object.getPrototypeOf(expected[6]));
}

testHandler.expected = expected;

module.exports = testHandler;
21 changes: 20 additions & 1 deletion test/functional/loader/construct-float.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
'use strict';

module.exports = {
var assert = require('assert');

var expected = {
'canonical': 685230.15,
'exponential': 685230.15,
'fixed': 685230.15,
'sexagesimal': 685230.15,
'negative infinity': Number.NEGATIVE_INFINITY,
'not a number': NaN
};

function testHandler(actual) {
assert.strictEqual(Object.prototype.toString.call(actual), '[object Object]');
assert.strictEqual(Object.keys(actual).sort().join(','), Object.keys(expected).sort().join(','));

assert.strictEqual(actual['canonical'], expected['canonical']);
assert.strictEqual(actual['exponential'], expected['exponential']);
assert.strictEqual(actual['fixed'], expected['fixed']);
assert.strictEqual(actual['sexagesimal'], expected['sexagesimal']);
assert.strictEqual(actual['negative infinity'], expected['negative infinity']);

assert(Number.isNaN(actual['not a number']));
}

testHandler.expected = expected;

module.exports = testHandler;
20 changes: 19 additions & 1 deletion test/functional/loader/more-floats.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

module.exports = [
var assert = require('assert');

var expected = [
0.0,
1.0,
-1.0,
Expand All @@ -9,3 +11,19 @@ module.exports = [
NaN,
NaN
];

function testHandler(actual) {
assert.strictEqual(Object.prototype.toString.call(actual), '[object Array]');
assert.strictEqual(actual.length, 7);
assert.strictEqual(actual[0], expected[0]);
assert.strictEqual(actual[1], expected[1]);
assert.strictEqual(actual[2], expected[2]);
assert.strictEqual(actual[3], expected[3]);
assert.strictEqual(actual[4], expected[4]);
assert(Number.isNaN(actual[5]));
assert(Number.isNaN(actual[6]));
}

testHandler.expected = expected;

module.exports = testHandler;
30 changes: 0 additions & 30 deletions test/support/assert-paranoid-equal.js

This file was deleted.

16 changes: 0 additions & 16 deletions test/support/assert-paranoid-equal/context.js

This file was deleted.

117 changes: 0 additions & 117 deletions test/support/assert-paranoid-equal/inspectors.js

This file was deleted.

55 changes: 0 additions & 55 deletions test/support/assert-paranoid-equal/report.js

This file was deleted.

Loading

0 comments on commit 4f0ef1e

Please sign in to comment.