aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/golang.org/x/oauth2/google/sdk_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/oauth2/google/sdk_test.go')
-rw-r--r--vendor/golang.org/x/oauth2/google/sdk_test.go63
1 files changed, 62 insertions, 1 deletions
diff --git a/vendor/golang.org/x/oauth2/google/sdk_test.go b/vendor/golang.org/x/oauth2/google/sdk_test.go
index 4489bb9..52b8eca 100644
--- a/vendor/golang.org/x/oauth2/google/sdk_test.go
+++ b/vendor/golang.org/x/oauth2/google/sdk_test.go
@@ -4,7 +4,11 @@
package google
-import "testing"
+import (
+ "reflect"
+ "strings"
+ "testing"
+)
func TestSDKConfig(t *testing.T) {
sdkConfigPath = func() (string, error) {
@@ -44,3 +48,60 @@ func TestSDKConfig(t *testing.T) {
}
}
}
+
+func TestParseINI(t *testing.T) {
+ tests := []struct {
+ ini string
+ want map[string]map[string]string
+ }{
+ {
+ `root = toor
+[foo]
+bar = hop
+ini = nin
+`,
+ map[string]map[string]string{
+ "": {"root": "toor"},
+ "foo": {"bar": "hop", "ini": "nin"},
+ },
+ },
+ {
+ "\t extra \t = whitespace \t\r\n \t [everywhere] \t \r\n here \t = \t there \t \r\n",
+ map[string]map[string]string{
+ "": {"extra": "whitespace"},
+ "everywhere": {"here": "there"},
+ },
+ },
+ {
+ `[empty]
+[section]
+empty=
+`,
+ map[string]map[string]string{
+ "": {},
+ "empty": {},
+ "section": {"empty": ""},
+ },
+ },
+ {
+ `ignore
+[invalid
+=stuff
+;comment=true
+`,
+ map[string]map[string]string{
+ "": {},
+ },
+ },
+ }
+ for _, tt := range tests {
+ result, err := parseINI(strings.NewReader(tt.ini))
+ if err != nil {
+ t.Errorf("parseINI(%q) error %v, want: no error", tt.ini, err)
+ continue
+ }
+ if !reflect.DeepEqual(result, tt.want) {
+ t.Errorf("parseINI(%q) = %#v, want: %#v", tt.ini, result, tt.want)
+ }
+ }
+}