[前][次][番号順一覧][スレッド一覧]

ruby-changes:58519

From: Jeremy <ko1@a...>
Date: Thu, 31 Oct 2019 15:52:55 +0900 (JST)
Subject: [ruby-changes:58519] 3895e548bd (master): [ruby/date] Revert "Simplify #inspect"

https://git.ruby-lang.org/ruby.git/commit/?id=3895e548bd

From 3895e548bd2d75cdf47cd247e84d6071247dd3b3 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Sat, 26 Oct 2019 18:20:46 -0700
Subject: [ruby/date] Revert "Simplify #inspect"

This reverts commit af01edd7d8575f544f647dbe8cde5b6ae535d459.

Revert requested by Yui Naruse.

https://github.com/ruby/date/commit/875d563557

diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index fa00cbd..ccac90a 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -6574,8 +6574,11 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L6574
 mk_inspect(union DateData *x, VALUE klass, VALUE to_s)
 {
     return rb_enc_sprintf(rb_usascii_encoding(),
-			  "#<%"PRIsVALUE": %"PRIsVALUE">",
-			  klass, to_s);
+			  "#<%"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));
 }
 
 /*
diff --git a/test/date/test_switch_hitter.rb b/test/date/test_switch_hitter.rb
index 5c5a1bb..bdf299e 100644
--- a/test/date/test_switch_hitter.rb
+++ b/test/date/test_switch_hitter.rb
@@ -282,10 +282,8 @@ 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/

[前][次][番号順一覧][スレッド一覧]