Sha256: 0838fa5fc4d6d56f54cb6839b0c786ed23bbf0bcd1f1db79a69f3f5e3020c70f
Contents?: true
Size: 992 Bytes
Versions: 3
Compression:
Stored size: 992 Bytes
Contents
# Test facets/date.rb require 'facets/date.rb' require 'test/unit' class TC_Date < Test::Unit::TestCase def setup @d = Date.civil( 2005, 04, 20 ) end def test_to_date assert_instance_of( ::Date, @d.to_date ) end def test_to_time assert_instance_of( ::Time, @d.to_time ) end def test_to_s assert_equal( "2005-04-20", @d.to_s ) end def test_stamp_1 assert_equal( "2005-04-20", @d.stamp ) end def test_stamp_2 assert_equal( "20 Apr", @d.stamp(:short) ) end def test_stamp_3 assert_equal( "April 20, 2005", @d.stamp(:long) ) end def test_days_in_month assert_equal( 31, Date.new(2004,1,1).days_in_month ) end def test_days_of_month assert_equal( (1..@d.days_in_month).to_a, @d.days_of_month ) end end class TC_String_Date < Test::Unit::TestCase def test_to_date s = "2005-10-31" d = s.to_date assert_equal( 31, d.day ) assert_equal( 10, d.month ) assert_equal( 2005, d.year ) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-2.4.1 | test/test_date.rb |
facets-2.4.2 | test/lore/test_date.rb |
facets-2.4.3 | test/lore/test_date.rb |