Navigation Menu

Skip to content

Commit

Permalink
Add a method to measure elapsed time
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 8, 2012
1 parent 7de4fc2 commit 5e7a255
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/groonga/tester.rb
Expand Up @@ -267,6 +267,13 @@ def initialize(test_name)
@actual = nil
@expected = nil
end

def measure
start_time = Time.now
yield
ensure
@elapsed_time = Time.now - start_time
end
end

class TestRunner
Expand All @@ -285,9 +292,9 @@ def run(reporter)
test_name = @test_script_path.basename.to_s
result = TestResult.new(test_name)
reporter.start_test(test_name)
started_time = Time.now
result.actual = run_groonga_script
result.elapsed_time = Time.now - started_time
result.measure do
result.actual = run_groonga_script
end
result.actual = normalize_result(result.actual)
result.expected = read_expected_result
if result.expected
Expand Down

0 comments on commit 5e7a255

Please sign in to comment.