Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use context.result instead of $stderr.puts #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abetomo
Copy link
Contributor

@abetomo abetomo commented Feb 19, 2025

It is easier to understand the output when a test fails.

It is easier to understand the output when a test fails.
@@ -218,7 +218,7 @@ def run_groonga(context, &block)
run_groonga_http(context, &block)
end
rescue => error
$stderr.puts("#{error.class}: #{error}")
context.result << [:error, "#{error.class}: #{error}", {}]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grntest::Executors::BaseExecutorにprivateメソッドで、contextに結果を追加するAPIがあるのですが、
こちらをpublicに変更して利用するのはどうでしょう?

def log_error(content)
log_force(:error, content, {})
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

それは executor が持ってるやつで、この時点だと executor を絡めるよりは context を使ったほうが良さそうと思ったんですが、そんなことはないですか?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すみません。
改めてコードを見てみたのですが、確かにcontextを利用して上げるほうが良さそうですね!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants