Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set US-English locale with test_win32ole_variant
diff --git a/test/win32ole/test_win32ole_variant.rb b/test/win32ole/test_win32ole_variant.rb
index 70bfc8b..62ff217 100644
--- a/test/win32ole/test_win32ole_variant.rb
+++ b/test/win32ole/test_win32ole_variant.rb
@@ -306,6 +306,8 @@ if defined?(WIN32OLE_VARIANT)
end
def test_s_array
+ WIN32OLE.locale = 0x0409 # set US-English locale - number with decimal point
+
obj = WIN32OLE_VARIANT.array([2,3], WIN32OLE::VARIANT::VT_I4)
assert_instance_of(WIN32OLE_VARIANT, obj)
assert_equal(WIN32OLE::VARIANT::VT_I4|WIN32OLE::VARIANT::VT_ARRAY, obj.vartype)
@@ -334,7 +336,8 @@ if defined?(WIN32OLE_VARIANT)
obj = WIN32OLE_VARIANT.array([2,3], WIN32OLE::VARIANT::VT_DISPATCH)
assert_equal([[nil, nil, nil],[nil,nil,nil]], obj.value)
-
+ ensure
+ WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
end
def test_s_array_exc
@@ -356,14 +359,22 @@ if defined?(WIN32OLE_VARIANT)
end
def test_conversion_str2num
+ WIN32OLE.locale = 0x0409 # set US-English locale - number with decimal point
+
obj = WIN32OLE_VARIANT.new("12.345", WIN32OLE::VARIANT::VT_R8)
assert_equal(12.345, obj.value)
+ ensure
+ WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
end
def test_conversion_ole_variant2ole_variant
+ WIN32OLE.locale = 0x0409 # set US-English locale - number with decimal point
+
obj = WIN32OLE_VARIANT.new("12.345", WIN32OLE::VARIANT::VT_R4)
obj = WIN32OLE_VARIANT.new(obj, WIN32OLE::VARIANT::VT_I4)
assert_equal(12, obj.value)
+ ensure
+ WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
end
def test_conversion_str2date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.