-
-
Notifications
You must be signed in to change notification settings - Fork 390
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 tests for warnings when passing block to creation of new IO object #1087
Conversation
205beee
to
7b9bb21
Compare
Looks good. It seems this case is missing also for |
https://github.com/ruby/spec/blob/master/library/stringio/new_spec.rb
|
7b9bb21
to
ba2ad56
Compare
Added |
@@ -2,5 +2,13 @@ | |||
require_relative 'shared/new' | |||
|
|||
describe "UNIXServer.new" do | |||
it_behaves_like :unixserver_new, :new | |||
platform_is_not :windows do |
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.
Could you move the platform_is_not
outside? Because UNIXServer is not even defined on Windows (actually it is in some cases but we are ignoring that so far to keep things simple). Same below.
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 extended this one a little bit to keep things consistent:
- Replace
platform_is_not :windows
withwith_feature :unix_socket
, which looks a bit more generic. The current code had both in use. This could resolve the "in some cases on Windows", dependign on the implementation ofwith_feature
. - Move these guards to the outer block in all spec files, and remove them from the shared 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.
Great, that's even better, thank you!
Normalize to `with_feature :unix_socket`, which is more descriptive and generic than checking for windows.
Normalize to `with_feature :unix_socket`, which is more descriptive and generic than checking for windows.
Update the spec for StringIO.new to match the style of the other ones, and include the check to see the block is not used.
ba2ad56
to
61167fd
Compare
I think these were all
IO
subclasses, which means I probably missed half of them.I used the syntax
IO::open
instead ofIO.open
in the descriptions of the tests, since that is what the warnings say.