mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
7825e8363d
commit
1e85e42bde
1 changed files with 3 additions and 5 deletions
|
@ -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|
|
||||
|
|
Loading…
Add table
Reference in a new issue