Rename group to table (#115)

* Rename Group to Table Fixes #45 
* Change fmt.Errorf to errors.new for simple strings
This commit is contained in:
Thomas Pelletier
2016-12-03 12:32:16 +01:00
committed by GitHub
parent d464759235
commit ce7be745f0
7 changed files with 67 additions and 66 deletions
+6 -6
View File
@@ -456,7 +456,7 @@ func TestDuplicateKeys(t *testing.T) {
func TestEmptyIntermediateTable(t *testing.T) {
_, err := Load("[foo..bar]")
if err.Error() != "(1, 2): invalid group array key: empty key group" {
if err.Error() != "(1, 2): invalid table array key: empty table key" {
t.Error("Bad error message:", err.Error())
}
}
@@ -580,12 +580,12 @@ func TestParseKeyGroupArray(t *testing.T) {
func TestParseKeyGroupArrayUnfinished(t *testing.T) {
_, err := Load("[[foo.bar]\na = 42")
if err.Error() != "(1, 10): was expecting token [[, but got unclosed key group array instead" {
if err.Error() != "(1, 10): was expecting token [[, but got unclosed table array key instead" {
t.Error("Bad error message:", err.Error())
}
_, err = Load("[[foo.[bar]\na = 42")
if err.Error() != "(1, 3): unexpected token group name cannot contain ']', was expecting a key group array" {
if err.Error() != "(1, 3): unexpected token table array key cannot contain ']', was expecting a table array key" {
t.Error("Bad error message:", err.Error())
}
}
@@ -753,13 +753,13 @@ func TestNestedTreePosition(t *testing.T) {
}
func TestInvalidGroupArray(t *testing.T) {
_, err := Load("[key#group]\nanswer = 42")
_, err := Load("[table#key]\nanswer = 42")
if err == nil {
t.Error("Should error")
}
_, err = Load("[foo.[bar]\na = 42")
if err.Error() != "(1, 2): unexpected token group name cannot contain ']', was expecting a key group" {
if err.Error() != "(1, 2): unexpected token table key cannot contain ']', was expecting a table key" {
t.Error("Bad error message:", err.Error())
}
}
@@ -773,7 +773,7 @@ func TestDoubleEqual(t *testing.T) {
func TestGroupArrayReassign(t *testing.T) {
_, err := Load("[hello]\n[[hello]]")
if err.Error() != "(2, 3): key \"hello\" is already assigned and not of type group array" {
if err.Error() != "(2, 3): key \"hello\" is already assigned and not of type table array" {
t.Error("Bad error message:", err.Error())
}
}