Created
February 3, 2010 20:59
-
-
Save mileszs/294014 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
module Test | |
module Unit | |
class Slow | |
attr_reader :test_name, :message | |
def initialize(test_name) | |
@test_name = test_name | |
@message = "Too slow." | |
end | |
def single_character_display | |
"☻" | |
end | |
def short_display | |
"#@test_name: #{@message}" | |
end | |
def long_display | |
short_display | |
end | |
def to_s | |
long_display | |
end | |
end | |
end | |
end | |
module Test | |
module Unit | |
module UI | |
module Console | |
class TestRunner | |
def test_started(name) | |
@individual_test_start_time = Time.now | |
output_single(name + ": ", VERBOSE) | |
end | |
def test_finished(name) | |
elapsed_test_time = Time.now - @individual_test_start_time | |
if elapsed_test_time > 1 | |
add_fault(Test::Unit::Slow.new(name)) | |
else | |
output_single(".", PROGRESS_ONLY) unless (@already_outputted) | |
nl(VERBOSE) | |
@already_outputted = false | |
end | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment