Kouhei Sutou 2018-11-07 14:35:33 +0900 (Wed, 07 Nov 2018) Revision: 4953ca81b87d2217fbd7953bbc30b4c372c208bd https://github.com/groonga/groonga-query-log/commit/4953ca81b87d2217fbd7953bbc30b4c372c208bd Message: test: add a test error log case Added files: test/fixtures/regression-test-logs/error.log Modified files: test/command/test-format-regression-test-logs.rb Modified: test/command/test-format-regression-test-logs.rb (+28 -5) =================================================================== --- test/command/test-format-regression-test-logs.rb 2018-11-07 14:30:35 +0900 (b99793c) +++ test/command/test-format-regression-test-logs.rb 2018-11-07 14:35:33 +0900 (4d2f4c0) @@ -26,12 +26,16 @@ class FormatRegressionTestLogsCommandTest < Test::Unit::TestCase def run_command(command_line) stdout = $stdout.dup output = Tempfile.open("output") - $stdout.reopen(output) - succees =****@comma*****(command_line) - output.rewind + success = false + begin + $stdout.reopen(output) + succees =****@comma*****(command_line) + ensure + $stdout.reopen(stdout) + end + output.close + output.open [succees, output.read] - ensure - $stdout.reopen(stdout) end def fixture_path(*components) @@ -85,4 +89,23 @@ Arguments: assert_equal([true, output], run_command([fixture_path("url-format.log")])) end + + def test_error + output = <<-OUTPUT +Command: +/d/select?table=Logs&match_columns=message&query=%E7%84%BC%E8%82%89 +Name: select +Arguments: + match_columns: message + query: 焼肉 + table: Logs +Error: Message +Backtrace: +1 +2 +3 + OUTPUT + assert_equal([true, output], + run_command([fixture_path("error.log")])) + end end Added: test/fixtures/regression-test-logs/error.log (+5 -0) 100644 =================================================================== --- /dev/null +++ test/fixtures/regression-test-logs/error.log 2018-11-07 14:35:33 +0900 (f4d8fdb) @@ -0,0 +1,5 @@ +command: /d/select?table=Logs&match_columns=message&query=%E7%84%BC%E8%82%89 +backtrace: 3 +backtrace: 2 +backtrace: 1 +error: Message -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181107/519297a9/attachment-0001.html>