ruby-changes:59200
From: Nobuyoshi <ko1@a...>
Date: Thu, 12 Dec 2019 02:21:37 +0900 (JST)
Subject: [ruby-changes:59200] d2d42081ce (master): `Thread#to_s` has been added at ruby 2.5
https://git.ruby-lang.org/ruby.git/commit/?id=d2d42081ce From d2d42081ce76954ff55392a6e07e3eb4f26c696c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 11 Dec 2019 16:19:49 +0900 Subject: `Thread#to_s` has been added at ruby 2.5 diff --git a/spec/ruby/core/thread/shared/to_s.rb b/spec/ruby/core/thread/shared/to_s.rb index 7bc7234..0c4e3c0 100644 --- a/spec/ruby/core/thread/shared/to_s.rb +++ b/spec/ruby/core/thread/shared/to_s.rb @@ -1,15 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/thread/shared/to_s.rb#L1 require_relative '../fixtures/classes' describe :thread_to_s, shared: true do - sep = " " - ruby_version_is(''..."2.7"){ sep = '@' } + sep = ruby_version_is("2.7") ? " " : "@" 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 diff --git a/spec/ruby/core/thread/to_s_spec.rb b/spec/ruby/core/thread/to_s_spec.rb index cb182a0..942d271 100644 --- a/spec/ruby/core/thread/to_s_spec.rb +++ b/spec/ruby/core/thread/to_s_spec.rb @@ -2,5 +2,7 @@ require_relative '../../spec_helper' https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/thread/to_s_spec.rb#L2 require_relative 'shared/to_s' describe "Thread#to_s" do - it_behaves_like :thread_to_s, :to_s + ruby_version_is "2.5" do + it_behaves_like :thread_to_s, :to_s + end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/