summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/pelletier/go-toml/keysparsing_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/pelletier/go-toml/keysparsing_test.go')
-rw-r--r--vendor/github.com/pelletier/go-toml/keysparsing_test.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/vendor/github.com/pelletier/go-toml/keysparsing_test.go b/vendor/github.com/pelletier/go-toml/keysparsing_test.go
index 1a9ecccaa..7aa4cd64a 100644
--- a/vendor/github.com/pelletier/go-toml/keysparsing_test.go
+++ b/vendor/github.com/pelletier/go-toml/keysparsing_test.go
@@ -22,7 +22,10 @@ func testResult(t *testing.T, key string, expected []string) {
}
func testError(t *testing.T, key string, expectedError string) {
- _, err := parseKey(key)
+ res, err := parseKey(key)
+ if err == nil {
+ t.Fatalf("Expected error, but succesfully parsed key %s", res)
+ }
if fmt.Sprintf("%s", err) != expectedError {
t.Fatalf("Expected error \"%s\", but got \"%s\".", expectedError, err)
}
@@ -47,6 +50,17 @@ func TestBaseKeyPound(t *testing.T) {
func TestQuotedKeys(t *testing.T) {
testResult(t, `hello."foo".bar`, []string{"hello", "foo", "bar"})
testResult(t, `"hello!"`, []string{"hello!"})
+ testResult(t, `"hello\tworld"`, []string{"hello\tworld"})
+ testResult(t, `"\U0001F914"`, []string{"\U0001F914"})
+ testResult(t, `"\u2764"`, []string{"\u2764"})
+
+ testResult(t, `hello.'foo'.bar`, []string{"hello", "foo", "bar"})
+ testResult(t, `'hello!'`, []string{"hello!"})
+ testResult(t, `'hello\tworld'`, []string{`hello\tworld`})
+
+ testError(t, `"\w"`, `invalid escape sequence \w`)
+ testError(t, `"\`, `unfinished escape sequence`)
+ testError(t, `"\t`, `mismatched quotes`)
}
func TestEmptyKey(t *testing.T) {