[前][次][番号順一覧][スレッド一覧]

ruby-changes:30444

From: nobu <ko1@a...>
Date: Sun, 11 Aug 2013 22:57:36 +0900 (JST)
Subject: [ruby-changes:30444] nobu:r42523 (trunk): test_require.rb: __FILE__ encoding on Windows

nobu	2013-08-11 22:57:29 +0900 (Sun, 11 Aug 2013)

  New Revision: 42523

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42523

  Log:
    test_require.rb: __FILE__ encoding on Windows
    
    * test/ruby/test_require.rb (assert_require_nonascii_path): OS path
      encoding on Windows is fixed, so encoding of __FILE__ should be it.
      [ruby-core:56498] [Bug #8764]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_require.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42522)
+++ ChangeLog	(revision 42523)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Aug 11 22:57:24 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/ruby/test_require.rb (assert_require_nonascii_path): OS path
+	  encoding on Windows is fixed, so encoding of __FILE__ should be it.
+	  [ruby-core:56498] [Bug #8764]
+
 Sun Aug 11 19:11:45 2013  Kouhei Sutou  <kou@c...>
 
 	* test/rexml/parser/test_sax2.rb: Expand abbreviated class name.
Index: test/ruby/test_require.rb
===================================================================
--- test/ruby/test_require.rb	(revision 42522)
+++ test/ruby/test_require.rb	(revision 42523)
@@ -75,6 +75,17 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L75
     assert_require_nonascii_path(encoding, bug8676)
   end
 
+  case RUBY_PLATFORM
+  when /cygwin/, /mswin/, /mingw/
+    def self.ospath_encoding(path)
+      Encoding::UTF_8
+    end
+  else
+    def self.ospath_encoding(path)
+      path.encoding
+    end
+  end
+
   def assert_require_nonascii_path(encoding, bug)
     Dir.mktmpdir {|tmp|
       dir = "\u3042" * 5
@@ -94,8 +105,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L105
         $:.clear
         assert_nothing_raised(LoadError, bug) {
           assert(require(require_path), bug)
-          assert_equal(Encoding.find(encoding), $".last.encoding)
-          assert_equal(Encoding.find(encoding), $:.last.encoding, '[Bug #8753]')
+          assert_equal(self.class.ospath_encoding(require_path), $:.last.encoding, '[Bug #8753]')
           assert(!require(require_path), bug)
         }
       ensure

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]