summaryrefslogtreecommitdiff
path: root/test/test_time.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-21 17:11:27 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-21 17:11:27 +0000
commitfd9bfef325f037e5d3ae3551a11736ce52b5af9f (patch)
tree3e7fed039d48fa04588bc4da48e9f6953080f203 /test/test_time.rb
parent16dc9e04cbedff54c12235ae81121ce2f4acad1e (diff)
* lib/time.rb (Time#xmlschema): use subsec instead of nsec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_time.rb')
-rw-r--r--test/test_time.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_time.rb b/test/test_time.rb
index 844dc62..01c86d7 100644
--- a/test/test_time.rb
+++ b/test/test_time.rb
@@ -153,6 +153,18 @@ class TestTimeExtention < Test::Unit::TestCase # :nodoc:
assert_equal("2001-04-17T19:23:17.12345Z", t.xmlschema(5))
assert_equal("2001-04-17T19:23:17.1Z", t.xmlschema(1))
+ t = Time.at(2.quo(3))
+ assert_equal("1970-01-01T09:00:00.666+09:00", t.xmlschema(3))
+ assert_equal("1970-01-01T09:00:00.6666666666+09:00", t.xmlschema(10))
+ assert_equal("1970-01-01T09:00:00.66666666666666666666+09:00", t.xmlschema(20))
+
+ t = Time.at(123456789.quo(9999999999))
+ assert_equal("1970-01-01T09:00:00.012+09:00", t.xmlschema(3))
+ assert_equal("1970-01-01T09:00:00.012345678+09:00", t.xmlschema(9))
+ assert_equal("1970-01-01T09:00:00.0123456789+09:00", t.xmlschema(10))
+ assert_equal("1970-01-01T09:00:00.0123456789012345678+09:00", t.xmlschema(19))
+ assert_equal("1970-01-01T09:00:00.01234567890123456789+09:00", t.xmlschema(20))
+
begin
Time.at(-1)
rescue ArgumentError