summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-18 22:13:10 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-18 22:13:10 +0000
commit49d65bc4d62d0ad09adaac897edbeb192f2c125d (patch)
tree36372e89536e1f11730213b4d9d232b194241c80 /test
parent0a99ea86f47656eede005c5ebc25947e0e79a67b (diff)
ext/date/date_parse.c: [ruby-core:42173].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/date/test_date_parse.rb34
-rw-r--r--test/date/test_date_strptime.rb8
2 files changed, 42 insertions, 0 deletions
diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb
index fb54d14b23..1504473938 100644
--- a/test/date/test_date_parse.rb
+++ b/test/date/test_date_parse.rb
@@ -1060,4 +1060,38 @@ class TestDateParse < Test::Unit::TestCase
assert_equal(Date::ITALY + 10, d.start)
end
+ def test_given_string
+ s = '2001-02-03T04:05:06Z'
+ s0 = s.dup
+
+ assert_not_equal({}, Date._parse(s))
+ assert_equal(s0, s)
+
+ assert_not_equal({}, Date._iso8601(s))
+ assert_equal(s0, s)
+
+ assert_not_equal({}, Date._rfc3339(s))
+ assert_equal(s0, s)
+
+ assert_not_equal({}, Date._xmlschema(s))
+ assert_equal(s0, s)
+
+ s = 'Sat, 3 Feb 2001 04:05:06 UT'
+ s0 = s.dup
+ assert_not_equal({}, Date._rfc2822(s))
+ assert_equal(s0, s)
+ assert_not_equal({}, Date._rfc822(s))
+ assert_equal(s0, s)
+
+ s = 'Sat, 03 Feb 2001 04:05:06 GMT'
+ s0 = s.dup
+ assert_not_equal({}, Date._httpdate(s))
+ assert_equal(s0, s)
+
+ s = 'H13.02.03T04:05:06,07Z'
+ s0 = s.dup
+ assert_not_equal({}, Date._jisx0301(s))
+ assert_equal(s0, s)
+ end
+
end
diff --git a/test/date/test_date_strptime.rb b/test/date/test_date_strptime.rb
index 92cf0975a3..ceb649031f 100644
--- a/test/date/test_date_strptime.rb
+++ b/test/date/test_date_strptime.rb
@@ -475,4 +475,12 @@ class TestDateStrptime < Test::Unit::TestCase
end
end
+ def test_given_string
+ s = '2001-02-03T04:05:06Z'
+ s0 = s.dup
+
+ assert_not_equal({}, Date._strptime(s, '%FT%T%Z'))
+ assert_equal(s0, s)
+ end
+
end