[#35446] [Ruby 1.9 - Bug #4477][Open] Kernel:exec and backtick (`) don't work for certain system commands — Joachim Wuttke <j.wuttke@...>

10 messages 2011/03/07

[#35476] [Ruby 1.9 - Bug #4489][Open] [PATCH] Encodings with /-(unix|dos|mac)\Z/ — "James M. Lawrence" <quixoticsycophant@...>

20 messages 2011/03/10

[#35552] [Ruby 1.9 - Feature #4523][Open] Kernel#require to return the path of the loaded file — Alex Young <alex@...>

14 messages 2011/03/24

[#35565] [Ruby 1.9 - Feature #4531][Open] [PATCH 0/7] use poll() instead of select() in certain cases — Eric Wong <normalperson@...>

33 messages 2011/03/28

[#35566] [Ruby 1.9 - Feature #4532][Open] [PATCH] add IO#pread and IO#pwrite methods — Eric Wong <normalperson@...>

12 messages 2011/03/28

[#35586] [Ruby 1.9 - Feature #4538][Open] [PATCH (cleanup)] avoid unnecessary select() calls before doing I/O — Eric Wong <normalperson@...>

9 messages 2011/03/29

[ruby-core:35560] [Ruby 1.9 - Feature #4391][Rejected] date/delta tests

From: tadayoshi funaba <redmine@...>
Date: 2011-03-26 03:23:38 UTC
List: ruby-core #35560
Issue #4391 has been updated by tadayoshi funaba.

Status changed from Assigned to Rejected


----------------------------------------
Feature #4391: date/delta tests
http://redmine.ruby-lang.org/issues/4391

Author: Sebastian Krause
Status: Rejected
Priority: Normal
Assignee: tadayoshi funaba
Category: lib
Target version: 1.9.x


 Attached are a few tests for the Date::Delta class. I hope they are of some use.
 And some points which might be considered bugs.
 (Everything for 1.9.2 patchlevel 174, probably applies to older versions too)
 
 
 i) Interplay with the Time class
 So the following doesn't look right:
 irb(main):005:0> t1 = Time.new(2011)
 => 2011-01-01 00:00:00 +0100
 irb(main):006:0> t2 = Date::Delta.days(1)
 => #<Date::Delta: +(1d 00:00'00"000)+(0y 0m) (1/1+0i)>
 irb(main):007:0> t1 + t2
 => 2011-01-01 00:00:01 +0100
 
 ii) Difference of Dates is number
 This leads to the following strange behavior:
 irb(main):016:0> t1 = Date.new(2011,2)
 => #<Date: 2011-02-01 (4911187/2,0,2299161)>
 irb(main):017:0> t1 - t1 + Date::Delta.months(1)
 => ((0/1)+(1/1)*i)
 
 Wouldn't it be better, if date arithmetic stayed in the classes Date and Date::Delta when
 date/delta is loaded?
 
 iii) multiplication with scalars
 I don't know what the coercion principles exactly are. So this might be okay.
 
 irb(main):003:0> 2 * Date::Delta.days(2)
 => ((4/1)+(0/1)*i)
 irb(main):004:0> Date::Delta.days(2) * 2
 => #<Date::Delta: +(4d 00:00'00"000)+(0y 0m) (4/1+0i)>
 
 
 
 Can I add some documentation? Is there a standard way to do it or should I just go ahead and copy the style from other parts.


-- 
http://redmine.ruby-lang.org

In This Thread

Prev Next