mirror of
https://github.com/gin-gonic/gin.git
synced 2026-11-22 02:43:36 +08:00
Merge c58089110a51c9e0fa585c5a1c962ca989251359 into 0f09c3a9b4626d9fe9979cf4d0521d6ae32ab646
This commit is contained in:
commit
104f6a790f
@ -800,6 +800,29 @@ func TestContextCopyNilErrorsAndAccepted(t *testing.T) {
|
||||
assert.Nil(t, cp.Accepted)
|
||||
}
|
||||
|
||||
func TestContextCopyRace(t *testing.T) {
|
||||
c := &Context{}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for range 1000 {
|
||||
c.Set("foo", "bar")
|
||||
}
|
||||
}()
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for range 1000 {
|
||||
c.Copy()
|
||||
}
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func TestContextHandlerName(t *testing.T) {
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
c.handlers = HandlersChain{func(c *Context) {}, handlerNameTest}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user