mirror of
https://github.com/kataras/iris.git
synced 2025-01-24 19:21:03 +01:00
38b0a796bd
Former-commit-id: 953df27468e3905e557bb1f6a97ea431cb60f6a6
26 lines
586 B
Go
26 lines
586 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/kataras/iris/v12/httptest"
|
|
)
|
|
|
|
func TestSamePatternDifferentFuncUseGlobal(t *testing.T) {
|
|
app := newApp()
|
|
e := httptest.New(t, app)
|
|
|
|
expectedResultFmt := "Called first middleware\nCalled second middleware\n%s\nCalled done: %s"
|
|
tests := map[string]string{
|
|
"/one-num": "first route",
|
|
"/two-num": "second route",
|
|
"/three-num": "third route",
|
|
}
|
|
|
|
for path, mainBody := range tests {
|
|
result := fmt.Sprintf(expectedResultFmt, mainBody, path[1:])
|
|
e.GET(path).Expect().Status(httptest.StatusOK).Body().Equal(result)
|
|
}
|
|
}
|