From 906b2110d91a8e7c2319d8d4aa5fa797919fecf2 Mon Sep 17 00:00:00 2001 From: suke Date: Mon, 6 Aug 2012 10:21:12 +0000 Subject: * test/win32ole/test_win32ole_variant.rb: setting WIN32OLE.locale to pass some assertion. Thanks to Hiroshi Shirosaki. [ruby-core:46873][Bug #6814] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/win32ole/test_win32ole_variant.rb | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'test/win32ole') diff --git a/test/win32ole/test_win32ole_variant.rb b/test/win32ole/test_win32ole_variant.rb index 70bfc8bd8f..e6fddc9ba9 100644 --- a/test/win32ole/test_win32ole_variant.rb +++ b/test/win32ole/test_win32ole_variant.rb @@ -7,6 +7,14 @@ require "test/unit" if defined?(WIN32OLE_VARIANT) class TestWIN32OLE_VARIANT < Test::Unit::TestCase + def setup + @orglocale = WIN32OLE.locale + WIN32OLE.locale = 0x0409 # set locale US-Eng + end + + def teardown + WIN32OLE.locale = @orglocale + end def test_s_new obj = WIN32OLE_VARIANT.new('foo') @@ -390,17 +398,13 @@ if defined?(WIN32OLE_VARIANT) def test_conversion_str2cy begin - begin - WIN32OLE.locale = 0x0411 # set locale Japanese - rescue WIN32OLERuntimeError - skip("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 + WIN32OLE.locale = 0x0411 # set locale Japanese + rescue WIN32OLERuntimeError + skip("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 end -- cgit v1.2.3