Closed taralx closed 3 years ago
Working up tests for each of these with explanations (of each)
There are definitely some nuances... in practice, itty supports very few regex patterns, aside from a few "happy little accidents", due to the nature of this all being regex-that-generates-regex (you lose most common patterns in translation without a lot of additional work/chars to escape everything).
Dang... glad you wrote these test cases up... easy enough to put them into the bulk route tester (with my expectations), where I found several of my expectations were not met... ðŸ˜
Gotta run an errand, but (without the explanations in code comments, here's the outcome... I'll take a stab at addressing that regex... there are a couple in here particularly worrisome (e.g. the last fail)
And the last two look OK as well
Extensive tests in the two (about to be) merged branches around your proposal document a bit more of the expected behavior. We should consider this addressed there - if you disagree, feel free to re-open!
I'm trying to interpret some of the regex stuff in the tests, and I don't really understand it. Here's a few cases I think will help me understand better. For each one, should the path match the route or not?
/x\|y
/y
/x/y\|z
/z
/x/y\|/z
/x/z
/xy*
/x
/xy*
/xyz
/:x.y
/a.x.y
/x.y
/xay
/xy{2}
/xyxy
/xy{2}
/xy/xy
/:x.:y
/a.b.c
/test.:x
/test.a.b
Also, are these just errors, or should they have reasonable meanings?
/:x?.y
/x/:y*