0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/test/simple/test-ini.js
2010-03-05 16:17:57 -08:00

23 lines
714 B
JavaScript

process.mixin(require("../common"));
require("fs");
parse = require("ini").parse;
debug("load fixtures/fixture.ini");
p = path.join(fixturesDir, "fixture.ini");
fs.readFile(p,function(err, data) {
if (err) throw err;
assert.equal(typeof parse, 'function');
var iniContents = parse(data);
assert.equal(typeof iniContents, 'object');
assert.deepEqual(iniContents,{"-":{"root":"something"},"section":{"one":"two","Foo":"Bar","this":"Your Mother!","blank":""},"Section Two":{"something else":"blah","remove":"whitespace"}})
assert.equal(iniContents['-']['root'],'something');
assert.equal(iniContents['section']['blank'],'');
assert.equal(iniContents['Section Two']['remove'],'whitespace');
});