mirror of
https://github.com/gin-gonic/gin.git
synced 2025-12-13 13:12:17 +08:00
23 lines
300 B
Go
23 lines
300 B
Go
package gin
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestRoutesConcurrent(t *testing.T) {
|
|
r := New()
|
|
|
|
done := make(chan bool)
|
|
|
|
// Concurrently read routes
|
|
go func() {
|
|
_ = r.Routes()
|
|
done <- true
|
|
}()
|
|
|
|
// Register a route at the same time
|
|
r.GET("/", func(c *Context) { c.String(200, "OK") })
|
|
|
|
<-done
|
|
}
|