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

Add spec for Thread#native_thread_id #966

Merged
merged 4 commits into from
Oct 31, 2022
Merged
Changes from 3 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
31 changes: 31 additions & 0 deletions core/thread/native_thread_id_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require_relative '../../spec_helper'

ruby_version_is ''...'3.1' do
describe "Thread#native_thread_id" do
it "raises NoMethodError" do
th = Thread.new {}
-> { th.native_thread_id }.should raise_error(NoMethodError)
th.join
end
end
end
eregon marked this conversation as resolved.
Show resolved Hide resolved

ruby_version_is "3.1" do
describe "Thread#native_thread_id" do
platform_is_not :linux do
it "returns an integer" do
th = Thread.new {}
th.native_thread_id.should be_kind_of(Integer)
th.join
end
end

platform_is :linux do
it "returns nil" do
th = Thread.new {}
th.native_thread_id.should be_nil
eregon marked this conversation as resolved.
Show resolved Hide resolved
th.join
end
end
end
end