mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/date/test_switch_hitter.rb: added a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0ac1621a20
commit
dc62f1b651
2 changed files with 31 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
Mon Jun 6 21:59:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* test/date/test_switch_hitter.rb: added a test.
|
||||
|
||||
Mon Jun 6 21:37:45 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* ext/date/date_core.c: added notes.
|
||||
|
|
|
@ -384,6 +384,33 @@ class TestSH < Test::Unit::TestCase
|
|||
assert_equal(true, s.tainted?)
|
||||
end
|
||||
|
||||
def test_enc
|
||||
h = Date._strptime('15:43+09:00'.force_encoding('euc-jp'), '%R%z')
|
||||
assert_equal(Encoding::EUC_JP, h[:zone].encoding)
|
||||
h = Date._strptime('15:43+09:00'.force_encoding('ascii-8bit'), '%R%z')
|
||||
assert_equal(Encoding::ASCII_8BIT, h[:zone].encoding)
|
||||
|
||||
h = Date._strptime('1;1/0'.force_encoding('euc-jp'), '%d')
|
||||
assert_equal(Encoding::EUC_JP, h[:leftover].encoding)
|
||||
h = Date._strptime('1;1/0'.force_encoding('ascii-8bit'), '%d')
|
||||
assert_equal(Encoding::ASCII_8BIT, h[:leftover].encoding)
|
||||
|
||||
h = Date._parse('15:43+09:00'.force_encoding('euc-jp'))
|
||||
assert_equal(Encoding::EUC_JP, h[:zone].encoding)
|
||||
h = Date._parse('15:43+09:00'.force_encoding('ascii-8bit'))
|
||||
assert_equal(Encoding::ASCII_8BIT, h[:zone].encoding)
|
||||
|
||||
s = Date.today.strftime('new 105'.force_encoding('euc-jp'))
|
||||
assert_equal(Encoding::EUC_JP, s.encoding)
|
||||
s = Date.today.strftime('new 105'.force_encoding('ascii-8bit'))
|
||||
assert_equal(Encoding::ASCII_8BIT, s.encoding)
|
||||
|
||||
s = DateTime.now.strftime('super $record'.force_encoding('euc-jp'))
|
||||
assert_equal(Encoding::EUC_JP, s.encoding)
|
||||
s = DateTime.now.strftime('super $record'.force_encoding('ascii-8bit'))
|
||||
assert_equal(Encoding::ASCII_8BIT, s.encoding)
|
||||
end
|
||||
|
||||
def test_dup
|
||||
d = Date.new(2001,2,3)
|
||||
d2 = d.dup
|
||||
|
|
Loading…
Add table
Reference in a new issue