mirror of
https://github.com/labstack/echo.git
synced 2024-12-12 10:13:35 +02:00
31 lines
413 B
Go
31 lines
413 B
Go
|
// +build go1.8
|
||
|
|
||
|
package echo
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
"time"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestEchoClose(t *testing.T) {
|
||
|
e := New()
|
||
|
errCh := make(chan error)
|
||
|
|
||
|
go func() {
|
||
|
errCh <- e.Start(":0")
|
||
|
}()
|
||
|
|
||
|
time.Sleep(200 * time.Millisecond)
|
||
|
|
||
|
if err := e.Close(); err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
|
||
|
assert.NoError(t, e.Close())
|
||
|
|
||
|
err := <-errCh
|
||
|
assert.Equal(t, err.Error(), "http: Server closed")
|
||
|
}
|