Project

General

Profile

Actions

Bug #20929

open

TestTime have an assertion different from current implementation.

Added by YO4 (Yoshinao Muramatsu) 1 day ago. Updated about 12 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:120089]

Description

test/ruby/test_time.rb have following assersion function.

  def assert_zone_encoding(time)
    zone = time.zone
    assert_predicate(zone, :valid_encoding?)
    if zone.ascii_only?
      assert_equal(Encoding::US_ASCII, zone.encoding)
    else
      enc = Encoding.default_internal || Encoding.find('locale')
      assert_equal(enc, zone.encoding)
    end
  end

In current implementation, Time#zone are returned in US_ASCII or locale encoding, which does not seem to take into account the default_internal.

C:\>ruby -e "puts Time.now.zone"
東京 (標準時)

C:\>ruby -e "puts Time.now.zone.encoding"
Windows-31J

C:\>ruby -EWindows-31J:UTF-8 -e "puts Time.now.zone"
東京 (標準時)

C:\>ruby -EWindows-31J:UTF-8 -e "puts Time.now.zone.encoding"
Windows-31J

Actions

Also available in: Atom PDF

Like0
Like0