mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-01 09:31:20 +08:00
35 lines
729 B
Ruby
35 lines
729 B
Ruby
# RM-253
|
|
describe "Time" do
|
|
it "#== should be equal to duplicated object" do
|
|
date = Time.now
|
|
date.copy.should == date
|
|
date.should == date.copy
|
|
|
|
date.dup.should == date
|
|
date.should == date.dup
|
|
end
|
|
|
|
it "#eql? should be equal to duplicated object" do
|
|
date = Time.now
|
|
date.copy.eql?(date).should == true
|
|
date.eql?(date.copy).should == true
|
|
|
|
date.dup.eql?(date).should == true
|
|
date.eql?(date.dup).should == true
|
|
|
|
end
|
|
end
|
|
|
|
#RM-337
|
|
describe "Time#hash" do
|
|
class Time
|
|
def to_nsdate
|
|
NSDate.dateWithTimeIntervalSince1970(self.to_i)
|
|
end
|
|
end
|
|
|
|
it "should be equal after converting NSDate to Time" do
|
|
a = Time.now
|
|
a.to_nsdate.hash.should == a.to_nsdate.hash
|
|
end
|
|
end |