Test failures in test_win32ole_variant.rb
Originally this was reported on RubyInstaller-list by dmajkic.
This one is about 3 failures I have in "test_win32ole_variant.rb".
After looking at the win32ole.c, I see that the default locale
is LOCALE_SYSTEM_DEFAULT. That means that the locale
is from the Windows, and is not affected by the console settings.
Since I am using "Serbian Latin", which sets coma as decimal
separator (eg. 123456,78), all three tests fail simply because
Windows API tires to convert string to number using wrong locale.
String is in US locale, but conversion API uses system default.
Since WIN32OLE.locale= exists, setting it to 1033 (US English),
solves all three tests as "pass". It looks like this:
WIN32OLE.locale = 1033 # set US-Eng locale - number with decimal point
obj = WIN32OLE_VARIANT.new("12.345", WIN32OLE::VARIANT::VT_R8)
I've created the following patch based on above analysis.
It seems to work fine.
#2 Updated by suke (Masaki Suketa) over 4 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100