(t *testing.T)
| 1515 | } |
| 1516 | |
| 1517 | func TestRouteInfo(t *testing.T) { |
| 1518 | e := New() |
| 1519 | c := e.NewContext(nil, nil) |
| 1520 | |
| 1521 | orgRI := RouteInfo{ |
| 1522 | Name: "root", |
| 1523 | Method: http.MethodGet, |
| 1524 | Path: "/*", |
| 1525 | Parameters: []string{"*"}, |
| 1526 | } |
| 1527 | c.route = &orgRI |
| 1528 | ri := c.RouteInfo() |
| 1529 | assert.Equal(t, orgRI, ri) |
| 1530 | |
| 1531 | // Test mutability when middlewares start to change things |
| 1532 | |
| 1533 | // RouteInfo inside context will not be affected when returned instance is changed |
| 1534 | expect := orgRI.Clone() |
| 1535 | ri.Path = "changed" |
| 1536 | ri.Parameters[0] = "changed" |
| 1537 | assert.Equal(t, expect, c.RouteInfo()) |
| 1538 | |
| 1539 | // RouteInfo inside context will not be affected when returned instance is changed |
| 1540 | expect = c.RouteInfo() |
| 1541 | orgRI.Name = "changed" |
| 1542 | assert.NotEqual(t, expect, c.RouteInfo()) |
| 1543 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…