summaryrefslogtreecommitdiff
path: root/spec/ruby/core/thread
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2022-11-07 20:05:30 +0100
committerBenoit Daloze <eregontp@gmail.com>2022-11-07 20:05:30 +0100
commit83decbb62b8b3f1638927033f12b55f9b11f78c6 (patch)
tree8995f5b5cdb615f3d19edded66c6a9a9e82f159c /spec/ruby/core/thread
parentc99e4c427897e82a3419abed894d28705f70fa13 (diff)
Update to ruby/spec@740ccc8
Diffstat (limited to 'spec/ruby/core/thread')
-rw-r--r--spec/ruby/core/thread/backtrace/limit_spec.rb15
-rw-r--r--spec/ruby/core/thread/native_thread_id_spec.rb15
2 files changed, 30 insertions, 0 deletions
diff --git a/spec/ruby/core/thread/backtrace/limit_spec.rb b/spec/ruby/core/thread/backtrace/limit_spec.rb
new file mode 100644
index 0000000000..26a87a806c
--- /dev/null
+++ b/spec/ruby/core/thread/backtrace/limit_spec.rb
@@ -0,0 +1,15 @@
+require_relative '../../../spec_helper'
+
+ruby_version_is "3.1" do
+ describe "Thread::Backtrace.limit" do
+ it "returns maximum backtrace length set by --backtrace-limit command-line option" do
+ out = ruby_exe("print Thread::Backtrace.limit", options: "--backtrace-limit=2")
+ out.should == "2"
+ end
+
+ it "returns -1 when --backtrace-limit command-line option is not set" do
+ out = ruby_exe("print Thread::Backtrace.limit")
+ out.should == "-1"
+ end
+ end
+end
diff --git a/spec/ruby/core/thread/native_thread_id_spec.rb b/spec/ruby/core/thread/native_thread_id_spec.rb
new file mode 100644
index 0000000000..5a6c0c8632
--- /dev/null
+++ b/spec/ruby/core/thread/native_thread_id_spec.rb
@@ -0,0 +1,15 @@
+require_relative '../../spec_helper'
+
+ruby_version_is "3.1" do
+ describe "Thread#native_thread_id" do
+ it "returns an integer when the thread is alive" do
+ Thread.current.native_thread_id.should be_kind_of(Integer)
+ end
+
+ it "returns nil when the thread is not running" do
+ t = Thread.new {}
+ t.join
+ t.native_thread_id.should == nil
+ end
+ end
+end