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

ruby-changes:46649

From: nobu <ko1@a...>
Date: Wed, 17 May 2017 09:28:11 +0900 (JST)
Subject: [ruby-changes:46649] nobu:r58765 (trunk): test_dir_m17n.rb: read in filesystem encoding

nobu	2017-05-17 09:28:01 +0900 (Wed, 17 May 2017)

  New Revision: 58765

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58765

  Log:
    test_dir_m17n.rb: read in filesystem encoding
    
    * test/ruby/test_dir_m17n.rb (test_entries_compose): read in
      filesystem encoding instead of default external encoding on
      Windows too.  these two encodings may differ on some
      environments.

  Modified files:
    trunk/test/ruby/test_dir_m17n.rb
Index: test/ruby/test_dir_m17n.rb
===================================================================
--- test/ruby/test_dir_m17n.rb	(revision 58764)
+++ test/ruby/test_dir_m17n.rb	(revision 58765)
@@ -404,12 +404,12 @@ class TestDir_M17N < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir_m17n.rb#L404
     with_tmpdir {|d|
       orig = %W"d\u{e9}tente x\u{304c 304e 3050 3052 3054}"
       orig.each {|n| open(n, "w") {}}
+      enc = Encoding.find("filesystem")
+      enc = Encoding::ASCII_8BIT if enc == Encoding::US_ASCII
       if /mswin|mingw/ =~ RUBY_PLATFORM
-        opts = {:encoding => Encoding.default_external}
+        opts = {:encoding => enc}
         orig.map! {|o| o.encode("filesystem") rescue o.tr("^a-z", "?")}
       else
-        enc = Encoding.find("filesystem")
-        enc = Encoding::ASCII_8BIT if enc == Encoding::US_ASCII
         orig.each {|o| o.force_encoding(enc) }
       end
       ents = Dir.entries(".", opts).reject {|n| /\A\./ =~ n}

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

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