ruby-changes:59184
From: Koichi <ko1@a...>
Date: Wed, 11 Dec 2019 16:21:39 +0900 (JST)
Subject: [ruby-changes:59184] 1269157a6e (master): Thread#to_s is not same as #inspect on old version.
https://git.ruby-lang.org/ruby.git/commit/?id=1269157a6e From 1269157a6e46895c0eda2ea202d44790bbe815c8 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Wed, 11 Dec 2019 16:10:26 +0900 Subject: Thread#to_s is not same as #inspect on old version. Thread#to_s returns simple Object#to_s until Ruby 2.4. diff --git a/spec/ruby/core/thread/shared/to_s.rb b/spec/ruby/core/thread/shared/to_s.rb index c3718ce..7bc7234 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/thread/shared/to_s.rb#L5 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/