summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-05 12:17:53 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-05 12:17:53 +0000
commitea394a402bc3312b250d6ecd415a490c9af68584 (patch)
treee84a87ebbb31463f821a21dd77b34abf847250ff /test/win32ole
parent0d315337046760c7e1d4c3f6cac130a02e4a6f19 (diff)
* test/win32ole/test_win32ole.rb(test_s_codepage_changed) : modify test
for m17n. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole.rb33
1 files changed, 22 insertions, 11 deletions
diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb
index ea3484a..d5174b6 100644
--- a/test/win32ole/test_win32ole.rb
+++ b/test/win32ole/test_win32ole.rb
@@ -278,24 +278,35 @@ if defined?(WIN32OLE)
fname = fso.getTempName
begin
WIN32OLE.codepage = WIN32OLE::CP_UTF8
+ obj = WIN32OLE_VARIANT.new([0x3042].pack("U*"))
+ assert_equal("\xE3\x81\x82", obj.value)
+
+ begin
+ WIN32OLE.codepage = 932 # Windows-31J
+ rescue WIN32OLERuntimeError
+ end
+ if (WIN32OLE.codepage == 932)
+ assert_equal("\x82\xA0", obj.value)
+ end
+
+ begin
+ WIN32OLE.codepage = 20932 # MS EUC-JP
+ rescue WIN32OLERuntimeError
+ end
+ if (WIN32OLE.codepage == 20932)
+ assert_equal("\xA4\xA2", obj.value)
+ end
+
+ WIN32OLE.codepage = WIN32OLE::CP_UTF8
file = fso.opentextfile(fname, 2, true)
file.write [0x3042].pack("U*")
file.close
str = ""
- open(fname) {|ifs|
+ open(fname, "r:ascii-8bit") {|ifs|
str = ifs.read
}
assert_equal("\202\240", str)
- WIN32OLE.codepage = WIN32OLE::CP_ACP
- file = fso.opentextfile(fname, 2, true)
- file.write [0x3042].pack("U*")
- file.close
- open(fname) {|ifs|
- str = ifs.read
- }
- assert_equal("\343\201", str)
-
# This test fail if codepage 20932 (euc) is not installed.
begin
WIN32OLE.codepage = 20932
@@ -305,7 +316,7 @@ if defined?(WIN32OLE)
file = fso.opentextfile(fname, 2, true)
file.write [164, 162].pack("c*")
file.close
- open(fname) {|ifs|
+ open(fname, "r:ascii-8bit") {|ifs|
str = ifs.read
}
assert_equal("\202\240", str)