Skip to content

Commit 4f7b6c9

Browse files
committed
Test for the #140
1 parent 159e1eb commit 4f7b6c9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/date/test_date_parse.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,4 +1304,20 @@ def test_length_limit
13041304

13051305
assert_raise(ArgumentError) { Date._parse("Jan " + "9" * 1000000) }
13061306
end
1307+
1308+
def test_string_argument
1309+
s = '2001-02-03T04:05:06Z'
1310+
obj = Class.new(Struct.new(:to_str, :count)) do
1311+
def to_str
1312+
self.count +=1
1313+
super
1314+
end
1315+
end.new(s, 0)
1316+
1317+
all_assertions_foreach(nil, :_parse, :_iso8601, :_rfc3339, :_xmlschema) do |m|
1318+
obj.count = 0
1319+
assert_not_equal({}, Date.__send__(m, obj))
1320+
assert_equal(1, obj.count)
1321+
end
1322+
end
13071323
end

0 commit comments

Comments
 (0)