pyconf.js/test.js

27 lines
673 B
JavaScript
Raw Normal View History

2015-12-15 07:07:04 +00:00
'use strict';
//var pyconf = require('pyconf');
var pyconf = require('./');
2015-12-15 07:10:32 +00:00
pyconf.readFile('doesnt-exist.conf', function (err, obj) {
if (!err || obj) {
console.error("didn't get an error (or also got an object) when testing on non-existant file");
process.exit(1);
}
});
2015-12-15 07:07:04 +00:00
pyconf.readFile('example.conf', function (err, obj) {
if (err) {
console.error(err.stack);
return;
}
pyconf.writeFile('example.conf.new', obj, function (err) {
if (err) {
console.error(err.stack);
return;
}
console.log("Run this command to check that the outputs are the same:");
console.log(" diff example.conf example.conf.new");
});
});