-
-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
find: support escaping backslash, fix double-bolding, and add basic tests #2589
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, I love that you are using the testing tools for that. I'm happy to see it works quite well. I've suggested a couple of quick changes, that makes the test less reliable on hard-coded value (the user's nick).
I think it would be valuable to add two other tests:
- one where there are 2 users, and one say something, the other use the replace feature
- one where a user replace the replaced line
And with that, I believe we would have a pretty good set of tests.
29e1da0
to
cc2f6e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Points well taken about additional tests. I added a few more test cases, and also fixed another bug: the double-\x02
wrapping of replacements inside previous replacements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love to see it!
Co-authored-by: Florian Strzelecki <florian.strzelecki@gmail.com>
Check that correcting someone else's line works as expected, and check that replacing an already-replaced line works as expected. Also check that case-insensitive (i) and global (g) flags work as expected, both separately and together. Note: There is a glitch in formatting when the new replacement occurs inside the previous one, since the bolding used to indicate what changed is kept in the stored line. We might wish to fix that at some point, but the new test correctly represents the real behavior.
Perform the replacement with an unformatted version of the substitute string, then create a display version with bolding added only after the matching line (if any) is found. Updated the corresponding test case. Also renamed some local vars in the `find` plugin file to make a bit more sense (but not too dramatic).
cc2f6e2
to
18106f8
Compare
Took care of a Side benefit: CI re-runs after a force-push, and it verified the new tests on Python 3.13 for me. 😁 |
Description
Allowing
\|
or\/
is all well and good, but if one can't escape the escape character, things get very confusing! So let's make it possible to escape\
itself as\\
.With the test scaffolding now written (OK, much of it stolen from the preexisting
test/builtins/test_builtins_isup.py
), it'll be easier to add more cases (edge or otherwise) as we think of them.Checklist
make qa
(runsmake lint
andmake test
)Notes
Early 8.0.x bugfix candidate, unless someone else feels strongly about including it in 8.0.0. Feels late in the game to add One More Thing into that milestone…