mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/win32ole/test_win32ole.rb (test_s_codepage_changed,
test_s_locale_set, test_s_locale_change): skip test if Japanese locale is not installed. [ruby-core:23806] * test/win32ole/test_win32ole_variant.rb (test_conversion_str2cy): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1c75d58165
commit
6d7ddc3b29
3 changed files with 57 additions and 17 deletions
|
@ -1,3 +1,12 @@
|
|||
Thu Jul 16 20:58:18 2009 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
||||
|
||||
* test/win32ole/test_win32ole.rb (test_s_codepage_changed,
|
||||
test_s_locale_set, test_s_locale_change): skip test if Japanese
|
||||
locale is not installed. [ruby-core:23806]
|
||||
|
||||
* test/win32ole/test_win32ole_variant.rb (test_conversion_str2cy):
|
||||
dito.
|
||||
|
||||
Thu Jul 16 19:02:28 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* ext/socket/lib/socket.rb (Socket.tcp_server_sockets_port0): servers
|
||||
|
|
|
@ -344,8 +344,11 @@ if defined?(WIN32OLE)
|
|||
|
||||
WIN32OLE.codepage = cp
|
||||
file = fso.opentextfile(fname, 2, true)
|
||||
file.write [0x3042].pack("U*").force_encoding("UTF-8")
|
||||
file.close
|
||||
begin
|
||||
file.write [0x3042].pack("U*").force_encoding("UTF-8")
|
||||
ensure
|
||||
file.close
|
||||
end
|
||||
str = ""
|
||||
open(fname, "r:ascii-8bit") {|ifs|
|
||||
str = ifs.read
|
||||
|
@ -360,8 +363,11 @@ if defined?(WIN32OLE)
|
|||
if (WIN32OLE.codepage == 20932)
|
||||
WIN32OLE.codepage = cp
|
||||
file = fso.opentextfile(fname, 2, true)
|
||||
file.write [164, 162].pack("c*").force_encoding("EUC-JP")
|
||||
file.close
|
||||
begin
|
||||
file.write [164, 162].pack("c*").force_encoding("EUC-JP")
|
||||
ensure
|
||||
file.close
|
||||
end
|
||||
open(fname, "r:ascii-8bit") {|ifs|
|
||||
str = ifs.read
|
||||
}
|
||||
|
@ -398,7 +404,12 @@ if defined?(WIN32OLE)
|
|||
|
||||
def test_s_locale_set
|
||||
begin
|
||||
WIN32OLE.locale = 1041
|
||||
begin
|
||||
WIN32OLE.locale = 1041
|
||||
rescue WIN32OLERuntimeError
|
||||
STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_locale_set is skipped(Japanese locale is not installed)")
|
||||
return
|
||||
end
|
||||
assert_equal(1041, WIN32OLE.locale)
|
||||
WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
|
||||
assert_raise(WIN32OLERuntimeError) {
|
||||
|
@ -412,16 +423,30 @@ if defined?(WIN32OLE)
|
|||
|
||||
def test_s_locale_change
|
||||
begin
|
||||
WIN32OLE.locale = 0x0411
|
||||
obj = WIN32OLE_VARIANT.new("\\100,000", WIN32OLE::VARIANT::VT_CY)
|
||||
assert_equal("100000", obj.value)
|
||||
assert_raise(WIN32OLERuntimeError) {
|
||||
obj = WIN32OLE_VARIANT.new("$100.000", WIN32OLE::VARIANT::VT_CY)
|
||||
}
|
||||
begin
|
||||
WIN32OLE.locale = 0x0411
|
||||
rescue WIN32OLERuntimeError
|
||||
end
|
||||
if WIN32OLE.locale == 0x0411
|
||||
obj = WIN32OLE_VARIANT.new("\\100,000", WIN32OLE::VARIANT::VT_CY)
|
||||
assert_equal("100000", obj.value)
|
||||
assert_raise(WIN32OLERuntimeError) {
|
||||
obj = WIN32OLE_VARIANT.new("$100.000", WIN32OLE::VARIANT::VT_CY)
|
||||
}
|
||||
else
|
||||
STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_locale_change is skipped(Japanese locale is not installed)")
|
||||
end
|
||||
|
||||
WIN32OLE.locale = 1033
|
||||
obj = WIN32OLE_VARIANT.new("$100,000", WIN32OLE::VARIANT::VT_CY)
|
||||
assert_equal("100000", obj.value)
|
||||
begin
|
||||
WIN32OLE.locale = 1033
|
||||
rescue WIN32OLERuntimeError
|
||||
end
|
||||
if WIN32OLE.locale == 1033
|
||||
obj = WIN32OLE_VARIANT.new("$100,000", WIN32OLE::VARIANT::VT_CY)
|
||||
assert_equal("100000", obj.value)
|
||||
else
|
||||
STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_locale_change is skipped(US English locale is not installed)")
|
||||
end
|
||||
ensure
|
||||
WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
|
||||
end
|
||||
|
|
|
@ -384,9 +384,15 @@ if defined?(WIN32OLE_VARIANT)
|
|||
|
||||
def test_conversion_str2cy
|
||||
begin
|
||||
WIN32OLE.locale = 0x0411 # set locale Japanese
|
||||
obj = WIN32OLE_VARIANT.new("\\10,000", WIN32OLE::VARIANT::VT_CY)
|
||||
assert_equal("10000", obj.value)
|
||||
begin
|
||||
WIN32OLE.locale = 0x0411 # set locale Japanese
|
||||
rescue WIN32OLERuntimeError
|
||||
STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_conversion_str2cy is skipped(Japanese locale is not installed)")
|
||||
end
|
||||
if WIN32OLE.locale == 0x0411
|
||||
obj = WIN32OLE_VARIANT.new("\\10,000", WIN32OLE::VARIANT::VT_CY)
|
||||
assert_equal("10000", obj.value)
|
||||
end
|
||||
ensure
|
||||
WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue