properties-parser
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -270,3 +270,3 @@ var fs = require("fs"); | ||
} else if(range.type === "key-value") { | ||
range.children[2] = { type: "literal", text: val, parent: range }; | ||
range.children[2] = { type: "literal", text: val }; | ||
} else { | ||
@@ -295,3 +295,2 @@ throw "Unknown node type: " + range.type; | ||
buffer.push(node.text); | ||
if(node.parent) { buffer.push(text.substring(node.end, node.parent.end)); } | ||
break; | ||
@@ -298,0 +297,0 @@ case "key": |
{ "name": "properties-parser" | ||
, "version": "0.2.2" | ||
, "version": "0.2.3" | ||
, "description": "A parser for .properties files written in javascript" | ||
@@ -4,0 +4,0 @@ , "keywords": [ "parser", ".properties", "properties", "java", "file parser", "actionscript" ] |
@@ -87,4 +87,38 @@ var fs = require("fs"); | ||
prop.createEditor("./test-cases.properties", function(err, editor) { | ||
var properties = {}; | ||
properties.lala = 'whatever'; | ||
properties.website = 'whatever'; | ||
properties.language = 'whatever'; | ||
properties.message = 'whatever'; | ||
properties['key with spaces'] = 'whatever'; | ||
properties.tab = 'whatever'; | ||
properties['long-unicode'] = 'whatever'; | ||
properties['another-test'] = 'whatever'; | ||
for (var item in properties) { | ||
editor.set(item, properties[item]); | ||
} | ||
assert.equal( | ||
editor.toString(), | ||
'# You are reading the ".properties" entry.\n' + | ||
'! The exclamation mark can also mark text as comments.\n' + | ||
'lala=whatever\n' + | ||
'website = whatever\n' + | ||
'language = whatever\n' + | ||
'# The backslash below tells the application to continue reading\n' + | ||
'# the value onto the next line.\n' + | ||
'message = whatever\n' + | ||
'# Add spaces to the key\n' + | ||
'key\\ with\\ spaces = whatever\n' + | ||
'# Unicode\n' + | ||
'tab : whatever\n' + | ||
'long-unicode : whatever\n' + | ||
'space\\ separator key val \\n three\n' + | ||
'another-test :whatever\n' + | ||
' null-prop' | ||
); | ||
}); | ||
// java ReadProperties test-cases.properties | ||
// javac ReadProperties.java |
23197
9
398