https://bugs.ruby-lang.org/
https://bugs.ruby-lang.org/favicon.ico?1711330511
2011-01-20T13:06:44Z
Ruby Issue Tracking System
Ruby master - Bug #4297: test_time in ruby/test/psych/test_json_tree.rb makes test failure
https://bugs.ruby-lang.org/issues/4297?journal_id=15365
2011-01-20T13:06:44Z
kosaki (Motohiro KOSAKI)
kosaki.motohiro@gmail.com
<ul><li><strong>Assignee</strong> set to <i>tenderlovemaking (Aaron Patterson)</i></li></ul><p>=begin</p>
<p>=end</p>
Ruby master - Bug #4297: test_time in ruby/test/psych/test_json_tree.rb makes test failure
https://bugs.ruby-lang.org/issues/4297?journal_id=15375
2011-01-20T20:45:05Z
Eregon (Benoit Daloze)
<ul></ul><p>=begin<br>
On 20 January 2011 05:05, Motohiro KOSAKI <a href="mailto:redmine@ruby-lang.org" class="email">redmine@ruby-lang.org</a> wrote:</p>
<blockquote>
<h1>% svn diff<br>
Index: test/psych/test_json_tree.rb</h1>
<p>--- test/psych/test_json_tree.rb (revision 30611)<br>
+++ test/psych/test_json_tree.rb (working copy)<br>
@@ -41,8 +41,8 @@<br>
end</p>
<p> def test_time</p>
<ul>
<li> time = Time.new(2010, 10, 10).utc</li>
<li> assert_equal "{"a": "2010-10-10 07:00:00.000000000Z"}\n", Psych.to_json({'a' => time })</li>
</ul>
<ul>
<li> time = Time.utc(2010, 10, 10).utc</li>
<li> assert_equal "{"a": "2010-10-10 00:00:00.000000000Z"}\n", Psych.to_json({'a' => time })<br>
end</li>
</ul>
<p> def test_datetime</p>
</blockquote>
<p>I think the second 'utc' (Time#utc) is unnecessary as the Time is<br>
created with Time.utc.<br>
So the patch should be:</p>
<h1>% svn diff<br>
Index: test/psych/test_json_tree.rb</h1>
<p>--- test/psych/test_json_tree.rb (revision 30611)<br>
+++ test/psych/test_json_tree.rb (working copy)<br>
@@ -41,8 +41,8 @@<br>
end</p>
<pre><code> def test_time
</code></pre>
<ul>
<li>
<pre><code> time = Time.new(2010, 10, 10).utc
</code></pre>
</li>
<li>
<pre><code> assert_equal "{\"a\": \"2010-10-10 07:00:00.000000000Z\"}\n",
</code></pre>
</li>
</ul>
<p>Psych.to_json({'a' => time })</p>
<ul>
<li>
<pre><code> time = Time.utc(2010, 10, 10)
</code></pre>
</li>
<li>
<pre><code> assert_equal "{\"a\": \"2010-10-10 00:00:00.000000000Z\"}\n",
</code></pre>
</li>
</ul>
<p>Psych.to_json({'a' => time })<br>
end</p>
<pre><code> def test_datetime
</code></pre>
<p>=end</p>
Ruby master - Bug #4297: test_time in ruby/test/psych/test_json_tree.rb makes test failure
https://bugs.ruby-lang.org/issues/4297?journal_id=15450
2011-01-22T11:27:06Z
Anonymous
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>=begin<br>
This issue was solved with changeset r30627.<br>
Motohiro, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>fixed a bug in the test suite. Thanks Benoit Daloze! <a href="/issues/4297">[ruby-core:34641]</a><br>
=end</p>