aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/enc
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-23 00:30:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-23 00:30:33 +0000
commit1e85e42bded8436366758c86108bda9dd77490a0 (patch)
tree52ad99a7353ba0dce0914a6d808280dd7106a432 /test/ruby/enc
parent7825e8363d4b2ccad8e2d3f5eeba9e26f6656911 (diff)
downloadruby-1e85e42bded8436366758c86108bda9dd77490a0.tar.gz
fix unicode data directory
* test/ruby/enc/test_regex_casefold.rb: fix searching unicode data directory, like as test_case_comprehensive.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/enc')
-rw-r--r--test/ruby/enc/test_regex_casefold.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/ruby/enc/test_regex_casefold.rb b/test/ruby/enc/test_regex_casefold.rb
index bc8429c8a9..2b252bd441 100644
--- a/test/ruby/enc/test_regex_casefold.rb
+++ b/test/ruby/enc/test_regex_casefold.rb
@@ -5,6 +5,8 @@ require "test/unit"
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::TestCase
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|