-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Description
Hi! I was investigating a tide routing issue (http-rs/tide#593) and discovered that it's resolved on master but not in 0.1.13. It must have been a subtle bug, because it doesn't seem like any of the changes between master and 0.1.13 directly address this.
This is a route-recognizer test case that fails in 0.1.13 but passes in master:
#[test]
fn ambiguous_router_wildcard_vs_star() {
let mut router = Router::new();
router.add("/:one/:two", "one/two".to_string());
router.add("/posts/*", "posts/*".to_string());
let id = router.recognize("/posts/10").unwrap();
assert_eq!(*id.handler, "posts/*".to_string());
}
/*
0.1.13:
---- ambiguous_router_wildcard_vs_star stdout ----
thread 'ambiguous_router_wildcard_vs_star' panicked at 'assertion failed: `(left == right)`
left: `"one/two"`,
right: `"posts/*"`'
Master: passes
*/As a side note, it also seems that there's a breaking change regarding anonymous wildcards. This test case passes in 0.1.13, but fails on master:
#[test]
fn anonymous_wildcard() {
let mut router = Router::new();
router.add("/a/:/:c", "".to_string());
let route = router.recognize("/a/10/20").unwrap();
assert_eq!(route.params, two_params("", "10", "c", "20"));
}
/*
0.1.13: Passes
Master:
---- tests::anonymous_wildcard stdout ----
thread 'tests::anonymous_wildcard' panicked at 'assertion failed: `(left == right)`
left: `Params { map: {"c": "20"} }`,
right: `Params { map: {"": "10", "c": "20"} }`'
*/I don't think this regression is especially important for tide, but it would be very nice to have a release with the first fix.
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels