Kouhei Sutou
null+****@clear*****
Wed Jul 23 13:38:49 JST 2014
Kouhei Sutou 2014-07-23 13:38:49 +0900 (Wed, 23 Jul 2014) New Revision: f68025e177e48c82d2978cce12d772d9e317d612 https://github.com/groonga/groonga-query-log/commit/f68025e177e48c82d2978cce12d772d9e317d612 Message: test: add a test for JSON stream reporter Added files: test/fixtures/reporter/json-stream.expected Modified files: test/test-analyzer.rb Added: test/fixtures/reporter/json-stream.expected (+2 -0) 100644 =================================================================== --- /dev/null +++ test/fixtures/reporter/json-stream.expected 2014-07-23 13:38:49 +0900 (206c5d4) @@ -0,0 +1,2 @@ +{"start_time":START_TIME,"last_time":LAST_TIME,"elapsed":0.003128856,"return_code":0,"slow":false,"command":{"raw":"load --table Video","name":"load","parameters":[{"key":"table","value":"Video"}]},"operations":[]} +{"start_time":START_TIME,"last_time":LAST_TIME,"elapsed":0.00121714,"return_code":0,"slow":false,"command":{"raw":"select --table Users --query follower:@groonga --output_columns _key,name","name":"select","parameters":[{"key":"table","value":"Users"},{"key":"query","value":"follower:@groonga"},{"key":"output_columns","value":"_key,name"}]},"operations":[{"name":"filter","relative_elapsed":0.0008429529999999999,"context":"query: follower:@groonga","slow":false},{"name":"select","relative_elapsed":2.7947e-05,"context":null,"slow":false},{"name":"output","relative_elapsed":0.000195852,"context":"_key,name","slow":false}]} Modified: test/test-analyzer.rb (+6 -2) =================================================================== --- test/test-analyzer.rb 2014-07-23 13:37:19 +0900 (e1dd4e2) +++ test/test-analyzer.rb 2014-07-23 13:38:49 +0900 (487731f) @@ -50,10 +50,14 @@ class AnalyzerTest < Test::Unit::TestCase data("console" => "console", "HTML" => "html", - "JSON" => "json") + "JSON" => "json", + "JSON stream" => "json-stream") def test_reporter(reporter) actual_result = run_analyzer("--reporter", reporter, @query_log_path) - actual_result = normalize_json(actual_result) if reporter == "json" + case reporter + when "json", "json-stream" + actual_result = normalize_json(actual_result) + end expected_result = expected_analyzed_query("reporter/#{reporter}.expected") assert_equal(expected_result, actual_result) -------------- next part -------------- HTML����������������������������...Download