(t *testing.T)
| 99 | } |
| 100 | |
| 101 | func TestTreeAddAndGet(t *testing.T) { |
| 102 | tree := &node{} |
| 103 | |
| 104 | routes := [...]string{ |
| 105 | "/hi", |
| 106 | "/contact", |
| 107 | "/co", |
| 108 | "/c", |
| 109 | "/a", |
| 110 | "/ab", |
| 111 | "/doc/", |
| 112 | "/doc/go_faq.html", |
| 113 | "/doc/go1.html", |
| 114 | "/α", |
| 115 | "/β", |
| 116 | } |
| 117 | for _, route := range routes { |
| 118 | tree.addRoute(route, fakeHandler(route)) |
| 119 | } |
| 120 | |
| 121 | checkRequests(t, tree, testRequests{ |
| 122 | {"/a", false, "/a", nil}, |
| 123 | {"/", true, "", nil}, |
| 124 | {"/hi", false, "/hi", nil}, |
| 125 | {"/contact", false, "/contact", nil}, |
| 126 | {"/co", false, "/co", nil}, |
| 127 | {"/con", true, "", nil}, // key mismatch |
| 128 | {"/cona", true, "", nil}, // key mismatch |
| 129 | {"/no", true, "", nil}, // no matching child |
| 130 | {"/ab", false, "/ab", nil}, |
| 131 | {"/α", false, "/α", nil}, |
| 132 | {"/β", false, "/β", nil}, |
| 133 | }) |
| 134 | |
| 135 | checkPriorities(t, tree) |
| 136 | } |
| 137 | |
| 138 | func TestTreeWildcard(t *testing.T) { |
| 139 | tree := &node{} |
nothing calls this directly
no test coverage detected