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

ruby-changes:49298

From: nobu <ko1@a...>
Date: Fri, 22 Dec 2017 21:39:39 +0900 (JST)
Subject: [ruby-changes:49298] nobu:r61415 (trunk): update unicode data files directory

nobu	2017-12-22 21:39:32 +0900 (Fri, 22 Dec 2017)

  New Revision: 61415

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

  Log:
    update unicode data files directory
    
    * test/ruby/enc/test_case_comprehensive.rb: search ucd directory
      first if exists.
    
    * test/ruby/enc/test_regex_casefold.rb: ditto.

  Modified files:
    trunk/test/ruby/enc/test_case_comprehensive.rb
    trunk/test/ruby/enc/test_regex_casefold.rb
Index: test/ruby/enc/test_case_comprehensive.rb
===================================================================
--- test/ruby/enc/test_case_comprehensive.rb	(revision 61414)
+++ test/ruby/enc/test_case_comprehensive.rb	(revision 61415)
@@ -5,7 +5,8 @@ require "test/unit" https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_case_comprehensive.rb#L5
 
 class TestComprehensiveCaseMapping < Test::Unit::TestCase
   UNICODE_VERSION = RbConfig::CONFIG['UNICODE_VERSION']
-  UNICODE_DATA_PATH = "../../../enc/unicode/data/#{UNICODE_VERSION}"
+  path = File.expand_path("../../../enc/unicode/data/#{UNICODE_VERSION}", __dir__)
+  UNICODE_DATA_PATH = File.directory?("#{path}/ucd") ? "#{path}/ucd" : path
 
   def self.hex2utf8(s)
     s.split(' ').map { |c| c.to_i(16) }.pack('U*')
Index: test/ruby/enc/test_regex_casefold.rb
===================================================================
--- test/ruby/enc/test_regex_casefold.rb	(revision 61414)
+++ test/ruby/enc/test_regex_casefold.rb	(revision 61415)
@@ -17,7 +17,11 @@ class TestCaseFold < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_regex_casefold.rb#L17
   end
 
   def read_tests
-    IO.readlines(File.expand_path("../../../enc/unicode/data/#{UNICODE_VERSION}/CaseFolding.txt", __dir__), encoding: Encoding::ASCII_8BIT)
+    path = "../../../enc/unicode/data/#{UNICODE_VERSION}"
+    name = "CaseFolding.txt"
+    (%w[/ucd/ /].any? do |sub|
+       break IO.readlines(File.expand_path("#{path}#{sub}#{name}", __dir__), encoding: Encoding::ASCII_8BIT) rescue nil
+     end or raise)
     .collect.with_index { |linedata, linenumber| [linenumber.to_i+1, linedata.chomp] }
     .reject { |number, data| data =~ /^(#|$)/ }
     .collect do |linenumber, linedata|

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

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