Navigation Menu

Skip to content

Commit

Permalink
Use boolean instead of exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 27, 2017
1 parent d62ebc8 commit 4b4c0fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions lib/groonga/client/command-line/groonga-client-index-check.rb
Expand Up @@ -104,16 +104,16 @@ def initialize(client, options)
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)
Expand Down Expand Up @@ -205,7 +205,7 @@ def check_missing_source
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)
Expand Down Expand Up @@ -297,7 +297,7 @@ def check_index_integrity
broken_indexes.each do |index_column|
puts "<#{index_column}> is broken."
end
broken_indexes.count
broken_indexes.empty?
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/command-line/test-index-check.rb
Expand Up @@ -103,7 +103,7 @@ def test_check_missing_source
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
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_check_index_integrity
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"))

Expand Down

0 comments on commit 4b4c0fa

Please sign in to comment.