diff options
author | Koichi Sasada <ko1@atdot.net> | 2019-12-11 16:10:26 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2019-12-11 16:10:26 +0900 |
commit | 1269157a6e46895c0eda2ea202d44790bbe815c8 (patch) | |
tree | 4c491371ae433aec0bf81a5405d6a9587c0391e9 | |
parent | 7f5014e6e884d7fa091e3e6462827b910417267c (diff) |
Thread#to_s is not same as #inspect on old version.
Thread#to_s returns simple Object#to_s until Ruby 2.4.
-rw-r--r-- | spec/ruby/core/thread/shared/to_s.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/ruby/core/thread/shared/to_s.rb b/spec/ruby/core/thread/shared/to_s.rb index c3718cef88..7bc7234c85 100644 --- a/spec/ruby/core/thread/shared/to_s.rb +++ b/spec/ruby/core/thread/shared/to_s.rb @@ -5,6 +5,11 @@ describe :thread_to_s, shared: true do ruby_version_is(''..."2.7"){ sep = '@' } it "returns a description including file and line number" do + ruby_version_is(''...'2.5') do + # Thread#to_s is not same as Thread#inspect until Ruby 2.4. + skip if @method == :to_s + end + Thread.new { "hello" }.send(@method).should =~ /^#<Thread:([^ ]*?)#{sep}#{Regexp.escape __FILE__}:#{__LINE__ } \w+>$/ end |