(t *testing.T)
| 114 | } |
| 115 | |
| 116 | func TestTreeAddAndGet(t *testing.T) { |
| 117 | tree := &node{} |
| 118 | |
| 119 | routes := [...]string{ |
| 120 | "/hi", |
| 121 | "/contact", |
| 122 | "/co", |
| 123 | "/c", |
| 124 | "/a", |
| 125 | "/ab", |
| 126 | "/doc/", |
| 127 | "/doc/go_faq.html", |
| 128 | "/doc/go1.html", |
| 129 | "/α", |
| 130 | "/β", |
| 131 | } |
| 132 | for _, route := range routes { |
| 133 | tree.addRoute(route, fakeHandler(route)) |
| 134 | } |
| 135 | |
| 136 | //printChildren(tree, "") |
| 137 | |
| 138 | checkRequests(t, tree, testRequests{ |
| 139 | {"/a", false, "/a", nil}, |
| 140 | {"/", true, "", nil}, |
| 141 | {"/hi", false, "/hi", nil}, |
| 142 | {"/contact", false, "/contact", nil}, |
| 143 | {"/co", false, "/co", nil}, |
| 144 | {"/con", true, "", nil}, // key mismatch |
| 145 | {"/cona", true, "", nil}, // key mismatch |
| 146 | {"/no", true, "", nil}, // no matching child |
| 147 | {"/ab", false, "/ab", nil}, |
| 148 | {"/α", false, "/α", nil}, |
| 149 | {"/β", false, "/β", nil}, |
| 150 | }) |
| 151 | |
| 152 | checkPriorities(t, tree) |
| 153 | checkMaxParams(t, tree) |
| 154 | } |
| 155 | |
| 156 | func TestTreeWildcard(t *testing.T) { |
| 157 | tree := &node{} |
nothing calls this directly
no test coverage detected