(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestSwitchJoin(t *testing.T) { |
| 11 | myapp := iris.New() |
| 12 | customFilter := func(ctx iris.Context) bool { |
| 13 | pass, _ := ctx.URLParamBool("filter") |
| 14 | return pass |
| 15 | } |
| 16 | |
| 17 | joinedCases := Join{ |
| 18 | SwitchCase{ |
| 19 | Filter: customFilter, |
| 20 | App: myapp, |
| 21 | }, |
| 22 | Hosts{{Pattern: "^test.*$", Target: myapp}}, |
| 23 | } |
| 24 | |
| 25 | cases := []SwitchCase{ |
| 26 | { |
| 27 | Filter: customFilter, |
| 28 | App: myapp, |
| 29 | }, |
| 30 | {Filter: hostFilter("^test.*$"), App: myapp}, |
| 31 | } |
| 32 | |
| 33 | if expected, got := fmt.Sprintf("%#+v", cases), fmt.Sprintf("%#+v", joinedCases.GetSwitchCases()); expected != got { |
| 34 | t.Fatalf("join does not match with the expected slice of cases, expected:\n%s\nbut got:\n%s", expected, got) |
| 35 | } |
| 36 | |
| 37 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…