summaryrefslogtreecommitdiff
path: root/types
diff options
context:
space:
mode:
Diffstat (limited to 'types')
-rw-r--r--types/cookie/cookie.go4
-rw-r--r--types/server/server_test.go25
2 files changed, 14 insertions, 15 deletions
diff --git a/types/cookie/cookie.go b/types/cookie/cookie.go
index 1582a9c..1714682 100644
--- a/types/cookie/cookie.go
+++ b/types/cookie/cookie.go
@@ -5,10 +5,10 @@
package cookie
import (
- "fmt"
"context"
- "errors"
"encoding/json"
+ "errors"
+ "fmt"
"runtime/cgo"
)
diff --git a/types/server/server_test.go b/types/server/server_test.go
index 06a6851..f3c396d 100644
--- a/types/server/server_test.go
+++ b/types/server/server_test.go
@@ -13,62 +13,62 @@ func errorString(err error) string {
}
func TestServerUnmarshal(t *testing.T) {
- cases := []struct{
- want Type
+ cases := []struct {
+ want Type
wantErr string
payload string
}{
{
- want: TypeUnknown,
+ want: TypeUnknown,
wantErr: "invalid server type: a",
payload: `{"value": "a"}`,
},
{
- want: TypeInstituteAccess,
+ want: TypeInstituteAccess,
wantErr: "",
payload: `{"value": "institute_access"}`,
},
{
- want: TypeCustom,
+ want: TypeCustom,
wantErr: "",
payload: `{"value": "custom_server"}`,
},
{
- want: TypeSecureInternet,
+ want: TypeSecureInternet,
wantErr: "",
payload: `{"value": "secure_internet"}`,
},
{
- want: TypeUnknown,
+ want: TypeUnknown,
wantErr: "",
payload: `{"value": 0}`,
},
{
- want: TypeInstituteAccess,
+ want: TypeInstituteAccess,
wantErr: "",
payload: `{"value": 1}`,
},
{
- want: TypeSecureInternet,
+ want: TypeSecureInternet,
wantErr: "",
payload: `{"value": 2}`,
},
{
- want: TypeCustom,
+ want: TypeCustom,
wantErr: "",
payload: `{"value": 3}`,
},
// Values that are outside the range will be error checked too
// This is thus even more strict than a regular type unmarshal/marshal
{
- want: TypeUnknown,
+ want: TypeUnknown,
wantErr: "invalid server type: 25",
payload: `{"value": 25}`,
},
}
for _, c := range cases {
- var got struct{
+ var got struct {
Value Type `json:"value"`
}
err := json.Unmarshal([]byte(c.payload), &got)
@@ -79,5 +79,4 @@ func TestServerUnmarshal(t *testing.T) {
t.Fatalf("server unmarshal value is not equal to want, got: %v, want: %v", got.Value, c.want)
}
}
-
}