Allow numbers in keys parsing

This commit is contained in:
Thomas Pelletier
2015-07-14 19:56:28 -07:00
parent 9f36448571
commit 16a681db2a
6 changed files with 41 additions and 16 deletions
+10 -5
View File
@@ -51,12 +51,10 @@ func TestSimpleKV(t *testing.T) {
})
}
// NOTE: from the BurntSushi test suite
// NOTE: this test is pure evil due to the embedded '.'
func TestSpecialKV(t *testing.T) {
tree, err := Load("~!@$^&*()_+-`1234567890[]\\|/?><.,;: = 1")
func TestNumberInKey(t *testing.T) {
tree, err := Load("hello2 = 42")
assertTree(t, tree, err, map[string]interface{}{
"~!@$^&*()_+-`1234567890[]\\|/?><.,;:": int64(1),
"hello2": int64(42),
})
}
@@ -109,6 +107,13 @@ func TestSimpleString(t *testing.T) {
})
}
func TestSpaceKey(t *testing.T) {
tree, err := Load("\"a b\" = \"hello world\"")
assertTree(t, tree, err, map[string]interface{}{
"a b": "hello world",
})
}
func TestStringEscapables(t *testing.T) {
tree, err := Load("a = \"a \\n b\"")
assertTree(t, tree, err, map[string]interface{}{