(t *testing.T)
| 912 | } |
| 913 | |
| 914 | func TestTreeExpandParamsCapacity(t *testing.T) { |
| 915 | data := []struct { |
| 916 | path string |
| 917 | }{ |
| 918 | {"/:path"}, |
| 919 | {"/*path"}, |
| 920 | } |
| 921 | |
| 922 | for _, item := range data { |
| 923 | tree := &node{} |
| 924 | tree.addRoute(item.path, fakeHandler(item.path)) |
| 925 | params := make(Params, 0) |
| 926 | |
| 927 | value := tree.getValue("/test", ¶ms, getSkippedNodes(), false) |
| 928 | |
| 929 | if value.params == nil { |
| 930 | t.Errorf("Expected %s params to be set, but they weren't", item.path) |
| 931 | continue |
| 932 | } |
| 933 | |
| 934 | if len(*value.params) != 1 { |
| 935 | t.Errorf("Wrong number of %s params: got %d, want %d", |
| 936 | item.path, len(*value.params), 1) |
| 937 | continue |
| 938 | } |
| 939 | } |
| 940 | } |
| 941 | |
| 942 | func TestTreeWildcardConflictEx(t *testing.T) { |
| 943 | conflicts := [...]struct { |
nothing calls this directly
no test coverage detected