Permalink
Browse files

Fix values with whitespace

  • Loading branch information...
1 parent 9b79cb0 commit fac20a3de66e845716232258ce219833fb1ff030 @trentm trentm committed Dec 15, 2011
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/node-iniparser.js
  2. +1 −0 test/files/test.ini
  3. +4 −0 test/test.js
View
@@ -11,7 +11,7 @@ var fs = require('fs');
*/
var regex = {
section: /^\s*\[\s*([^\]]*)\s*\]\s*$/,
- param: /^\s*([\w\.\-\_]+)\s*=\s*([^\s]*)\s*$/,
+ param: /^\s*([\w\.\-\_]+)\s*=\s*(.*?)\s*$/,
comment: /^\s*;.*$/
};
View
@@ -6,4 +6,5 @@ a.b=c
[section2]
;test=worth
+there_is=a space in here with = and trailing tab
bar=foo
View
@@ -56,5 +56,9 @@ module.exports = {
'look for a commented out variable': function(){
var config = iniparser.parseSync('./files/test.ini');
assert.equal(config.section2.test, null);
+ },
+ 'variable with space in value': function(){
+ var config = iniparser.parseSync('./files/test.ini');
+ assert.equal(config.section2.there_is, "a space in here with = and trailing tab");
}
};

0 comments on commit fac20a3

Please sign in to comment.