summaryrefslogtreecommitdiff
path: root/test/simple/test-ini.js
blob: c9d0f8897f1d5fb314e89bdaf06755a33714610d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
process.mixin(require("../common"));
var path = require('path');
var fs = 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');

});