Issue #1466
(t *testing.T)
| 2415 | |
| 2416 | // Issue #1466 |
| 2417 | func TestRouterParam1466(t *testing.T) { |
| 2418 | e := New() |
| 2419 | |
| 2420 | e.POST("/users/signup", handlerFunc) |
| 2421 | e.POST("/users/signup/bulk", handlerFunc) |
| 2422 | e.POST("/users/survey", handlerFunc) |
| 2423 | |
| 2424 | e.GET("/users/:username", handlerFunc) |
| 2425 | e.GET("/interests/:name/users", handlerFunc) |
| 2426 | e.GET("/skills/:name/users", handlerFunc) |
| 2427 | // Additional routes for Issue 1479 |
| 2428 | e.GET("/users/:username/likes/projects/ids", handlerFunc) |
| 2429 | e.GET("/users/:username/profile", handlerFunc) |
| 2430 | e.GET("/users/:username/uploads/:type", handlerFunc) |
| 2431 | |
| 2432 | var testCases = []struct { |
| 2433 | expectError error |
| 2434 | expectParam map[string]string |
| 2435 | whenURL string |
| 2436 | expectRoute string |
| 2437 | }{ |
| 2438 | { |
| 2439 | whenURL: "/users/ajitem", |
| 2440 | expectRoute: "/users/:username", |
| 2441 | expectParam: map[string]string{"username": "ajitem"}, |
| 2442 | }, |
| 2443 | { |
| 2444 | whenURL: "/users/sharewithme", |
| 2445 | expectRoute: "/users/:username", |
| 2446 | expectParam: map[string]string{"username": "sharewithme"}, |
| 2447 | }, |
| 2448 | { // route `/users/signup` is registered for POST. so param route `/users/:username` (lesser priority) is matched as it has GET handler |
| 2449 | whenURL: "/users/signup", |
| 2450 | expectRoute: "/users/:username", |
| 2451 | expectParam: map[string]string{"username": "signup"}, |
| 2452 | }, |
| 2453 | // Additional assertions for #1479 |
| 2454 | { |
| 2455 | whenURL: "/users/sharewithme/likes/projects/ids", |
| 2456 | expectRoute: "/users/:username/likes/projects/ids", |
| 2457 | expectParam: map[string]string{"username": "sharewithme"}, |
| 2458 | }, |
| 2459 | { |
| 2460 | whenURL: "/users/ajitem/likes/projects/ids", |
| 2461 | expectRoute: "/users/:username/likes/projects/ids", |
| 2462 | expectParam: map[string]string{"username": "ajitem"}, |
| 2463 | }, |
| 2464 | { |
| 2465 | whenURL: "/users/sharewithme/profile", |
| 2466 | expectRoute: "/users/:username/profile", |
| 2467 | expectParam: map[string]string{"username": "sharewithme"}, |
| 2468 | }, |
| 2469 | { |
| 2470 | whenURL: "/users/ajitem/profile", |
| 2471 | expectRoute: "/users/:username/profile", |
| 2472 | expectParam: map[string]string{"username": "ajitem"}, |
| 2473 | }, |
| 2474 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…