simplecov 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +15 -0
- data/README.rdoc +8 -6
- data/features/config_autoload.feature +1 -1
- data/features/config_nocov_token.feature +79 -0
- data/features/cucumber_basic.feature +1 -1
- data/features/merging_test_unit_and_rspec.feature +1 -1
- data/features/rspec_basic.feature +1 -1
- data/features/rspec_groups_and_filters_basic.feature +1 -1
- data/features/skipping_code_blocks_manually.feature +70 -0
- data/features/step_definitions/html_steps.rb +3 -0
- data/features/test_unit_basic.feature +1 -1
- data/features/test_unit_groups_and_filters_basic.feature +1 -1
- data/features/unicode_compatiblity.feature +67 -0
- data/lib/simplecov/configuration.rb +13 -0
- data/lib/simplecov/source_file.rb +28 -12
- data/lib/simplecov/version.rb +1 -1
- data/simplecov.gemspec +1 -1
- data/test/faked_project/lib/faked_project.rb +4 -4
- data/test/helper.rb +1 -0
- data/test/shoulda_macros.rb +18 -0
- data/test/test_source_file_line.rb +32 -34
- metadata +25 -19
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
v0.5.3 (2011-09-13)
|
2
|
+
===================
|
3
|
+
|
4
|
+
* Fix for encoding issues that came from the nocov processing mechanism
|
5
|
+
(see https://github.com/colszowka/simplecov/issues/71)
|
6
|
+
* :nocov: lines are now actually being reflected in the HTML report and are marked in yellow.
|
7
|
+
|
8
|
+
* The Favicon in the HTML report is now determined by the overall coverage and will have the color
|
9
|
+
that the coverage percentage gets as a css class to immediately indicate coverage status on first sight.
|
10
|
+
|
11
|
+
* Introduced SimpleCov::SourceFile::Line#status method that returns the coverage status
|
12
|
+
as a string for this line - made SimpleCov::HTML use that.
|
13
|
+
* Refactored nocov processing and made it configurable using SimpleCov.ncov_token (or it's
|
14
|
+
alias SimpleCov.skip_token)
|
15
|
+
|
1
16
|
v0.5.2 (2011-09-12)
|
2
17
|
===================
|
3
18
|
|
data/README.rdoc
CHANGED
@@ -21,7 +21,7 @@ automatically when you launch SimpleCov. If you're curious, you can find it at h
|
|
21
21
|
|
22
22
|
Update your Gemfile with this and do a bundle install:
|
23
23
|
|
24
|
-
gem 'simplecov', '>= 0.5.
|
24
|
+
gem 'simplecov', '>= 0.5.3', :require => false, :group => :test
|
25
25
|
|
26
26
|
Then, add the following to your test/test_helper.rb (right at the top, line 00) or spec_helper.rb or cucumber env.rb or whatever
|
27
27
|
test framework you prefer, really - just make sure simplecov is loaded and started BEFORE your app code is loaded:
|
@@ -39,17 +39,19 @@ for it which will give you handy tabs in the output webpage for your Controllers
|
|
39
39
|
|
40
40
|
== Example output
|
41
41
|
|
42
|
-
|
42
|
+
<b>Coverage results report, fully browsable locally with sorting and much more:</b>
|
43
|
+
http://colszowka.github.com/simplecov/devise_result-0.5.3.png
|
43
44
|
|
44
|
-
|
45
|
+
<b>Source file coverage details view:</b>
|
46
|
+
http://colszowka.github.com/simplecov/devise_source_file-0.5.3.png
|
45
47
|
|
46
|
-
==
|
48
|
+
== Use it with any framework!
|
47
49
|
|
48
50
|
Similarily to the usage with Test::Unit described above, the only thing you have to do is to add the simplecov
|
49
51
|
config to the very top of your Cucumber/RSpec/whatever setup file.
|
50
52
|
|
51
|
-
|
52
|
-
Other test frameworks should work accordingly
|
53
|
+
Add the setup code to the <b>top</b> of +features/support/env.rb+ (for Cucumber) or +spec/spec_helper.rb+ (for RSpec).
|
54
|
+
Other test frameworks should work accordingly, whatever their setup file may be:
|
53
55
|
|
54
56
|
require 'simplecov'
|
55
57
|
SimpleCov.start 'rails'
|
@@ -0,0 +1,79 @@
|
|
1
|
+
@test_unit @nocov
|
2
|
+
Feature:
|
3
|
+
|
4
|
+
Code wrapped in # :nocov: will be ignored by coverage reports.
|
5
|
+
The name of the token can be configured with SimpleCov.nocov_token or SimpleCov.skip_token
|
6
|
+
|
7
|
+
Scenario: Custom nocov token using nocov_token
|
8
|
+
Given SimpleCov for Test/Unit is configured with:
|
9
|
+
"""
|
10
|
+
require 'simplecov'
|
11
|
+
SimpleCov.start 'test_frameworks' do
|
12
|
+
nocov_token 'skippit'
|
13
|
+
end
|
14
|
+
"""
|
15
|
+
|
16
|
+
Given a file named "lib/faked_project/nocov.rb" with:
|
17
|
+
"""
|
18
|
+
class SourceCodeWithNocov
|
19
|
+
# :skippit:
|
20
|
+
def some_weird_code
|
21
|
+
never_reached
|
22
|
+
rescue => err
|
23
|
+
but no one cares about invalid ruby here
|
24
|
+
end
|
25
|
+
# :skippit:
|
26
|
+
end
|
27
|
+
"""
|
28
|
+
|
29
|
+
When I open the coverage report generated with `bundle exec rake test`
|
30
|
+
|
31
|
+
Then I should see the source files:
|
32
|
+
| name | coverage |
|
33
|
+
| lib/faked_project.rb | 100.0 % |
|
34
|
+
| lib/faked_project/some_class.rb | 80.0 % |
|
35
|
+
| lib/faked_project/framework_specific.rb | 75.0 % |
|
36
|
+
| lib/faked_project/meta_magic.rb | 100.0 % |
|
37
|
+
| lib/faked_project/nocov.rb | 100.0 % |
|
38
|
+
|
39
|
+
And there should be 5 skipped lines in the source files
|
40
|
+
|
41
|
+
And the report should be based upon:
|
42
|
+
| Unit Tests |
|
43
|
+
|
44
|
+
Scenario: Custom nocov token using skip_token
|
45
|
+
Given SimpleCov for Test/Unit is configured with:
|
46
|
+
"""
|
47
|
+
require 'simplecov'
|
48
|
+
SimpleCov.start 'test_frameworks' do
|
49
|
+
skip_token 'skippit'
|
50
|
+
end
|
51
|
+
"""
|
52
|
+
|
53
|
+
Given a file named "lib/faked_project/nocov.rb" with:
|
54
|
+
"""
|
55
|
+
class SourceCodeWithNocov
|
56
|
+
# :skippit:
|
57
|
+
def some_weird_code
|
58
|
+
never_reached
|
59
|
+
rescue => err
|
60
|
+
but no one cares about invalid ruby here
|
61
|
+
end
|
62
|
+
# :skippit:
|
63
|
+
end
|
64
|
+
"""
|
65
|
+
|
66
|
+
When I open the coverage report generated with `bundle exec rake test`
|
67
|
+
|
68
|
+
Then I should see the source files:
|
69
|
+
| name | coverage |
|
70
|
+
| lib/faked_project.rb | 100.0 % |
|
71
|
+
| lib/faked_project/some_class.rb | 80.0 % |
|
72
|
+
| lib/faked_project/framework_specific.rb | 75.0 % |
|
73
|
+
| lib/faked_project/meta_magic.rb | 100.0 % |
|
74
|
+
| lib/faked_project/nocov.rb | 100.0 % |
|
75
|
+
|
76
|
+
And there should be 5 skipped lines in the source files
|
77
|
+
|
78
|
+
And the report should be based upon:
|
79
|
+
| Unit Tests |
|
@@ -14,7 +14,7 @@ Feature:
|
|
14
14
|
When I open the coverage report generated with `bundle exec cucumber features`
|
15
15
|
Then I should see the groups:
|
16
16
|
| name | coverage | files |
|
17
|
-
| All Files | 91.
|
17
|
+
| All Files | 91.23% | 6 |
|
18
18
|
|
19
19
|
And I should see the source files:
|
20
20
|
| name | coverage |
|
@@ -14,7 +14,7 @@ Feature:
|
|
14
14
|
When I open the coverage report generated with `bundle exec rspec spec`
|
15
15
|
Then I should see the groups:
|
16
16
|
| name | coverage | files |
|
17
|
-
| All Files | 90.
|
17
|
+
| All Files | 90.74% | 6 |
|
18
18
|
|
19
19
|
And I should see the source files:
|
20
20
|
| name | coverage |
|
@@ -17,7 +17,7 @@ Feature:
|
|
17
17
|
When I open the coverage report generated with `bundle exec rspec spec`
|
18
18
|
And I should see the groups:
|
19
19
|
| name | coverage | files |
|
20
|
-
| All Files | 88.
|
20
|
+
| All Files | 88.1% | 4 |
|
21
21
|
| Libs | 86.11% | 3 |
|
22
22
|
| Ungrouped | 100.0% | 1 |
|
23
23
|
|
@@ -0,0 +1,70 @@
|
|
1
|
+
@test_unit @nocov
|
2
|
+
Feature:
|
3
|
+
|
4
|
+
When code is wrapped in :nocov: comment blocks, it does not count
|
5
|
+
against the coverage numbers.
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given SimpleCov for Test/Unit is configured with:
|
9
|
+
"""
|
10
|
+
require 'simplecov'
|
11
|
+
SimpleCov.start 'test_frameworks'
|
12
|
+
"""
|
13
|
+
|
14
|
+
Scenario: Plain run with a nocov'd method
|
15
|
+
Given a file named "lib/faked_project/nocov.rb" with:
|
16
|
+
"""
|
17
|
+
class SourceCodeWithNocov
|
18
|
+
#:nocov:
|
19
|
+
def some_weird_code
|
20
|
+
never_reached
|
21
|
+
rescue => err
|
22
|
+
but no one cares about invalid ruby here
|
23
|
+
end
|
24
|
+
#:nocov:
|
25
|
+
end
|
26
|
+
"""
|
27
|
+
|
28
|
+
When I open the coverage report generated with `bundle exec rake test`
|
29
|
+
|
30
|
+
Then I should see the source files:
|
31
|
+
| name | coverage |
|
32
|
+
| lib/faked_project.rb | 100.0 % |
|
33
|
+
| lib/faked_project/some_class.rb | 80.0 % |
|
34
|
+
| lib/faked_project/framework_specific.rb | 75.0 % |
|
35
|
+
| lib/faked_project/meta_magic.rb | 100.0 % |
|
36
|
+
| lib/faked_project/nocov.rb | 100.0 % |
|
37
|
+
|
38
|
+
And there should be 5 skipped lines in the source files
|
39
|
+
|
40
|
+
And the report should be based upon:
|
41
|
+
| Unit Tests |
|
42
|
+
|
43
|
+
Scenario: Number of spaces should not mix up nocov results
|
44
|
+
Given a file named "lib/faked_project/nocov.rb" with:
|
45
|
+
"""
|
46
|
+
class SourceCodeWithNocov
|
47
|
+
# :nocov:
|
48
|
+
def some_weird_code
|
49
|
+
never_reached
|
50
|
+
rescue => err
|
51
|
+
but no one cares about invalid ruby here
|
52
|
+
end
|
53
|
+
# :nocov:
|
54
|
+
end
|
55
|
+
"""
|
56
|
+
|
57
|
+
When I open the coverage report generated with `bundle exec rake test`
|
58
|
+
|
59
|
+
Then I should see the source files:
|
60
|
+
| name | coverage |
|
61
|
+
| lib/faked_project.rb | 100.0 % |
|
62
|
+
| lib/faked_project/some_class.rb | 80.0 % |
|
63
|
+
| lib/faked_project/framework_specific.rb | 75.0 % |
|
64
|
+
| lib/faked_project/meta_magic.rb | 100.0 % |
|
65
|
+
| lib/faked_project/nocov.rb | 100.0 % |
|
66
|
+
|
67
|
+
And there should be 5 skipped lines in the source files
|
68
|
+
|
69
|
+
And the report should be based upon:
|
70
|
+
| Unit Tests |
|
@@ -40,3 +40,6 @@ Then /^I should see the source files:$/ do |table|
|
|
40
40
|
files.sort_by {|hsh| hsh["name"] }.should == expected_files.sort_by {|hsh| hsh["name"] }
|
41
41
|
end
|
42
42
|
|
43
|
+
Then /^there should be (\d+) skipped lines in the source files$/ do |expected_count|
|
44
|
+
all(".source_table ol li.skipped").count.should == expected_count.to_i
|
45
|
+
end
|
@@ -14,7 +14,7 @@ Feature:
|
|
14
14
|
When I open the coverage report generated with `bundle exec rake test`
|
15
15
|
Then I should see the groups:
|
16
16
|
| name | coverage | files |
|
17
|
-
| All Files | 91.
|
17
|
+
| All Files | 91.38% | 6 |
|
18
18
|
|
19
19
|
And I should see the source files:
|
20
20
|
| name | coverage |
|
@@ -17,7 +17,7 @@ Feature:
|
|
17
17
|
When I open the coverage report generated with `bundle exec rake test`
|
18
18
|
Then I should see the groups:
|
19
19
|
| name | coverage | files |
|
20
|
-
| All Files | 88.
|
20
|
+
| All Files | 88.1% | 4 |
|
21
21
|
| Libs | 86.11% | 3 |
|
22
22
|
| Ungrouped | 100.0% | 1 |
|
23
23
|
|
@@ -0,0 +1,67 @@
|
|
1
|
+
@test_unit @unicode
|
2
|
+
Feature:
|
3
|
+
|
4
|
+
Files with unicode in their source should be no problem at all for
|
5
|
+
generating a proper coverage report.
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given SimpleCov for Test/Unit is configured with:
|
9
|
+
"""
|
10
|
+
require 'simplecov'
|
11
|
+
SimpleCov.start 'test_frameworks'
|
12
|
+
"""
|
13
|
+
|
14
|
+
Scenario: Snowman inside method string
|
15
|
+
Given a file named "lib/faked_project/unicode.rb" with:
|
16
|
+
"""
|
17
|
+
# encoding: UTF-8
|
18
|
+
class SourceCodeWithUnicode
|
19
|
+
def self.yell!
|
20
|
+
puts "☃"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
"""
|
24
|
+
|
25
|
+
When I open the coverage report generated with `bundle exec rake test`
|
26
|
+
Then I should see the groups:
|
27
|
+
| name | coverage | files |
|
28
|
+
| All Files | 86.67% | 5 |
|
29
|
+
|
30
|
+
And I should see the source files:
|
31
|
+
| name | coverage |
|
32
|
+
| lib/faked_project.rb | 100.0 % |
|
33
|
+
| lib/faked_project/some_class.rb | 80.0 % |
|
34
|
+
| lib/faked_project/framework_specific.rb | 75.0 % |
|
35
|
+
| lib/faked_project/meta_magic.rb | 100.0 % |
|
36
|
+
| lib/faked_project/unicode.rb | 66.67 % |
|
37
|
+
|
38
|
+
And the report should be based upon:
|
39
|
+
| Unit Tests |
|
40
|
+
|
41
|
+
Scenario: Author name in comment
|
42
|
+
Given a file named "lib/faked_project/unicode.rb" with:
|
43
|
+
"""
|
44
|
+
# encoding: UTF-8
|
45
|
+
# author: Javiér Hernández
|
46
|
+
class SomeClassWrittenByAForeigner
|
47
|
+
def self.yell!
|
48
|
+
foo
|
49
|
+
end
|
50
|
+
end
|
51
|
+
"""
|
52
|
+
|
53
|
+
When I open the coverage report generated with `bundle exec rake test`
|
54
|
+
Then I should see the groups:
|
55
|
+
| name | coverage | files |
|
56
|
+
| All Files | 86.67% | 5 |
|
57
|
+
|
58
|
+
And I should see the source files:
|
59
|
+
| name | coverage |
|
60
|
+
| lib/faked_project.rb | 100.0 % |
|
61
|
+
| lib/faked_project/some_class.rb | 80.0 % |
|
62
|
+
| lib/faked_project/framework_specific.rb | 75.0 % |
|
63
|
+
| lib/faked_project/meta_magic.rb | 100.0 % |
|
64
|
+
| lib/faked_project/unicode.rb | 66.67 % |
|
65
|
+
|
66
|
+
And the report should be based upon:
|
67
|
+
| Unit Tests |
|
@@ -72,6 +72,19 @@ module SimpleCov::Configuration
|
|
72
72
|
raise "No formatter configured. Please specify a formatter using SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter" unless @formatter
|
73
73
|
@formatter
|
74
74
|
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# Certain code blocks (i.e. Ruby-implementation specific code) can be excluded from
|
78
|
+
# the coverage metrics by wrapping it inside # :nocov: comment blocks. The nocov token
|
79
|
+
# can be configured to be any other string using this.
|
80
|
+
#
|
81
|
+
# Configure with SimpleCov.nocov_token('skip') or it's alias SimpleCov.skip_token('skip')
|
82
|
+
#
|
83
|
+
def nocov_token(nocov_token=nil)
|
84
|
+
return @nocov_token if @nocov_token and nocov_token.nil?
|
85
|
+
@nocov_token = (nocov_token || 'nocov')
|
86
|
+
end
|
87
|
+
alias_method :skip_token, :nocov_token
|
75
88
|
|
76
89
|
#
|
77
90
|
# Returns the configured groups. Add groups using SimpleCov.add_group
|
@@ -24,11 +24,12 @@ module SimpleCov
|
|
24
24
|
alias_method :line, :line_number
|
25
25
|
alias_method :number, :line_number
|
26
26
|
|
27
|
-
def initialize(src, line_number, coverage
|
27
|
+
def initialize(src, line_number, coverage)
|
28
28
|
raise ArgumentError, "Only String accepted for source" unless src.kind_of?(String)
|
29
29
|
raise ArgumentError, "Only Fixnum accepted for line_number" unless line_number.kind_of?(Fixnum)
|
30
30
|
raise ArgumentError, "Only Fixnum and nil accepted for coverage" unless coverage.kind_of?(Fixnum) or coverage.nil?
|
31
|
-
@src, @line_number, @coverage
|
31
|
+
@src, @line_number, @coverage = src, line_number, coverage
|
32
|
+
@skipped = false
|
32
33
|
end
|
33
34
|
|
34
35
|
# Returns true if this is a line that should have been covered, but was not
|
@@ -45,9 +46,25 @@ module SimpleCov
|
|
45
46
|
def never?
|
46
47
|
not skipped? and coverage.nil?
|
47
48
|
end
|
49
|
+
|
50
|
+
# Flags this line as skipped
|
51
|
+
def skipped!
|
52
|
+
@skipped = true
|
53
|
+
end
|
48
54
|
|
55
|
+
# Returns true if this line was skipped, false otherwise. Lines are skipped if they are wrapped with
|
56
|
+
# # :nocov: comment lines.
|
49
57
|
def skipped?
|
50
|
-
|
58
|
+
!!skipped
|
59
|
+
end
|
60
|
+
|
61
|
+
# The status of this line - either covered, missed, skipped or never. Useful i.e. for direct use
|
62
|
+
# as a css class in report generation
|
63
|
+
def status
|
64
|
+
return 'skipped' if skipped?
|
65
|
+
return 'never' if never?
|
66
|
+
return 'missed' if missed?
|
67
|
+
return 'covered' if covered?
|
51
68
|
end
|
52
69
|
end
|
53
70
|
|
@@ -61,7 +78,6 @@ module SimpleCov
|
|
61
78
|
|
62
79
|
def initialize(filename, coverage)
|
63
80
|
@filename, @coverage, @src = filename, coverage, File.readlines(filename)
|
64
|
-
@skipped_line_numbers = process_skipped_lines
|
65
81
|
end
|
66
82
|
|
67
83
|
# Returns all source lines for this file as instances of SimpleCov::SourceFile::Line,
|
@@ -77,8 +93,9 @@ module SimpleCov
|
|
77
93
|
# Initialize lines
|
78
94
|
@lines = []
|
79
95
|
src.each_with_index do |src, i|
|
80
|
-
@lines << SimpleCov::SourceFile::Line.new(src, i+1, coverage[i]
|
96
|
+
@lines << SimpleCov::SourceFile::Line.new(src, i+1, coverage[i])
|
81
97
|
end
|
98
|
+
process_skipped_lines!
|
82
99
|
@lines
|
83
100
|
end
|
84
101
|
alias_method :source_lines, :lines
|
@@ -94,7 +111,6 @@ module SimpleCov
|
|
94
111
|
(covered_lines.count) * 100 / (lines.count - never_lines.count - skipped_lines.count).to_f
|
95
112
|
end
|
96
113
|
|
97
|
-
#
|
98
114
|
def covered_strength
|
99
115
|
return 0 if lines.length == 0 or lines.length == never_lines.count
|
100
116
|
lines_strength = 0
|
@@ -133,17 +149,17 @@ module SimpleCov
|
|
133
149
|
covered_lines.count + missed_lines.count
|
134
150
|
end
|
135
151
|
|
136
|
-
|
137
|
-
|
152
|
+
# Will go through all source files and mark lines that are wrapped within # :nocov: comment blocks
|
153
|
+
# as skipped.
|
154
|
+
def process_skipped_lines!
|
138
155
|
skipping = false
|
139
|
-
|
140
|
-
if line =~
|
156
|
+
lines.each do |line|
|
157
|
+
if line.src =~ /^([\s]*)#([\s]*)(\:#{SimpleCov.nocov_token}\:)/
|
141
158
|
skipping = !skipping
|
142
159
|
else
|
143
|
-
|
160
|
+
line.skipped! if skipping
|
144
161
|
end
|
145
162
|
end
|
146
|
-
skipped_line_numbers
|
147
163
|
end
|
148
164
|
|
149
165
|
private
|
data/lib/simplecov/version.rb
CHANGED
data/simplecov.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.summary = gem.description
|
14
14
|
|
15
15
|
gem.add_dependency 'multi_json', '~> 1.0.3'
|
16
|
-
gem.add_dependency 'simplecov-html', '~> 0.5.
|
16
|
+
gem.add_dependency 'simplecov-html', '~> 0.5.3'
|
17
17
|
gem.add_development_dependency 'aruba', '~> 0.4'
|
18
18
|
gem.add_development_dependency 'capybara', '~> 1.0'
|
19
19
|
gem.add_development_dependency 'cucumber', '~> 1.0'
|
@@ -4,8 +4,8 @@ class FakedProject
|
|
4
4
|
end
|
5
5
|
end
|
6
6
|
|
7
|
-
|
8
|
-
require
|
9
|
-
|
7
|
+
Dir[File.join(File.dirname(__FILE__), 'faked_project/*.rb')].each do |file|
|
8
|
+
require file # Require all source files in project dynamically so we can inject some stuff depending on test situation
|
9
|
+
end
|
10
10
|
|
11
|
-
FakedProject.send :include, MetaMagic
|
11
|
+
FakedProject.send :include, MetaMagic
|
data/test/helper.rb
CHANGED
data/test/shoulda_macros.rb
CHANGED
@@ -8,4 +8,22 @@ module ShouldaMacros
|
|
8
8
|
yield
|
9
9
|
end if ruby_versions.any? {|v| RUBY_VERSION =~ /#{v}/ }
|
10
10
|
end
|
11
|
+
|
12
|
+
def should_be(boolean_flag)
|
13
|
+
should "be #{boolean_flag}" do
|
14
|
+
assert_equal true, subject.send(boolean_flag)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def should_not_be(boolean_flag)
|
19
|
+
should "not be #{boolean_flag}" do
|
20
|
+
assert_equal false, subject.send(boolean_flag)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def should_have(attr_name, expectation)
|
25
|
+
should "have #{attr_name} == #{expectation.inspect}" do
|
26
|
+
assert_equal expectation, subject.send(attr_name)
|
27
|
+
end
|
28
|
+
end
|
11
29
|
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestSourceFileLine < Test::Unit::TestCase
|
4
|
+
|
5
|
+
|
4
6
|
on_ruby '1.9' do
|
5
7
|
context "A source line" do
|
6
8
|
setup do
|
7
9
|
@line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, 3)
|
8
10
|
end
|
11
|
+
subject { @line }
|
9
12
|
|
10
13
|
should 'return "# the ruby source" as src' do
|
11
14
|
assert_equal '# the ruby source', @line.src
|
@@ -23,72 +26,67 @@ class TestSourceFileLine < Test::Unit::TestCase
|
|
23
26
|
assert_equal @line.line_number, @line.line
|
24
27
|
assert_equal @line.line_number, @line.number
|
25
28
|
end
|
29
|
+
|
30
|
+
context "flagged as skipped!" do
|
31
|
+
setup { @line.skipped! }
|
32
|
+
|
33
|
+
should_not_be :covered?
|
34
|
+
should_be :skipped?
|
35
|
+
should_not_be :missed?
|
36
|
+
should_not_be :never?
|
37
|
+
should_have :status, 'skipped'
|
38
|
+
end
|
26
39
|
end
|
27
|
-
|
40
|
+
|
28
41
|
context "A source line with coverage" do
|
29
42
|
setup do
|
30
43
|
@line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, 3)
|
31
44
|
end
|
45
|
+
subject { @line }
|
32
46
|
|
33
47
|
should "have coverage of 3" do
|
34
48
|
assert_equal 3, @line.coverage
|
35
49
|
end
|
36
50
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
assert !@line.never?
|
43
|
-
end
|
44
|
-
|
45
|
-
should "not be missed?" do
|
46
|
-
assert !@line.missed?
|
47
|
-
end
|
51
|
+
should_be :covered?
|
52
|
+
should_not_be :skipped?
|
53
|
+
should_not_be :missed?
|
54
|
+
should_not_be :never?
|
55
|
+
should_have :status, 'covered'
|
48
56
|
end
|
49
57
|
|
50
58
|
context "A source line without coverage" do
|
51
59
|
setup do
|
52
60
|
@line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, 0)
|
53
61
|
end
|
62
|
+
subject { @line }
|
54
63
|
|
55
64
|
should "have coverage of 0" do
|
56
65
|
assert_equal 0, @line.coverage
|
57
66
|
end
|
58
67
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
assert !@line.never?
|
65
|
-
end
|
66
|
-
|
67
|
-
should "be missed?" do
|
68
|
-
assert @line.missed?
|
69
|
-
end
|
68
|
+
should_not_be :covered?
|
69
|
+
should_not_be :skipped?
|
70
|
+
should_be :missed?
|
71
|
+
should_not_be :never?
|
72
|
+
should_have :status, 'missed'
|
70
73
|
end
|
71
74
|
|
72
75
|
context "A source line with no code" do
|
73
76
|
setup do
|
74
77
|
@line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, nil)
|
75
78
|
end
|
79
|
+
subject { @line }
|
76
80
|
|
77
81
|
should "have nil coverage" do
|
78
82
|
assert_nil @line.coverage
|
79
83
|
end
|
80
84
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
assert @line.never?
|
87
|
-
end
|
88
|
-
|
89
|
-
should "not be missed?" do
|
90
|
-
assert !@line.missed?
|
91
|
-
end
|
85
|
+
should_not_be :covered?
|
86
|
+
should_not_be :skipped?
|
87
|
+
should_not_be :missed?
|
88
|
+
should_be :never?
|
89
|
+
should_have :status, 'never'
|
92
90
|
end
|
93
91
|
|
94
92
|
should "raise ArgumentError when initialized with invalid src" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-13 00:00:00.000000000 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
17
|
-
requirement: &
|
17
|
+
requirement: &70323468142820 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,21 +22,21 @@ dependencies:
|
|
22
22
|
version: 1.0.3
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70323468142820
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: simplecov-html
|
28
|
-
requirement: &
|
28
|
+
requirement: &70323468142320 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.5.
|
33
|
+
version: 0.5.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70323468142320
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: aruba
|
39
|
-
requirement: &
|
39
|
+
requirement: &70323468141860 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0.4'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70323468141860
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: capybara
|
50
|
-
requirement: &
|
50
|
+
requirement: &70323468141400 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '1.0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70323468141400
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: cucumber
|
61
|
-
requirement: &
|
61
|
+
requirement: &70323468140940 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '1.0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70323468140940
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rake
|
72
|
-
requirement: &
|
72
|
+
requirement: &70323468140480 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: '0.8'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70323468140480
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: rspec
|
83
|
-
requirement: &
|
83
|
+
requirement: &70323468140020 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: '2.6'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *70323468140020
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: shoulda
|
94
|
-
requirement: &
|
94
|
+
requirement: &70323468139560 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ~>
|
@@ -99,7 +99,7 @@ dependencies:
|
|
99
99
|
version: '2.10'
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *70323468139560
|
103
103
|
description: Code coverage for Ruby 1.9 with a powerful configuration library and
|
104
104
|
automatic merging of coverage across test suites
|
105
105
|
email:
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- features/config_coverage_dir.feature
|
124
124
|
- features/config_deactivate_merging.feature
|
125
125
|
- features/config_merge_timeout.feature
|
126
|
+
- features/config_nocov_token.feature
|
126
127
|
- features/config_project_name.feature
|
127
128
|
- features/config_styles.feature
|
128
129
|
- features/cucumber_basic.feature
|
@@ -131,6 +132,7 @@ files:
|
|
131
132
|
- features/rspec_groups_and_filters_basic.feature
|
132
133
|
- features/rspec_groups_and_filters_complex.feature
|
133
134
|
- features/rspec_without_simplecov.feature
|
135
|
+
- features/skipping_code_blocks_manually.feature
|
134
136
|
- features/step_definitions/html_steps.rb
|
135
137
|
- features/step_definitions/simplecov_steps.rb
|
136
138
|
- features/step_definitions/transformers.rb
|
@@ -140,6 +142,7 @@ files:
|
|
140
142
|
- features/test_unit_groups_and_filters_basic.feature
|
141
143
|
- features/test_unit_groups_and_filters_complex.feature
|
142
144
|
- features/test_unit_without_simplecov.feature
|
145
|
+
- features/unicode_compatiblity.feature
|
143
146
|
- lib/simplecov.rb
|
144
147
|
- lib/simplecov/adapters.rb
|
145
148
|
- lib/simplecov/command_guesser.rb
|
@@ -229,6 +232,7 @@ test_files:
|
|
229
232
|
- features/config_coverage_dir.feature
|
230
233
|
- features/config_deactivate_merging.feature
|
231
234
|
- features/config_merge_timeout.feature
|
235
|
+
- features/config_nocov_token.feature
|
232
236
|
- features/config_project_name.feature
|
233
237
|
- features/config_styles.feature
|
234
238
|
- features/cucumber_basic.feature
|
@@ -237,6 +241,7 @@ test_files:
|
|
237
241
|
- features/rspec_groups_and_filters_basic.feature
|
238
242
|
- features/rspec_groups_and_filters_complex.feature
|
239
243
|
- features/rspec_without_simplecov.feature
|
244
|
+
- features/skipping_code_blocks_manually.feature
|
240
245
|
- features/step_definitions/html_steps.rb
|
241
246
|
- features/step_definitions/simplecov_steps.rb
|
242
247
|
- features/step_definitions/transformers.rb
|
@@ -246,6 +251,7 @@ test_files:
|
|
246
251
|
- features/test_unit_groups_and_filters_basic.feature
|
247
252
|
- features/test_unit_groups_and_filters_complex.feature
|
248
253
|
- features/test_unit_without_simplecov.feature
|
254
|
+
- features/unicode_compatiblity.feature
|
249
255
|
- test/faked_project/Gemfile
|
250
256
|
- test/faked_project/Rakefile
|
251
257
|
- test/faked_project/cucumber.yml
|