From 4f7b6c9b421eacd74c1f34ddd482f3b7f002d316 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 6 Oct 2025 12:51:29 +0900 Subject: [PATCH] Test for the #140 --- test/date/test_date_parse.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb index cc29771..29e5597 100644 --- a/test/date/test_date_parse.rb +++ b/test/date/test_date_parse.rb @@ -1304,4 +1304,20 @@ def test_length_limit assert_raise(ArgumentError) { Date._parse("Jan " + "9" * 1000000) } end + + def test_string_argument + s = '2001-02-03T04:05:06Z' + obj = Class.new(Struct.new(:to_str, :count)) do + def to_str + self.count +=1 + super + end + end.new(s, 0) + + all_assertions_foreach(nil, :_parse, :_iso8601, :_rfc3339, :_xmlschema) do |m| + obj.count = 0 + assert_not_equal({}, Date.__send__(m, obj)) + assert_equal(1, obj.count) + end + end end