StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
795 B
32 lines
795 B
var Code = require('code'),
|
|
Lab = require('lab'),
|
|
lab = Lab.script(),
|
|
jph = require('..'); // 'json-parse-helpfulerror'
|
|
|
|
exports.lab = lab;
|
|
|
|
lab.test('can parse', function (done) {
|
|
var o = jph.parse('{"foo": "bar"}');
|
|
|
|
Code.expect(o.foo).to.equal('bar');
|
|
done();
|
|
});
|
|
|
|
lab.test('helpful error for bad JSON', function (done) {
|
|
|
|
var bad = "{'foo': 'bar'}";
|
|
|
|
Code.expect(function () { JSON.parse(bad) }).to.throw();
|
|
|
|
Code.expect(function () { jph.parse(bad) }).to.throw(SyntaxError, "Unexpected token '\\'' at 1:2\n" + bad + '\n ^');
|
|
|
|
done();
|
|
});
|
|
|
|
lab.test('fails if reviver throws', function (done) {
|
|
function badReviver() { throw new ReferenceError('silly'); }
|
|
|
|
Code.expect(function () { jph.parse('3', badReviver) }).to.throw(ReferenceError, 'silly');
|
|
|
|
done();
|
|
}); |