Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal fix for warnings #119

Merged
merged 3 commits into from May 10, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -8,6 +8,7 @@ Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.test_files = FileList['test/test_*.rb']
test.verbose = true
test.warning = true
end

require 'cucumber/rake/task'
Expand Down
2 changes: 1 addition & 1 deletion lib/simplecov.rb
Expand Up @@ -48,7 +48,7 @@ def result
SimpleCov::ResultMerger.store_result(@result) if @result
return SimpleCov::ResultMerger.merged_result
else
return @result
return @result if defined? @result
end
ensure
self.running = false
Expand Down
8 changes: 4 additions & 4 deletions lib/simplecov/configuration.rb
Expand Up @@ -14,7 +14,7 @@ module SimpleCov::Configuration
# Configure with SimpleCov.root('/my/project/path')
#
def root(root=nil)
return @root if @root and root.nil?
return @root if defined? @root and root.nil?
@root = File.expand_path(root || Dir.getwd)
end

Expand All @@ -24,7 +24,7 @@ def root(root=nil)
# Configure with SimpleCov.coverage_dir('cov')
#
def coverage_dir(dir=nil)
return @coverage_dir if @coverage_dir and dir.nil?
return @coverage_dir if defined? @coverage_dir and dir.nil?
@coverage_dir = (dir || 'coverage')
end

Expand Down Expand Up @@ -67,7 +67,7 @@ def command_name(name=nil)
# Configure with: SimpleCov.formatter(SimpleCov::Formatter::SimpleFormatter)
#
def formatter(formatter=nil)
return @formatter if @formatter and formatter.nil?
return @formatter if defined? @formatter and formatter.nil?
@formatter = formatter
raise "No formatter configured. Please specify a formatter using SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter" unless @formatter
@formatter
Expand All @@ -81,7 +81,7 @@ def formatter(formatter=nil)
# Configure with SimpleCov.nocov_token('skip') or it's alias SimpleCov.skip_token('skip')
#
def nocov_token(nocov_token=nil)
return @nocov_token if @nocov_token and nocov_token.nil?
return @nocov_token if defined? @nocov_token and nocov_token.nil?
@nocov_token = (nocov_token || 'nocov')
end
alias_method :skip_token, :nocov_token
Expand Down
4 changes: 2 additions & 2 deletions lib/simplecov/result.rb
Expand Up @@ -58,7 +58,7 @@ def covered_strength

# Returns the count of lines that are covered
def covered_lines
return @covered_lines if @covered_lines
return @covered_lines if defined? @covered_lines
@covered_lines = 0
@files.each do |file|
original_result[file.filename].each do |line_result|
Expand All @@ -70,7 +70,7 @@ def covered_lines

# Returns the count of missed lines
def missed_lines
return @missed_lines if @missed_lines
return @missed_lines if defined? @missed_lines
@missed_lines = 0
@files.each do |file|
original_result[file.filename].each do |line_result|
Expand Down
2 changes: 1 addition & 1 deletion lib/simplecov/source_file.rb
Expand Up @@ -84,7 +84,7 @@ def initialize(filename, coverage)
# Returns all source lines for this file as instances of SimpleCov::SourceFile::Line,
# and thus including coverage data. Aliased as :source_lines
def lines
return @lines unless @lines.nil?
return @lines if defined? @lines

# Warning to identify condition from Issue #56
if coverage.size > src.size
Expand Down
2 changes: 1 addition & 1 deletion test/test_source_file.rb
Expand Up @@ -68,7 +68,7 @@ class TestSourceFile < Test::Unit::TestCase
@source_file.lines
end

assert_match /^Warning: coverage data provided/, captured_output
assert_match(/^Warning: coverage data provided/, captured_output)
end
end

Expand Down