Skip to content

Commit

Permalink
test unsupported type
Browse files Browse the repository at this point in the history
  • Loading branch information
syntaqx committed Jun 28, 2024
1 parent 01ed790 commit 3507a2b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cookie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,21 @@ func TestPopulateFromCookies(t *testing.T) {
t.Errorf("Expected TimeField %v, got %v", expectedTime, dest.TimeField)
}
}

func TestPopulateFromCookies_UnsupportedType(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
r.AddCookie(&http.Cookie{
Name: "myCookie",
Value: "myValue",
})

type MyStruct struct {
Unsupported complex64 `cookie:"myCookie"`
}

dest := &MyStruct{}
err := PopulateFromCookies(r, dest)
if err == nil {
t.Error("Expected error, got nil")
}
}

0 comments on commit 3507a2b

Please sign in to comment.