diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-22 12:39:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-22 12:39:32 +0000 |
commit | 73bed0312895322e0fd18310e840356c8e6af812 (patch) | |
tree | ae90c2baabdcbe8ab4eb65b206b493b82a654c3c /test | |
parent | 52220154a8310d0140829daa1de665003bb11dec (diff) | |
download | ruby-73bed0312895322e0fd18310e840356c8e6af812.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/enc/test_case_comprehensive.rb | 3 | ||||
-rw-r--r-- | test/ruby/enc/test_regex_casefold.rb | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/test/ruby/enc/test_case_comprehensive.rb b/test/ruby/enc/test_case_comprehensive.rb index 2a759cc54d..cd6447e928 100644 --- a/test/ruby/enc/test_case_comprehensive.rb +++ b/test/ruby/enc/test_case_comprehensive.rb @@ -5,7 +5,8 @@ require "test/unit" 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*') diff --git a/test/ruby/enc/test_regex_casefold.rb b/test/ruby/enc/test_regex_casefold.rb index cc525c268e..bc8429c8a9 100644 --- a/test/ruby/enc/test_regex_casefold.rb +++ b/test/ruby/enc/test_regex_casefold.rb @@ -17,7 +17,11 @@ class TestCaseFold < Test::Unit::TestCase 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| |