mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-25 12:44:14 +00:00
commit
1c9a28e264
1241
ctx_test.go
1241
ctx_test.go
File diff suppressed because it is too large
Load Diff
22
utils.go
22
utils.go
@ -10,11 +10,33 @@ import (
|
||||
"hash/crc32"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// AssertEqual checks if values are equal
|
||||
func assertEqual(t testing.TB, a interface{}, b interface{}, message ...string) {
|
||||
if reflect.DeepEqual(a, b) {
|
||||
return
|
||||
}
|
||||
_, file, line, _ := runtime.Caller(1)
|
||||
msg := fmt.Sprintf(`
|
||||
Test: %s
|
||||
Trace: %s:%d
|
||||
Error: Not equal
|
||||
Expect: %v [%s]
|
||||
Result: %v [%s]`, t.Name(), filepath.Base(file), line, a, reflect.TypeOf(a).Name(), b, reflect.TypeOf(b).Name())
|
||||
if len(message) > 0 {
|
||||
msg += "\n Message: " + message[0]
|
||||
}
|
||||
t.Fatal(msg)
|
||||
}
|
||||
|
||||
// Generate and set ETag header to response
|
||||
func setETag(ctx *Ctx, weak bool) {
|
||||
body := ctx.Fasthttp.Response.Body()
|
||||
|
Loading…
x
Reference in New Issue
Block a user