Kouhei Sutou
null+****@clear*****
Mon Aug 12 12:23:13 JST 2013
Kouhei Sutou 2013-08-12 12:23:13 +0900 (Mon, 12 Aug 2013) New Revision: 57fa7d710ac01e87bd533554d541761654640d80 https://github.com/groonga/grntest/commit/57fa7d710ac01e87bd533554d541761654640d80 Message: Extract base result class Added files: lib/grntest/base-result.rb Modified files: lib/grntest/tester.rb Added: lib/grntest/base-result.rb (+32 -0) 100644 =================================================================== --- /dev/null +++ lib/grntest/base-result.rb 2013-08-12 12:23:13 +0900 (4db45d3) @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012-2013 Kouhei Sutou <kou �� clear-code.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +module Grntest + class BaseResult + attr_accessor :elapsed_time + def initialize + @elapsed_time = 0 + end + + def measure + start_time = Time.now + yield + ensure + @elapsed_time = Time.now - start_time + end + end +end Modified: lib/grntest/tester.rb (+4 -17) =================================================================== --- lib/grntest/tester.rb 2013-08-12 12:22:48 +0900 (bc0a232) +++ lib/grntest/tester.rb 2013-08-12 12:23:13 +0900 (25492ae) @@ -24,6 +24,7 @@ require "grntest/error" require "grntest/reporters" require "grntest/executors" require "grntest/test-runner" +require "grntest/base-result" module Grntest class Tester @@ -366,21 +367,7 @@ module Grntest end end - class Result - attr_accessor :elapsed_time - def initialize - @elapsed_time = 0 - end - - def measure - start_time = Time.now - yield - ensure - @elapsed_time = Time.now - start_time - end - end - - class WorkerResult < Result + class WorkerResult < BaseResult attr_reader :n_tests, :n_passed_tests, :n_leaked_tests attr_reader :n_omitted_tests, :n_not_checked_tests attr_reader :failed_tests @@ -523,7 +510,7 @@ module Grntest end end - class TestSuitesResult < Result + class TestSuitesResult < BaseResult attr_accessor :workers attr_accessor :n_total_tests def initialize @@ -640,7 +627,7 @@ module Grntest end end - class TestResult < Result + class TestResult < BaseResult attr_accessor :worker_id, :test_name attr_accessor :expected, :actual, :n_leaked_objects attr_writer :omitted -------------- next part -------------- HTML����������������������������... 下載