Skip to content
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

Kernel#eval when called with two arguments will use "(eval)" for __FI…LE__ and 1 for __LINE__ in the evaluated code. #881

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions core/kernel/eval_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ class Object
end
end

ruby_version_is "3.0" do
context 'with two arguments ' do
platform_is_not :windows do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails on Windows with this error message 🤔

A child mspec-run process printed unexpected output on STDOUT: "[\"(eval)\", 1]\r\n" while running D:/a/spec/spec/core/kernel/eval_spec.rb

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For mspec -j one cannot print to STDOUT.
The p below is unnecessary and causing that issue, we can just remove it.

it 'will use (eval) for __FILE__ and 1 for __LINE__' do
eval("p [__FILE__, __LINE__]", binding).should == ["(eval)", 1]
end
end
end
end

# Found via Rubinius bug github:#149
it "does not alter the value of __FILE__ in the binding" do
first_time = EvalSpecs.call_eval
Expand Down
10 changes: 6 additions & 4 deletions library/socket/tcpsocket/shared/new.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
}
end

it 'raises Errno::ETIMEDOUT with :connect_timeout when no server is listening on the given address' do
-> {
TCPSocket.send(@method, "192.0.2.1", 80, connect_timeout: 0)
}.should raise_error(Errno::ETIMEDOUT)
ruby_version_is "3.0" do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this block was missing on this commit 66edbec

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks :)

it 'raises Errno::ETIMEDOUT with :connect_timeout when no server is listening on the given address' do
-> {
TCPSocket.send(@method, "192.0.2.1", 80, connect_timeout: 0)
}.should raise_error(Errno::ETIMEDOUT)
end
end

describe "with a running server" do
Expand Down