Skip to content

Commit

Permalink
One day_spec from rubyspec
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Oct 2, 2013
1 parent 2163008 commit 4dd39e8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
9 changes: 5 additions & 4 deletions corelib/time.rb
Expand Up @@ -10,7 +10,7 @@ def self.at(seconds, frac = 0)
`new Date(seconds * 1000 + frac)`
end

def self.new(year = undefined, month = undefined, day = undefined, hour = undefined, minute = undefined, second = undefined, millisecond = undefined)
def self.new(year = undefined, month = undefined, day = undefined, hour = undefined, minute = undefined, second = undefined, utc_offset = undefined)
%x{
switch (arguments.length) {
case 1: return new Date(year, 0);
Expand All @@ -19,7 +19,7 @@ def self.new(year = undefined, month = undefined, day = undefined, hour = undefi
case 4: return new Date(year, month - 1, day, hour);
case 5: return new Date(year, month - 1, day, hour, minute);
case 6: return new Date(year, month - 1, day, hour, minute, second);
case 7: return new Date(year, month - 1, day, hour, minute, second, millisecond);
case 7: #{raise NotImplementedError};
default: return new Date();
}
}
Expand Down Expand Up @@ -61,7 +61,7 @@ def self.local(year, month = nil, day = nil, hour = nil, minute = nil, second =
new(*args)
end

def self.gm(year, month = undefined, day = undefined, hour = undefined, minute = undefined, second = undefined, millisecond = undefined)
def self.gm(year, month = undefined, day = undefined, hour = undefined, minute = undefined, second = undefined, utc_offset = undefined)
raise TypeError, 'missing year (got nil)' if year.nil?
%x{
switch (arguments.length) {
Expand All @@ -71,13 +71,14 @@ def self.gm(year, month = undefined, day = undefined, hour = undefined, minute =
case 4: return new Date( Date.UTC(year, month - 1, day, hour) );
case 5: return new Date( Date.UTC(year, month - 1, day, hour, minute) );
case 6: return new Date( Date.UTC(year, month - 1, day, hour, minute, second) );
case 7: return new Date( Date.UTC(year, month - 1, day, hour, minute, second, millisecond) );
case 7: #{raise NotImplementedError};
}
}
end

class << self
alias :mktime :local
alias :utc :gm
end

def self.now
Expand Down
3 changes: 3 additions & 0 deletions spec/filters/bugs/time.rb
Expand Up @@ -11,4 +11,7 @@
fails "Time.mktime interprets all numerals as base 10"
fails "Time.mktime handles a String month given as a short month name"
fails "Time.mktime returns subclass instances"

fails "Time#day returns the day of the month for a Time with a fixed offset"

end
5 changes: 0 additions & 5 deletions spec/rubyspec/core/time/day_spec.rb

This file was deleted.

1 change: 1 addition & 0 deletions spec/rubyspecs
Expand Up @@ -234,3 +234,4 @@ core/range/end_spec
core/symbol/to_proc_spec
core/class/new_spec
core/time/mktime_spec
core/time/day_spec

0 comments on commit 4dd39e8

Please sign in to comment.