[前][次][番号順一覧][スレッド一覧]

ruby-changes:43447

From: nobu <ko1@a...>
Date: Tue, 28 Jun 2016 15:56:55 +0900 (JST)
Subject: [ruby-changes:43447] nobu:r55521 (trunk): Skip unavailable tests

nobu	2016-06-28 15:56:50 +0900 (Tue, 28 Jun 2016)

  New Revision: 55521

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55521

  Log:
    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.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/enc/test_case_comprehensive.rb
    trunk/test/test_unicode_normalize.rb
Index: test/test_unicode_normalize.rb
===================================================================
--- test/test_unicode_normalize.rb	(revision 55520)
+++ test/test_unicode_normalize.rb	(revision 55521)
@@ -11,15 +11,24 @@ class TestUnicodeNormalize < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/test_unicode_normalize.rb#L11
   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: https://github.com/ruby/ruby/blob/trunk/test/test_unicode_normalize.rb#L42
     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: https://github.com/ruby/ruby/blob/trunk/test/test_unicode_normalize.rb#L146
   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)
Index: test/ruby/enc/test_case_comprehensive.rb
===================================================================
--- test/ruby/enc/test_case_comprehensive.rb	(revision 55520)
+++ test/ruby/enc/test_case_comprehensive.rb	(revision 55521)
@@ -25,7 +25,12 @@ class TestComprehensiveCaseFold < Test:: https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_case_comprehensive.rb#L25
   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:: https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_case_comprehensive.rb#L243
     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'
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55520)
+++ ChangeLog	(revision 55521)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jun 28 15:56:48 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* lib/net/http.rb (Net::HTTP#proxy_uri): cache the case no proxy

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]