[Groonga-commit] ranguba/groonga-client at 4b4c0fa [master] Use boolean instead of exit code

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Oct 27 16:41:12 JST 2017


Kouhei Sutou	2017-10-27 16:41:12 +0900 (Fri, 27 Oct 2017)

  New Revision: 4b4c0fa72feff5d9ff51c92571c453bb6e05d20d
  https://github.com/ranguba/groonga-client/commit/4b4c0fa72feff5d9ff51c92571c453bb6e05d20d

  Message:
    Use boolean instead of exit code

  Modified files:
    lib/groonga/client/command-line/groonga-client-index-check.rb
    test/command-line/test-index-check.rb

  Modified: lib/groonga/client/command-line/groonga-client-index-check.rb (+6 -6)
===================================================================
--- lib/groonga/client/command-line/groonga-client-index-check.rb    2017-10-27 16:39:25 +0900 (8f58ed8)
+++ lib/groonga/client/command-line/groonga-client-index-check.rb    2017-10-27 16:41:12 +0900 (c6e93de)
@@ -104,16 +104,16 @@ module Groonga
           end
 
           def check
-            succeeded = 1
             catch(:fail) do
+              succeeded = true
               if @options[:check_missing_source]
-                succeeded = check_missing_source
+                succeeded = false unless check_missing_source
               end
               if @options[:check_index_integrity]
-                succeeded = check_index_integrity
+                succeeded = false unless check_index_integrity
               end
+              succeeded
             end
-            succeeded
           end
 
           def abort_run(message)
@@ -205,7 +205,7 @@ module Groonga
             missing_index_names.each do |column|
               puts "index column:<#{column}> is missing source."
             end
-            missing_index_names.count
+            missing_index_names.empty?
           end
 
           def list_tokens(table_name)
@@ -297,7 +297,7 @@ module Groonga
             broken_indexes.each do |index_column|
               puts "<#{index_column}> is broken."
             end
-            broken_indexes.count
+            broken_indexes.empty?
           end
         end
       end

  Modified: test/command-line/test-index-check.rb (+2 -2)
===================================================================
--- test/command-line/test-index-check.rb    2017-10-27 16:39:25 +0900 (b58bc1c)
+++ test/command-line/test-index-check.rb    2017-10-27 16:41:12 +0900 (f7bcf92)
@@ -103,7 +103,7 @@ column_create Terms memos_content \
 index column:<Terms.memos_content> is missing source.
 CLIENT_OUTPUT
 
-    assert_equal([1, expected, ""],
+    assert_equal([false, expected, ""],
                  run_client_index_check("--check-missing-source",
                                         "Terms.memos_content"))
   end
@@ -131,7 +131,7 @@ load --table Memos
 check 3 tokens against <Terms.memos_content>.
 CLIENT_OUTPUT
 
-    assert_equal([0, expected, ""],
+    assert_equal([true, expected, ""],
                  run_client_index_check("--check-index-integrity",
                                         "Terms.memos_content"))
     
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171027/37b3d8ea/attachment-0001.htm 



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