mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
Added a test for AppendHTTPDate
This commit is contained in:
@@ -2,8 +2,28 @@ package fasthttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestAppendHTTPDate(t *testing.T) {
|
||||
d := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
|
||||
s := string(AppendHTTPDate(nil, d))
|
||||
expectedS := "Tue, 10 Nov 2009 23:00:00 GMT"
|
||||
if s != expectedS {
|
||||
t.Fatalf("unexpected date %q. Expecting %q", s, expectedS)
|
||||
}
|
||||
|
||||
b := []byte("prefix")
|
||||
s = string(AppendHTTPDate(b, d))
|
||||
if s[:len(b)] != string(b) {
|
||||
t.Fatalf("unexpected prefix %q. Expecting %q", s[:len(b)], b)
|
||||
}
|
||||
s = s[len(b):]
|
||||
if s != expectedS {
|
||||
t.Fatalf("unexpected date %q. Expecting %q", s, expectedS)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseUintSuccess(t *testing.T) {
|
||||
testParseUintSuccess(t, "0", 0)
|
||||
testParseUintSuccess(t, "123", 123)
|
||||
|
||||
Reference in New Issue
Block a user