-
-
Notifications
You must be signed in to change notification settings - Fork 389
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 spec for Dir.glob / Dir.[] result being sorted by default #861
Conversation
core/dir/shared/glob.rb
Outdated
end | ||
|
||
it "result is sorted by default" do | ||
Dir.send(@method,'*').should == @sorted_files |
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.
Dir.send(@method,'*').should == @sorted_files | |
Dir.send(@method, '*').should == @sorted_files |
core/dir/shared/glob.rb
Outdated
@@ -38,6 +38,32 @@ | |||
end | |||
end | |||
|
|||
ruby_version_is "3.0" do | |||
before :each do | |||
@sorted_files = %w[ |
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.
It's better to just get the result and then result.should == results.sort
.
That way we don't hardcode filenames here, could you do that?
We could add It seems on Linux at least files aren't sorted, but they might luckily still be in sorted order so I don't think we can test that. |
d2c11ad
to
e28eb3d
Compare
@eregon Thank you for your feedback, I pushed the changes you suggested. 👍 |
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.
Thank you!
Hello 👋
From #823 :
I am not sure if or how to add a spec for
sorted: false
. As far as I understand the result may or may not differ depending on OS. Is there a reliable/deterministic sorting logic behindsorted: false
?