ruby-changes:5358
From: knu <ko1@a...>
Date: Fri, 6 Jun 2008 18:36:31 +0900 (JST)
Subject: [ruby-changes:5358] Ruby:r16860 (ruby_1_8_7): * test/iconv: Tests fixed.
knu 2008-06-06 18:36:19 +0900 (Fri, 06 Jun 2008) New Revision: 16860 Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/test/iconv/test_basic.rb branches/ruby_1_8_7/test/iconv/test_option.rb branches/ruby_1_8_7/test/iconv/test_partial.rb branches/ruby_1_8_7/test/iconv/utils.rb branches/ruby_1_8_7/version.h Log: * test/iconv: Tests fixed. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/test/iconv/utils.rb?r1=16860&r2=16859&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/test/iconv/test_option.rb?r1=16860&r2=16859&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/test/iconv/test_partial.rb?r1=16860&r2=16859&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/test/iconv/test_basic.rb?r1=16860&r2=16859&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/ChangeLog?r1=16860&r2=16859&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/version.h?r1=16860&r2=16859&diff_format=u Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 16859) +++ ruby_1_8_7/ChangeLog (revision 16860) @@ -1,3 +1,7 @@ +Fri Jun 6 18:25:43 2008 Nobuyoshi Nakada <nobu@r...> + + * test/iconv: Tests fixed. + Fri Jun 6 17:04:56 2008 Akinori MUSHA <knu@i...> * win32/win32.h: include ws2tcpip.h. fixed [ruby-Bugs-20528] Index: ruby_1_8_7/version.h =================================================================== --- ruby_1_8_7/version.h (revision 16859) +++ ruby_1_8_7/version.h (revision 16860) @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2008-06-06" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20080606 -#define RUBY_PATCHLEVEL 6 +#define RUBY_PATCHLEVEL 7 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 Index: ruby_1_8_7/test/iconv/test_basic.rb =================================================================== --- ruby_1_8_7/test/iconv/test_basic.rb (revision 16859) +++ ruby_1_8_7/test/iconv/test_basic.rb (revision 16860) @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), "utils.rb") -TestIconv.testcase(:Basic) do +class TestIconv::Basic < TestIconv def test_euc2sjis iconv = Iconv.open('SHIFT_JIS', 'EUC-JP') str = iconv.iconv(EUCJ_STR) @@ -46,4 +46,4 @@ def test_unknown_encoding assert_raise(Iconv::InvalidEncoding) { Iconv.iconv("utf-8", "X-UKNOWN", "heh") } end -end +end if defined?(TestIconv) Index: ruby_1_8_7/test/iconv/utils.rb =================================================================== --- ruby_1_8_7/test/iconv/utils.rb (revision 16859) +++ ruby_1_8_7/test/iconv/utils.rb (revision 16860) @@ -5,21 +5,7 @@ require 'test/unit' end -module TestIconv - if defined?(::Iconv) - def self.testcase(name, &block) - const_set(name, klass = Class.new(::Test::Unit::TestCase)) - klass.name - klass.__send__(:include, self) - klass.class_eval(&block) - end - else - def self.testcase(name) - end - end -end - -module TestIconv +class TestIconv < ::Test::Unit::TestCase if defined?(::Encoding) and String.method_defined?(:force_encoding) def self.encode(str, enc) str.force_encoding(enc) @@ -30,6 +16,10 @@ end end + def default_test + self.class == TestIconv or super + end + ASCII = "ascii" EUCJ_STR = encode("\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa", "EUC-JP").freeze SJIS_STR = encode("\x82\xa0\x82\xa2\x82\xa4\x82\xa6\x82\xa8", "Shift_JIS").freeze Index: ruby_1_8_7/test/iconv/test_option.rb =================================================================== --- ruby_1_8_7/test/iconv/test_option.rb (revision 16859) +++ ruby_1_8_7/test/iconv/test_option.rb (revision 16860) @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), "utils.rb") -TestIconv.testcase(:Option) do +class TestIconv::Option < TestIconv def test_ignore_option iconv = Iconv.new('SHIFT_JIS', 'EUC-JP//ignore') str = iconv.iconv(EUCJ_STR) @@ -28,4 +28,4 @@ assert_equal(SJIS_STR, str) iconv.close end -end +end if defined?(TestIconv) Index: ruby_1_8_7/test/iconv/test_partial.rb =================================================================== --- ruby_1_8_7/test/iconv/test_partial.rb (revision 16859) +++ ruby_1_8_7/test/iconv/test_partial.rb (revision 16860) @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), "utils.rb") -TestIconv.testcase(:Partial) do +class TestIconv::Partial < TestIconv def test_partial_ascii c = Iconv.open(ASCII, ASCII) ref = '[ruby-core:17092]' @@ -38,4 +38,4 @@ ensure c.close end -end +end if defined?(TestIconv) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/