properties-reader
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "properties-reader", | ||
"description": "Properties file reader for Node.js", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Steve King", |
@@ -99,2 +99,8 @@ (function() { | ||
} | ||
else { | ||
var replacements = {'\\n': '\n', '\\r': '\r', '\\t': '\t'}; | ||
parsedValue = value.replace(/\\[nrt]/g, function (key) { | ||
return replacements[key]; | ||
}); | ||
} | ||
@@ -101,0 +107,0 @@ return parsedValue; |
@@ -106,3 +106,15 @@ | ||
Assertions.assert(app.set.withArgs('foo.bar', 'A Value').calledOnce, 'Sets all properties'); | ||
}, | ||
'test Permits escaped new line characters': function () { | ||
var properties = givenFilePropertiesReader('\n\nsome.property= Multi\\n Line \\nString \nfoo.bar = A Value'); | ||
// parsed access modifies the new line characters | ||
Assertions.assertEquals(properties.get('foo.bar'), 'A Value', 'Sets all properties'); | ||
Assertions.assertEquals(properties.get('some.property'), 'Multi\n Line \nString', 'Sets all properties'); | ||
// raw access does not modify the new line characters | ||
Assertions.assertEquals(properties.getRaw('some.property'), 'Multi\\n Line \\nString', 'Sets all properties'); | ||
Assertions.assertEquals(properties.path().some.property, 'Multi\\n Line \\nString', 'Sets all properties'); | ||
} | ||
}); |
19742
394