testscript: suggest misspelled commands#198
Conversation
|
Hm I just realized that this might create undesirable results for the |
|
Okay, second try :) Also over engineered the test a bit and actually found what's arguably a bug in handling invalid UTF-8 by better fuzzing. |
|
I propose #215 for the original problem :-) (and I'm ok if that doesn't get merged, though I think it's simple/straightforward, I'll maintain on my fork meanwhile) |
mvdan
left a comment
There was a problem hiding this comment.
This is quite a bit of added code, but it's useful and you've clearly put effort and polish into it, and I don't think it will cause additional maintenance burden of its own. SGTM with a couple of nits. There are conflicts as well, but I imagine they will be trivial.
|
I feel like there should be a test that the code in |
|
Look at files like |
6846479 to
1c0aeee
Compare
|
Added a couple simple tests and renamed the package PTAL |
mvdan
left a comment
There was a problem hiding this comment.
Thanks! Just one last nit about the tests.
If a command is not found, we go through the list of defined commands and check if any of them are sufficiently close to the one used. "Sufficiently close" is defined by having a Damerau-Levenshtein distance of 1, which feels like it hits the sweet spot between usefulness and ease of implementation. The negation case is still special-cased, as negation is not in the set of defined commands. Fixes rogpeppe#190
If a command is not found, we go through the list of defined commands and check if any of them are sufficiently close to the one used. "Sufficiently close" is defined by having a Damerau-Levenshtein distance of 1, which feels like it hits the sweet spot between usefulness and ease of implementation.
The negation case is still special-cased, as negation is not in the set of defined commands.
Fixes #190