Sha256: 4ec9d980a9bc6a2fb770be0e4754c46540731b4d32649381999adcb00233d805
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
# coding: utf-8 require File.dirname(__FILE__) + "/test_helper.rb" require File.dirname(__FILE__) + "/../lib/kagemusha/date" require File.dirname(__FILE__) + "/../lib/kagemusha/time" require File.dirname(__FILE__) + "/../lib/kagemusha/datetime" class TestKagemushaDateTime < Test::Unit::TestCase def setup end def test_at musha1 = Kagemusha::DateTime.at(2007, 1, 2, 3, 4, 5) musha1.swap { assert_equal(Date.new(2007, 1, 2), Date.today) assert_equal(Time.local(2007, 1, 2, 3, 4, 5), Time.now) } musha2 = Kagemusha::DateTime.at(Date.new(1984, 5, 11)) musha2.swap { assert_equal(Date.new(1984, 5, 11), Date.today) assert_equal(Time.local(1984, 5, 11), Time.now) } musha3 = Kagemusha::DateTime.at(Time.local(1984, 5, 11)) musha3.swap { assert_equal(Date.new(1984, 5, 11), Date.today) assert_equal(Time.local(1984, 5, 11), Time.now) } assert_raise(ArgumentError) { Kagemusha::DateTime.at(:symbol) } end def test_at_with_block ret = Kagemusha::DateTime.at(2007, 1, 2, 3, 4, 5) { assert_equal(Date.new(2007, 1, 2), Date.today) assert_equal(Time.local(2007, 1, 2, 3, 4, 5), Time.now) 1 } assert_equal(1, ret) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nayutaya-kagemusha-0.1.0 | test/test_datetime.rb |