ruby-changes:6372
From: suke <ko1@a...>
Date: Sat, 5 Jul 2008 20:54:22 +0900 (JST)
Subject: [ruby-changes:6372] Ruby:r17888 (trunk): * test/win32ole/test_word.rb: check word installed.
suke 2008-07-05 20:54:06 +0900 (Sat, 05 Jul 2008)
New Revision: 17888
Modified files:
trunk/ChangeLog
trunk/test/win32ole/test_word.rb
Log:
* test/win32ole/test_word.rb: check word installed.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17888
Index: ChangeLog
===================================================================
--- ChangeLog (revision 17887)
+++ ChangeLog (revision 17888)
@@ -1,3 +1,7 @@
+Sat Jul 5 20:53:18 2008 Masaki Suketa <masaki.suketa@n...>
+
+ * test/win32ole/test_word.rb: check word installed.
+
Sat Jul 5 16:12:54 2008 Narihiro Nakamura <authorNari@g...>
* gc.c: revert. before lazy sweep.
Index: test/win32ole/test_word.rb
===================================================================
--- test/win32ole/test_word.rb (revision 17887)
+++ test/win32ole/test_word.rb (revision 17888)
@@ -7,39 +7,66 @@
end
require "test/unit"
-if defined?(WIN32OLE)
- class TestWIN32OLE_WITH_WORD < Test::Unit::TestCase
-
- def setup
- begin
- @obj = WIN32OLE.new('Word.Application')
- rescue WIN32OLERuntimeError
- @obj = nil
+def word_installed?
+ installed = false
+ w = nil
+ if defined?(WIN32OLE)
+ begin
+ w = WIN32OLE.new('Word.Application')
+ installed = true
+ rescue
+ ensure
+ if w
+ w.quit
+ w = nil
end
end
+ end
+ return installed
+end
- def test_ole_methods
- if @obj
- @obj.visible = true
- @obj.wordbasic.disableAutoMacros(true)
- assert(true)
+if defined?(WIN32OLE)
+ w = nil
+ dotest = word_installed?
+ if !dotest
+ STDERR.puts("\n#{__FILE__} skipped(Microsoft Word not found.)")
+ end
+ if dotest
+ class TestWIN32OLE_WITH_WORD < Test::Unit::TestCase
+ def setup
+ begin
+ @obj = WIN32OLE.new('Word.Application')
+ rescue WIN32OLERuntimeError
+ @obj = nil
+ if !$skipped
+ $skipped = true
+ end
+ end
end
- end
- def test_s_connect
- if @obj
- obj2 = WIN32OLE.connect("Word.Application")
- assert_instance_of(WIN32OLE, obj2)
- obj2.visible = true
+ def test_ole_methods
+ if @obj
+ @obj.visible = true
+ @obj.wordbasic.disableAutoMacros(true)
+ assert(true)
+ else
+ end
end
- end
- def teardown
- if @obj
- @obj.quit
- @obj = nil
+ def test_s_connect
+ if @obj
+ obj2 = WIN32OLE.connect("Word.Application")
+ assert_instance_of(WIN32OLE, obj2)
+ obj2.visible = true
+ end
end
+
+ def teardown
+ if @obj
+ @obj.quit
+ @obj = nil
+ end
+ end
end
-
end
end
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/