[Groonga-commit] ranguba/epub-searcher at 88122bd [master] Ignore the number of line breaks in texts to compare in test fixtures

Back to archive index

KITAITI Makoto null+****@clear*****
Thu Sep 25 03:36:08 JST 2014


KITAITI Makoto	2014-09-25 03:36:08 +0900 (Thu, 25 Sep 2014)

  New Revision: 88122bd2a9053f7ae6497cadc2b058682adcff7e
  https://github.com/ranguba/epub-searcher/commit/88122bd2a9053f7ae6497cadc2b058682adcff7e

  Merged 3272911: Merge pull request #1 from KitaitiMakoto/update-nokogiri

  Message:
    Ignore the number of line breaks in texts to compare in test fixtures

  Modified files:
    test/epub-searcher/database_test.rb
    test/epub-searcher/epub_document_test.rb
    test/epub-searcher/remote_database_test.rb

  Modified: test/epub-searcher/database_test.rb (+2 -1)
===================================================================
--- test/epub-searcher/database_test.rb    2013-07-22 11:06:10 +0900 (23ab041)
+++ test/epub-searcher/database_test.rb    2014-09-25 03:36:08 +0900 (fe5b43b)
@@ -59,8 +59,9 @@ class TestDatabase < Test::Unit::TestCase
       dumped_text = `#{dump_command}`.gsub(%r|/.+?/test/epub-searcher/fixtures/|) do
         "${PREFIX}/test/epub-searcher/fixtures/"
       end
+      dumped_text.gsub!(/(?:\\r\\n)+/, "\\r\\n")
 
-      expected = File.read(fixture_path('loaded_records_dump_expected.txt'))
+      expected = File.read(fixture_path('loaded_records_dump_expected.txt')).gsub!(/(?:\\r\\n)+/, "\\r\\n")
       assert_equal(expected, dumped_text)
     end
   end

  Modified: test/epub-searcher/epub_document_test.rb (+3 -2)
===================================================================
--- test/epub-searcher/epub_document_test.rb    2013-07-22 11:06:10 +0900 (fe29fd1)
+++ test/epub-searcher/epub_document_test.rb    2014-09-25 03:36:08 +0900 (ba32934)
@@ -27,8 +27,9 @@ class TestEPUBDocument < Test::Unit::TestCase
   end
 
   def assert_equal_main_text(expected_file, document)
-    expected_text = File.read(fixture_path(expected_file))
-    assert_equal(expected_text, document.extract_main_text)
+    expected_text = File.read(fixture_path(expected_file)).gsub(/(?:\r\n)+/, "\r\n")
+    main_text = document.extract_main_text.gsub(/(?:\r\n)+/, "\r\n")
+    assert_equal(expected_text, main_text)
   end
 
   def assert_equal_xhtml_spine(expected, document)

  Modified: test/epub-searcher/remote_database_test.rb (+2 -1)
===================================================================
--- test/epub-searcher/remote_database_test.rb    2013-07-22 11:06:10 +0900 (69525a8)
+++ test/epub-searcher/remote_database_test.rb    2014-09-25 03:36:08 +0900 (b5bea38)
@@ -62,12 +62,13 @@ class TestRemoteDatabase < Test::Unit::TestCase
       expected_values = File.read(fixture_path('load_records_params_values_expected.txt'))
       expected = {
         :table => :Books,
-        :values => expected_values,
+        :values => expected_values.gsub(/(?:(\\r\\n)+)/, "\\r\\n"),
       }
       @database.client.expects(:load).with do |actual_params|
         actual_params[:values].gsub!(%r|"file_path":"/.+?/test/epub-searcher/fixtures/|) do
           "\"file_path\":\"${PREFIX}/test/epub-searcher/fixtures/"
         end
+        actual_params[:values].gsub!(/(?:\\r\\n)+/, "\\r\\n")
         expected == actual_params
       end
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index