ruby-changes:58393
From: zverok <ko1@a...>
Date: Thu, 24 Oct 2019 18:46:13 +0900 (JST)
Subject: [ruby-changes:58393] 913807bd6c (master): [ruby/date] Simplify #inspect
https://git.ruby-lang.org/ruby.git/commit/?id=913807bd6c From 913807bd6ce98d3d362d27caef4f5e2aef0e5d79 Mon Sep 17 00:00:00 2001 From: zverok <zverok.offline@g...> Date: Sun, 11 Aug 2019 13:50:20 +0300 Subject: [ruby/date] Simplify #inspect https://github.com/ruby/date/commit/af01edd7d8 diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 9e4a4f2..e00748f 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -6573,11 +6573,8 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L6573 mk_inspect(union DateData *x, VALUE klass, VALUE to_s) { return rb_enc_sprintf(rb_usascii_encoding(), - "#<%"PRIsVALUE": %"PRIsVALUE" " - "((%+"PRIsVALUE"j,%ds,%+"PRIsVALUE"n),%+ds,%.0fj)>", - klass, to_s, - m_real_jd(x), m_df(x), m_sf(x), - m_of(x), m_sg(x)); + "#<%"PRIsVALUE": %"PRIsVALUE">", + klass, to_s); } /* diff --git a/test/date/test_switch_hitter.rb b/test/date/test_switch_hitter.rb index bdf299e..5c5a1bb 100644 --- a/test/date/test_switch_hitter.rb +++ b/test/date/test_switch_hitter.rb @@ -282,8 +282,10 @@ class TestSH < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/date/test_switch_hitter.rb#L282 def test_inspect d = Date.new(2001, 2, 3) assert_equal(Encoding::US_ASCII, d.inspect.encoding) + assert_equal('#<Date: 2001-02-03>', d.inspect) d = DateTime.new(2001, 2, 3) assert_equal(Encoding::US_ASCII, d.inspect.encoding) + assert_equal('#<DateTime: 2001-02-03T00:00:00+00:00>', d.inspect) end def test_strftime -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/