diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-28 06:56:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-28 06:56:50 +0000 |
commit | 023aaa51a20cb4e0dc92daa4d2197741bcf8bd6c (patch) | |
tree | a80b72df76cf2c1aceec06564c3d219168cdeb40 | |
parent | 5026a663ab3e01600131b9bd84c672548a1cd3d8 (diff) |
Skip unavailable tests
* test/ruby/enc/test_case_comprehensive.rb: noting to test if
Unicode data files are available.
[ruby-core:76160] [Bug #12433]
* test/test_unicode_normalize.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | test/ruby/enc/test_case_comprehensive.rb | 14 | ||||
-rw-r--r-- | test/test_unicode_normalize.rb | 24 |
3 files changed, 27 insertions, 19 deletions
@@ -1,3 +1,11 @@ +Tue Jun 28 15:56:48 2016 Nobuyoshi Nakada <[email protected]> + + * test/ruby/enc/test_case_comprehensive.rb: noting to test if + Unicode data files are available. + [ruby-core:76160] [Bug #12433] + + * test/test_unicode_normalize.rb: ditto. + Tue Jun 28 15:20:18 2016 Nobuyoshi Nakada <[email protected]> * lib/net/http.rb (Net::HTTP#proxy_uri): cache the case no proxy diff --git a/test/ruby/enc/test_case_comprehensive.rb b/test/ruby/enc/test_case_comprehensive.rb index 6d561d6d33..bb80b6f8ce 100644 --- a/test/ruby/enc/test_case_comprehensive.rb +++ b/test/ruby/enc/test_case_comprehensive.rb @@ -25,7 +25,12 @@ class TestComprehensiveCaseFold < Test::Unit::TestCase def self.expand_filename(basename) File.expand_path("#{UNICODE_DATA_PATH}/#{basename}.txt", __dir__) end +end +%w[UnicodeData CaseFolding SpecialCasing].all? {|f| + File.exist?(TestComprehensiveCaseFold.expand_filename(f)) +} and +class TestComprehensiveCaseFold def self.read_data_file (filename) IO.foreach(expand_filename(filename), encoding: Encoding::ASCII_8BIT) do |line| if $. == 1 @@ -238,15 +243,6 @@ class TestComprehensiveCaseFold < Test::Unit::TestCase end end - 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_ascii_only_case_mapping_tests 'ISO-8859-2' generate_ascii_only_case_mapping_tests 'ISO-8859-3' generate_ascii_only_case_mapping_tests 'ISO-8859-4' diff --git a/test/test_unicode_normalize.rb b/test/test_unicode_normalize.rb index 211f8f5430..be1bf5f49b 100644 --- a/test/test_unicode_normalize.rb +++ b/test/test_unicode_normalize.rb @@ -11,15 +11,24 @@ class TestUnicodeNormalize < Test::Unit::TestCase UNICODE_VERSION = UnicodeNormalize::UNICODE_VERSION UNICODE_DATA_PATH = "../enc/unicode/data/#{UNICODE_VERSION}" - def expand_filename(basename) + def self.expand_filename(basename) File.expand_path("#{UNICODE_DATA_PATH}/#{basename}.txt", __dir__) end +end +%w[NormalizationTest].all? {|f| + File.exist?(TestUnicodeNormalize.expand_filename(f)) +} and +class TestUnicodeNormalize NormTest = Struct.new :source, :NFC, :NFD, :NFKC, :NFKD, :line - def read_tests - IO.readlines(expand_filename('NormalizationTest'), encoding: 'utf-8') - .tap { |lines| assert_include(lines[0], "NormalizationTest-#{UNICODE_VERSION}.txt")} + def self.read_tests + lines = IO.readlines(expand_filename('NormalizationTest'), encoding: 'utf-8') + firstline = lines.shift + define_method "test_0_normalizationtest_firstline" do + assert_include(firstline, "NormalizationTest-#{UNICODE_VERSION}.txt") + end + lines .collect.with_index { |linedata, linenumber| [linedata, linenumber]} .reject { |line| line[0] =~ /^[\#@]/ } .collect do |line| @@ -33,7 +42,7 @@ class TestUnicodeNormalize < Test::Unit::TestCase string.codepoints.collect { |cp| cp.to_s(16).upcase.rjust(4, '0') } end - def setup + begin @@tests ||= read_tests rescue Errno::ENOENT => e @@tests ||= [] @@ -137,11 +146,6 @@ class TestUnicodeNormalize < Test::Unit::TestCase generate_test_check_false :NFD, :NFKC, :nfkc generate_test_check_false :NFKD, :NFKC, :nfkc - def test_AAAAA_data_file_available # AAAAA makes sure this test is run first - expanded = expand_filename 'NormalizationTest' - assert File.exist?(expanded), "File #{expanded} missing." - end - def test_non_UTF_8 assert_equal "\u1E0A".encode('UTF-16BE'), "D\u0307".encode('UTF-16BE').unicode_normalize(:nfc) assert_equal true, "\u1E0A".encode('UTF-16BE').unicode_normalized?(:nfc) |