mirror of
https://github.com/gin-gonic/gin.git
synced 2026-11-23 11:33:37 +08:00
Merge c58089110a51c9e0fa585c5a1c962ca989251359 into 43fe48e8a0f44af783116cdb010725e6bb50255f
This commit is contained in:
commit
aac0f88aa5
@ -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