1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2016-06-28 06:56:50 +00:00
parent 5026a663ab
commit 023aaa51a2
3 changed files with 27 additions and 19 deletions

View file

@ -1,3 +1,11 @@
Tue Jun 28 15:56:48 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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 <nobu@ruby-lang.org>
* lib/net/http.rb (Net::HTTP#proxy_uri): cache the case no proxy

View file

@ -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'

View file

@ -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)