ruby-changes:49301
From: nobu <ko1@a...>
Date: Sat, 23 Dec 2017 09:30:53 +0900 (JST)
Subject: [ruby-changes:49301] nobu:r61417 (trunk): fix unicode data directory
nobu 2017-12-23 09:30:33 +0900 (Sat, 23 Dec 2017) New Revision: 61417 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61417 Log: fix unicode data directory * test/ruby/enc/test_regex_casefold.rb: fix searching unicode data directory, like as test_case_comprehensive.rb. Modified files: trunk/test/ruby/enc/test_regex_casefold.rb Index: test/ruby/enc/test_regex_casefold.rb =================================================================== --- test/ruby/enc/test_regex_casefold.rb (revision 61416) +++ test/ruby/enc/test_regex_casefold.rb (revision 61417) @@ -5,6 +5,8 @@ require "test/unit" https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_regex_casefold.rb#L5 class TestCaseFold < Test::Unit::TestCase UNICODE_VERSION = RbConfig::CONFIG['UNICODE_VERSION'] + path = File.expand_path("../../../enc/unicode/data/#{UNICODE_VERSION}", __dir__) + UNICODE_DATA_PATH = File.directory?("#{path}/ucd") ? "#{path}/ucd" : path CaseTest = Struct.new :source, :target, :kind, :line def check_downcase_properties(expected, start, *flags) @@ -17,11 +19,7 @@ class TestCaseFold < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_regex_casefold.rb#L19 end def read_tests - 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) + IO.readlines("#{UNICODE_DATA_PATH}/CaseFolding.txt", encoding: Encoding::ASCII_8BIT) .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/