diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-05-14 06:15:42 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-05-14 06:15:42 -0700 |
| commit | bcb743fccba0628362e284515edade211dd55e19 (patch) | |
| tree | a29397364f5c6f05b2f1bdd24af5f13a6472a6f7 /test/time.rb | |
| parent | 6b67801d4e643583746da41a74218145236b8f9d (diff) | |
| parent | c82a518ee1df250a03abb82aa58a1bfd2c04cfc3 (diff) | |
| download | mruby-bcb743fccba0628362e284515edade211dd55e19.tar.gz mruby-bcb743fccba0628362e284515edade211dd55e19.zip | |
Merge pull request #131 from bovi/master
mrit - Embeddable Ruby ISO Test
Diffstat (limited to 'test/time.rb')
| -rw-r--r-- | test/time.rb | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/time.rb b/test/time.rb new file mode 100644 index 000000000..f33cdde0d --- /dev/null +++ b/test/time.rb @@ -0,0 +1,73 @@ +## +# Time ISO Test + +assert('Time', '15.2.19') do + Time.class == Class +end + +assert('Time.at', '15.2.19.6.1') do + Time.at(1300000000.0) +end + +assert('Time.gm', '15.2.19.6.2') do + Time.gm(2012, 12, 23) +end + +assert('Time#asctime', '15.2.19.7.4') do + Time.at(1300000000.0).utc.asctime == "Sun Mar 13 07:06:40 UTC 2011" +end + +assert('Time#initialize_copy', '15.2.19.7.17') do + time_tmp_2 = Time.at(7.0e6) + time_tmp_2.clone == time_tmp_2 +end + +assert('Time#mday', '15.2.19.7.19') do + Time.gm(2012, 12, 23).mday == 23 +end + +assert('Time#month', '15.2.19.7.22') do + Time.gm(2012, 12, 23).month == 12 +end + +assert('Time#to_f', '15.2.19.7.24') do + Time.at(1300000000.0).to_f == 1300000000.0 +end + +assert('Time#to_i', '15.2.19.7.25') do + Time.at(1300000000.0).to_i == 1300000000 +end + +assert('Time#usec', '15.2.19.7.26') do + Time.at(1300000000.0).usec == 0 +end + +assert('Time#utc', '15.2.19.7.27') do + Time.at(1300000000.0).utc +end + +assert('Time#utc?', '15.2.19.7.28') do + Time.at(1300000000.0).utc.utc? +end + +assert('Time#wday', '15.2.19.7.30') do + Time.at(1300000000.0).utc.wday == 0 +end + +assert('Time#yday', '15.2.19.7.31') do + Time.at(1300000000.0).utc.yday == 71 +end + +assert('Time#year', '15.2.19.7.32') do + Time.gm(2012, 12, 23).year == 2012 +end + +assert('Time#zone', '15.2.19.7.33') do + Time.at(1300000000.0).utc.zone == 'UTC' +end + +# Not ISO specified + +assert('Time#new') do + Time.new.class == Time +end |
