-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Add test cases for non-utf8 paths #11872
Conversation
@huonw r? |
@@ -573,6 +575,16 @@ mod test { | |||
} | |||
|
|||
#[test] | |||
fn test_non_utf8_glob() { | |||
let mut p = os::tmpdir(); | |||
p.push("\xe5"); |
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.
This is still a UTF-8 path: it's just the 0xE5'th codepoint, i.e. two bytes (any and every string in Rust is UTF-8).
I guess .push([0xff])
may work.
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.
I can't push [0xff]
unless it's converted to str
which would end up on the same case I submitted. The point of this specific test is to create that directory and then call glob
. Current version creates a directory named å
under /tmp.
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.
You can push things other than strings, and you have to push something other than a string for this to be a valid test, because otherwise you have a UTF-8 path.
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.
(I guess it may have to be &[0xFF]
or it may not be able to find the BytesContainer
impl.)
not ready to be merged yet. The glob test fails! Will work on it later! |
Yay, the glob test fails! That's because it's finally correct ;) Glob itself doesn't match properly against UTF-8 pathnames. It ignores them, and that's because the code was written to use strings. Line 136 of It's also possible that |
After investigating some more, my issue with |
Since glob is still broken, I'll abandon this PR and submit one with tests just for I copied the |
New issue filed for |
add lint against unit tests in doctests During RustLab, Alice Ryhl brought to my attention that the Andoid team stumbled over the fact that if one attempts to write a unit test within a doctest, it will be summarily ignored. So this lint should help people wondering why their tests won't run. --- changelog: New lint: [`test_attr_in_doctest`] [rust-lang#11872](rust-lang/rust-clippy#11872)
closes #9406