-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Consider the multibyte value in the method name of system test #2405
Conversation
Hello @y-yagi Thanks for the PR. Do you think that:
Could be expressed in a test? |
fa5a3ed
to
9fb6fef
Compare
Hi, @benoittgt. |
The feature test pass without your initial patch 😅 |
Hmmm. The feature test failed in my environment(Linux 5.4.0-54-generic, file system is ext4) without the patch.
What kind of file system do you use? |
Sorry, I missed considering APFS. APFS's maximum filename length is 255 UTF-8 characters. So if you use macOS, maybe feature test pass without my patch. |
Our feature tests are our documentation, this isn't something we want in those, a better place would be in:
|
85533a1
to
b3c9fad
Compare
Thanks, JonRowe. I moved tests to Also, I fixed to check considering OS(It seems that difficult to check file systems by Ruby's native API. So I checked the OS.). |
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.
LGTM @y-yagi
Thanks for the patch.
RSpec.current_example.description.underscore | ||
].join("_").tr(CHARS_TO_TRANSLATE.join, "_") | ||
|
||
if RbConfig::CONFIG["host_os"] =~ /linux/ |
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 thought we had something for that in https://github.com/rspec/rspec-support/blob/12069e1c1ad1852b7970e7fcd419d56a8a9e6240/lib/rspec/support/ruby_features.rb#L9 but this is not the case.
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.
Don't make it OS specific, it's fine to be shorted on all platforms to satisfy linux.
end | ||
|
||
example = group.new | ||
example_class_mock = double('name' => 'あ'*100) |
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.
Name is generated from the description class / string, set it to a long generated string instead.
RSpec.current_example.description.underscore | ||
].join("_").tr(CHARS_TO_TRANSLATE.join, "_") | ||
|
||
if RbConfig::CONFIG["host_os"] =~ /linux/ |
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.
Don't make it OS specific, it's fine to be shorted on all platforms to satisfy linux.
b3c9fad
to
49b1090
Compare
`String#[]` returns a value that considers multibyte value. But some file systems use byte for maximum filename length. So if applications use that file system and multibyte value to a method name, currently check doesn't work expected. This PR fixes to use `String#byteslice` instead of `String#[]`. Also, added `String#scrub` to avoid generating an invalid byte sequence.
49b1090
to
863a722
Compare
@JonRowe Thanks for your review. I fixed. |
Merged in ff8eaef |
Thanks for this @y-yagi I tweaked your spec lightly, but this is now merged into main and will be released as part of 5.0.1 at some point soonish |
String#[]
returns a value that considers multibyte value. But maximum filename length use bytes. So if applications use multibyte value to a method name, currently check doesn't work expected.This PR fixes to use
String#byteslice
instead ofString#[]
. Also, addedString#scrub
to avoid generating an invalid byte sequence.