summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-12 09:06:45 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-12 09:06:45 +0000
commite64453aa697cc42bfaee51ed771b02898b142daa (patch)
tree3befe582dc507ba845e7cb95cd4a28fa16d5a247 /test/win32ole
parent7215c9af95eb2375eebef478502a7a824ddd16d5 (diff)
* ext/win32ole/win32ole.c (set_ole_codepage, ole_cp2encoding,
ole_wc2mb, ole_vstr2wc, ole_mb2wc): support CP51932 (only mswin32). * test/win32ole/test_win32ole.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb
index 9146103..44d9a35 100644
--- a/test/win32ole/test_win32ole.rb
+++ b/test/win32ole/test_win32ole.rb
@@ -361,6 +361,30 @@ if defined?(WIN32OLE)
end
end
+ def test_cp51932
+ cp = WIN32OLE.codepage
+ begin
+ obj = WIN32OLE_VARIANT.new([0x3042].pack("U*").force_encoding("UTF-8"))
+ # mswin32 ruby only supports CP51932
+ if /mswin/ =~ RUBY_PLATFORM
+ begin
+ WIN32OLE.codepage = 51932
+ rescue
+ end
+ if WIN32OLE.codepage == 51932
+ assert_equal("\xA4\xA2".force_encoding("CP51932"), obj.value)
+ end
+ else
+ # cygwin, mingw32 ruby does not support CP51932
+ assert_raise(WIN32OLERuntimeError) {
+ WIN32OLE.codepage = 51932
+ }
+ end
+ ensure
+ WIN32OLE.codepage = cp
+ end
+ end
+
def test_s_locale
assert_equal(WIN32OLE::LOCALE_SYSTEM_DEFAULT, WIN32OLE.locale)
end