|
@ -1,6 +1,7 @@ |
|
|
require("../common"); |
|
|
require("../common"); |
|
|
var path = require('path'); |
|
|
var path = require('path'), |
|
|
var fs = require("fs"); |
|
|
fs = require("fs"), |
|
|
|
|
|
ini = require("ini"), |
|
|
parse = require("ini").parse; |
|
|
parse = require("ini").parse; |
|
|
|
|
|
|
|
|
debug("load fixtures/fixture.ini"); |
|
|
debug("load fixtures/fixture.ini"); |
|
@ -15,8 +16,7 @@ fs.readFile(p,function(err, data) { |
|
|
var iniContents = parse(data); |
|
|
var iniContents = parse(data); |
|
|
assert.equal(typeof iniContents, 'object'); |
|
|
assert.equal(typeof iniContents, 'object'); |
|
|
|
|
|
|
|
|
var expect = |
|
|
var expect = { "-" : |
|
|
{ "-" : |
|
|
|
|
|
{ "root" : "something" |
|
|
{ "root" : "something" |
|
|
, "url" : "http://example.com/?foo=bar" |
|
|
, "url" : "http://example.com/?foo=bar" |
|
|
} |
|
|
} |
|
@ -34,13 +34,26 @@ fs.readFile(p,function(err, data) { |
|
|
{ "something else" : "blah" |
|
|
{ "something else" : "blah" |
|
|
, "remove" : "whitespace" |
|
|
, "remove" : "whitespace" |
|
|
} |
|
|
} |
|
|
}; |
|
|
}, |
|
|
|
|
|
expectStr = "root = something\n"+ |
|
|
|
|
|
"url = http://example.com/?foo=bar\n"+ |
|
|
|
|
|
"[the section with whitespace]\n"+ |
|
|
|
|
|
"this has whitespace = yep\n"+ |
|
|
|
|
|
"just a flag, no value.\n"+ |
|
|
|
|
|
"[section]\n"+ |
|
|
|
|
|
"one = two\n"+ |
|
|
|
|
|
"Foo = Bar\n"+ |
|
|
|
|
|
"this = Your Mother!\n"+ |
|
|
|
|
|
"blank = \n"+ |
|
|
|
|
|
"[Section Two]\n"+ |
|
|
|
|
|
"something else = blah\n"+ |
|
|
|
|
|
"remove = whitespace\n"; |
|
|
|
|
|
|
|
|
assert.deepEqual(iniContents, expect, |
|
|
assert.deepEqual(iniContents, expect, |
|
|
"actual: \n"+inspect(iniContents) +"\n≠\nexpected:\n"+inspect(expect)) |
|
|
"actual: \n"+inspect(iniContents) +"\n≠\nexpected:\n"+inspect(expect)); |
|
|
|
|
|
|
|
|
assert.equal(iniContents['-']['root'],'something'); |
|
|
|
|
|
assert.equal(iniContents['section']['blank'],''); |
|
|
|
|
|
assert.equal(iniContents['Section Two']['remove'],'whitespace'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.equal(ini.stringify(iniContents), expectStr, |
|
|
|
|
|
"actual: \n"+inspect(ini.stringify(iniContents)) +"\n≠\nexpected:\n"+inspect(expectStr)); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|