diff options
author | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-28 10:08:37 +0000 |
---|---|---|
committer | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-28 10:08:37 +0000 |
commit | 62efd110f2a5a5d193a036917a256bfb516ba7e4 (patch) | |
tree | fa04276f35d5cc0f16685c74760ed0229cf61079 /test/ruby | |
parent | adf26d99b95c3474066c9f2fbf5ac1fc1197156d (diff) | |
download | ruby-62efd110f2a5a5d193a036917a256bfb516ba7e4.tar.gz |
* test/ruby/enc/test_case_comprehensive.rb: Add error messages to tests
for data file availability; refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/enc/test_case_comprehensive.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/test/ruby/enc/test_case_comprehensive.rb b/test/ruby/enc/test_case_comprehensive.rb index bd2350f6ae..dcaebd1c4e 100644 --- a/test/ruby/enc/test_case_comprehensive.rb +++ b/test/ruby/enc/test_case_comprehensive.rb @@ -21,8 +21,12 @@ class TestComprehensiveCaseFold < Test::Unit::TestCase s.split(' ').map { |c| c.to_i(16) }.pack('U*') end + def self.expand_filename(basename) + File.expand_path("#{UNICODE_DATA_PATH}/#{basename}.txt", __dir__) + end + def self.read_data_file (filename) - IO.readlines(File.expand_path("#{UNICODE_DATA_PATH}/#{filename}.txt", __dir__), encoding: Encoding::ASCII_8BIT) + IO.readlines(expand_filename(filename), encoding: Encoding::ASCII_8BIT) .tap do |lines| raise "File Version Mismatch" unless filename=='UnicodeData' or /#{filename}-#{UNICODE_VERSION}\.txt/ =~ lines[0] end @@ -113,10 +117,13 @@ class TestComprehensiveCaseFold < Test::Unit::TestCase end end - def test_AAAAA_data_files_available - assert File.exist? File.expand_path("#{UNICODE_DATA_PATH}/UnicodeData.txt", __dir__) - assert File.exist? File.expand_path("#{UNICODE_DATA_PATH}/CaseFolding.txt", __dir__) - assert File.exist? File.expand_path("#{UNICODE_DATA_PATH}/SpecialCasing.txt", __dir__) + def check_file_available(filename) + expanded = self.class.expand_filename(filename) + assert File.exist?(expanded), "File #{expanded} missing." + end + + def test_AAAAA_data_files_available # AAAAA makes sure this test is run first + %w[UnicodeData CaseFolding SpecialCasing].each { |f| check_file_available f } end generate_casefold_tests 'US-ASCII' |