mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
[ruby/psych] Format Date in ISO-8601 explicitly
Fix https://github.com/ruby/psych/pull/644
b1ade765ba
This commit is contained in:
parent
5adb2591da
commit
49d49d5985
2 changed files with 21 additions and 1 deletions
|
@ -85,5 +85,20 @@ module Psych
|
|||
assert_match('&', yaml)
|
||||
assert_match('*', yaml)
|
||||
end
|
||||
|
||||
def test_overwritten_to_s
|
||||
pend "Failing on JRuby" if RUBY_PLATFORM =~ /java/
|
||||
s = Psych.dump(Date.new(2023, 9, 2), permitted_classes: [Date])
|
||||
assert_separately(%W[-rpsych -rdate - #{s}], "#{<<~"begin;"}\n#{<<~'end;'}")
|
||||
class Date
|
||||
undef to_s
|
||||
def to_s; strftime("%D"); end
|
||||
end
|
||||
expected = ARGV.shift
|
||||
begin;
|
||||
s = Psych.dump(Date.new(2023, 9, 2), permitted_classes: [Date])
|
||||
assert_equal(expected, s)
|
||||
end;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue