simplecov 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/.travis.yml +6 -2
- data/CHANGELOG.md +9 -1
- data/Gemfile +8 -6
- data/README.md +2 -2
- data/Rakefile +9 -4
- data/lib/simplecov/configuration.rb +2 -2
- data/lib/simplecov/defaults.rb +1 -1
- data/lib/simplecov/merge_helpers.rb +5 -2
- data/lib/simplecov/result.rb +6 -1
- data/lib/simplecov/source_file.rb +10 -6
- data/lib/simplecov/version.rb +1 -1
- data/spec/1_8_fallbacks_spec.rb +19 -17
- data/spec/command_guesser_spec.rb +40 -38
- data/spec/file_list_spec.rb +48 -46
- data/spec/filters_spec.rb +73 -71
- data/spec/merge_helpers_spec.rb +95 -83
- data/spec/result_spec.rb +152 -150
- data/spec/source_file_line_spec.rb +109 -107
- data/spec/source_file_spec.rb +56 -54
- metadata +4 -82
@@ -1,38 +1,70 @@
|
|
1
1
|
require "helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
if SimpleCov.usable?
|
4
|
+
describe SimpleCov::SourceFile::Line do
|
5
|
+
context "a source line" do
|
6
|
+
subject do
|
7
|
+
SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3)
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
it 'returns "# the ruby source" as src' do
|
11
|
+
expect(subject.src).to eq("# the ruby source")
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
it "returns the same for source as for src" do
|
15
|
+
expect(subject.src).to eq(subject.source)
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
it "has line number 5" do
|
19
|
+
expect(subject.line_number).to eq(5)
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
it "has equal line_number, line and number" do
|
23
|
+
expect(subject.line).to eq(subject.line_number)
|
24
|
+
expect(subject.number).to eq(subject.line_number)
|
25
|
+
end
|
26
|
+
|
27
|
+
context "flagged as skipped!" do
|
28
|
+
before do
|
29
|
+
subject.skipped!
|
30
|
+
end
|
31
|
+
it "is not covered" do
|
32
|
+
expect(subject).not_to be_covered
|
33
|
+
end
|
34
|
+
|
35
|
+
it "is skipped" do
|
36
|
+
expect(subject).to be_skipped
|
37
|
+
end
|
38
|
+
|
39
|
+
it "is not missed" do
|
40
|
+
expect(subject).not_to be_missed
|
41
|
+
end
|
42
|
+
|
43
|
+
it "is not never" do
|
44
|
+
expect(subject).not_to be_never
|
45
|
+
end
|
46
|
+
|
47
|
+
it "status is skipped" do
|
48
|
+
expect(subject.status).to eq("skipped")
|
49
|
+
end
|
50
|
+
end
|
24
51
|
end
|
25
52
|
|
26
|
-
context "
|
27
|
-
|
28
|
-
|
53
|
+
context "A source line with coverage" do
|
54
|
+
subject do
|
55
|
+
SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3)
|
29
56
|
end
|
30
|
-
|
31
|
-
|
57
|
+
|
58
|
+
it "has coverage of 3" do
|
59
|
+
expect(subject.coverage).to eq(3)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "is covered" do
|
63
|
+
expect(subject).to be_covered
|
32
64
|
end
|
33
65
|
|
34
|
-
it "is skipped" do
|
35
|
-
expect(subject).
|
66
|
+
it "is not skipped" do
|
67
|
+
expect(subject).not_to be_skipped
|
36
68
|
end
|
37
69
|
|
38
70
|
it "is not missed" do
|
@@ -43,111 +75,81 @@ describe SimpleCov::SourceFile::Line do
|
|
43
75
|
expect(subject).not_to be_never
|
44
76
|
end
|
45
77
|
|
46
|
-
it "status is
|
47
|
-
expect(subject.status).to eq("
|
78
|
+
it "status is covered" do
|
79
|
+
expect(subject.status).to eq("covered")
|
48
80
|
end
|
49
81
|
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context "A source line with coverage" do
|
53
|
-
subject do
|
54
|
-
SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3)
|
55
|
-
end
|
56
82
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
it "is covered" do
|
62
|
-
expect(subject).to be_covered
|
63
|
-
end
|
64
|
-
|
65
|
-
it "is not skipped" do
|
66
|
-
expect(subject).not_to be_skipped
|
67
|
-
end
|
68
|
-
|
69
|
-
it "is not missed" do
|
70
|
-
expect(subject).not_to be_missed
|
71
|
-
end
|
83
|
+
context "A source line without coverage" do
|
84
|
+
subject do
|
85
|
+
SimpleCov::SourceFile::Line.new("# the ruby source", 5, 0)
|
86
|
+
end
|
72
87
|
|
73
|
-
|
74
|
-
|
75
|
-
|
88
|
+
it "has coverage of 0" do
|
89
|
+
expect(subject.coverage).to be_zero
|
90
|
+
end
|
76
91
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
92
|
+
it "is not covered" do
|
93
|
+
expect(subject).not_to be_covered
|
94
|
+
end
|
81
95
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
96
|
+
it "is not skipped" do
|
97
|
+
expect(subject).not_to be_skipped
|
98
|
+
end
|
86
99
|
|
87
|
-
|
88
|
-
|
89
|
-
|
100
|
+
it "is missed" do
|
101
|
+
expect(subject).to be_missed
|
102
|
+
end
|
90
103
|
|
91
|
-
|
92
|
-
|
93
|
-
|
104
|
+
it "is not never" do
|
105
|
+
expect(subject).not_to be_never
|
106
|
+
end
|
94
107
|
|
95
|
-
|
96
|
-
|
108
|
+
it "status is missed" do
|
109
|
+
expect(subject.status).to eq("missed")
|
110
|
+
end
|
97
111
|
end
|
98
112
|
|
99
|
-
|
100
|
-
|
101
|
-
|
113
|
+
context "A source line with no code" do
|
114
|
+
subject do
|
115
|
+
SimpleCov::SourceFile::Line.new("# the ruby source", 5, nil)
|
116
|
+
end
|
102
117
|
|
103
|
-
|
104
|
-
|
105
|
-
|
118
|
+
it "has nil coverage" do
|
119
|
+
expect(subject.coverage).to be_nil
|
120
|
+
end
|
106
121
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
end
|
122
|
+
it "is not covered" do
|
123
|
+
expect(subject).not_to be_covered
|
124
|
+
end
|
111
125
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end
|
126
|
+
it "is not skipped" do
|
127
|
+
expect(subject).not_to be_skipped
|
128
|
+
end
|
116
129
|
|
117
|
-
|
118
|
-
|
119
|
-
|
130
|
+
it "is not missed" do
|
131
|
+
expect(subject).not_to be_missed
|
132
|
+
end
|
120
133
|
|
121
|
-
|
122
|
-
|
123
|
-
|
134
|
+
it "is never" do
|
135
|
+
expect(subject).to be_never
|
136
|
+
end
|
124
137
|
|
125
|
-
|
126
|
-
|
138
|
+
it "status is never" do
|
139
|
+
expect(subject.status).to eq("never")
|
140
|
+
end
|
127
141
|
end
|
128
142
|
|
129
|
-
it "
|
130
|
-
expect(
|
143
|
+
it "raises ArgumentError when initialized with invalid src" do
|
144
|
+
expect { SimpleCov::SourceFile::Line.new(:symbol, 5, 3) }.to raise_error(ArgumentError)
|
131
145
|
end
|
132
146
|
|
133
|
-
it "
|
134
|
-
expect(
|
147
|
+
it "raises ArgumentError when initialized with invalid line_number" do
|
148
|
+
expect { SimpleCov::SourceFile::Line.new("some source", "five", 3) }.to raise_error(ArgumentError)
|
135
149
|
end
|
136
150
|
|
137
|
-
it "
|
138
|
-
expect(
|
151
|
+
it "raises ArgumentError when initialized with invalid coverage" do
|
152
|
+
expect { SimpleCov::SourceFile::Line.new("some source", 5, "three") }.to raise_error(ArgumentError)
|
139
153
|
end
|
140
154
|
end
|
141
|
-
|
142
|
-
it "raises ArgumentError when initialized with invalid src" do
|
143
|
-
expect { SimpleCov::SourceFile::Line.new(:symbol, 5, 3) }.to raise_error(ArgumentError)
|
144
|
-
end
|
145
|
-
|
146
|
-
it "raises ArgumentError when initialized with invalid line_number" do
|
147
|
-
expect { SimpleCov::SourceFile::Line.new("some source", "five", 3) }.to raise_error(ArgumentError)
|
148
|
-
end
|
149
|
-
|
150
|
-
it "raises ArgumentError when initialized with invalid coverage" do
|
151
|
-
expect { SimpleCov::SourceFile::Line.new("some source", 5, "three") }.to raise_error(ArgumentError)
|
152
|
-
end
|
153
|
-
end if SimpleCov.usable?
|
155
|
+
end
|
data/spec/source_file_spec.rb
CHANGED
@@ -1,75 +1,77 @@
|
|
1
1
|
require "helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
it "has a filename" do
|
11
|
-
expect(subject.filename).not_to be_nil
|
12
|
-
end
|
3
|
+
if SimpleCov.usable?
|
4
|
+
describe SimpleCov::SourceFile do
|
5
|
+
COVERAGE_FOR_SAMPLE_RB = [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil, nil, nil, nil, nil, nil, nil].freeze
|
6
|
+
context "a source file initialized with some coverage data" do
|
7
|
+
subject do
|
8
|
+
SimpleCov::SourceFile.new(source_fixture("sample.rb"), COVERAGE_FOR_SAMPLE_RB)
|
9
|
+
end
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
it "has a filename" do
|
12
|
+
expect(subject.filename).not_to be_nil
|
13
|
+
end
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
it "has source equal to src" do
|
16
|
+
expect(subject.src).to eq(subject.source)
|
17
|
+
end
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
it "has source_lines equal to lines" do
|
20
|
+
expect(subject.lines).to eq(subject.source_lines)
|
21
|
+
end
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
expect(line).to be_a SimpleCov::SourceFile::Line
|
23
|
+
it "has 16 source lines" do
|
24
|
+
expect(subject.lines.count).to eq(16)
|
29
25
|
end
|
30
|
-
end
|
31
26
|
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
it "has all source lines of type SimpleCov::SourceFile::Line" do
|
28
|
+
subject.lines.each do |line|
|
29
|
+
expect(line).to be_a SimpleCov::SourceFile::Line
|
30
|
+
end
|
31
|
+
end
|
35
32
|
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
it "has 'class Foo' as line(2).source" do
|
34
|
+
expect(subject.line(2).source).to eq("class Foo\n")
|
35
|
+
end
|
39
36
|
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
it "returns lines number 2, 3, 4, 7 for covered_lines" do
|
38
|
+
expect(subject.covered_lines.map(&:line)).to eq([2, 3, 4, 7])
|
39
|
+
end
|
43
40
|
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
it "returns lines number 8 for missed_lines" do
|
42
|
+
expect(subject.missed_lines.map(&:line)).to eq([8])
|
43
|
+
end
|
47
44
|
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
it "returns lines number 1, 5, 6, 9, 10, 11, 15, 16 for never_lines" do
|
46
|
+
expect(subject.never_lines.map(&:line)).to eq([1, 5, 6, 9, 10, 11, 15, 16])
|
47
|
+
end
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
49
|
+
it "returns line numbers 12, 13, 14 for skipped_lines" do
|
50
|
+
expect(subject.skipped_lines.map(&:line)).to eq([12, 13, 14])
|
51
|
+
end
|
56
52
|
|
57
|
-
|
58
|
-
|
59
|
-
|
53
|
+
it "has 80% covered_percent" do
|
54
|
+
expect(subject.covered_percent).to eq(80.0)
|
55
|
+
end
|
60
56
|
end
|
61
57
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
context "simulating potential Ruby 1.9 defect -- see Issue #56" do
|
59
|
+
subject do
|
60
|
+
SimpleCov::SourceFile.new(source_fixture("sample.rb"), COVERAGE_FOR_SAMPLE_RB + [nil])
|
61
|
+
end
|
66
62
|
|
67
|
-
|
68
|
-
|
69
|
-
subject.lines
|
63
|
+
it "has 16 source lines regardless of extra data in coverage array" do
|
64
|
+
# Do not litter test output with known warning
|
65
|
+
capture_stderr { expect(subject.lines.count).to eq(16) }
|
70
66
|
end
|
71
67
|
|
72
|
-
|
68
|
+
it "prints a warning to stderr if coverage array contains more data than lines in the file" do
|
69
|
+
captured_output = capture_stderr do
|
70
|
+
subject.lines
|
71
|
+
end
|
72
|
+
|
73
|
+
expect(captured_output).to match(/^Warning: coverage data provided/)
|
74
|
+
end
|
73
75
|
end
|
74
76
|
end
|
75
|
-
end
|
77
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoph Olszowka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -215,87 +215,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
217
|
rubyforge_project:
|
218
|
-
rubygems_version: 2.
|
218
|
+
rubygems_version: 2.6.10
|
219
219
|
signing_key:
|
220
220
|
specification_version: 4
|
221
221
|
summary: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic
|
222
222
|
merging of coverage across test suites
|
223
|
-
test_files:
|
224
|
-
- features/config_autoload.feature
|
225
|
-
- features/config_command_name.feature
|
226
|
-
- features/config_coverage_dir.feature
|
227
|
-
- features/config_deactivate_merging.feature
|
228
|
-
- features/config_formatters.feature
|
229
|
-
- features/config_merge_timeout.feature
|
230
|
-
- features/config_nocov_token.feature
|
231
|
-
- features/config_profiles.feature
|
232
|
-
- features/config_project_name.feature
|
233
|
-
- features/config_styles.feature
|
234
|
-
- features/config_tracked_files.feature
|
235
|
-
- features/cucumber_basic.feature
|
236
|
-
- features/maximum_coverage_drop.feature
|
237
|
-
- features/merging_test_unit_and_rspec.feature
|
238
|
-
- features/minimum_coverage.feature
|
239
|
-
- features/refuse_coverage_drop.feature
|
240
|
-
- features/rspec_basic.feature
|
241
|
-
- features/rspec_fails_on_initialization.feature
|
242
|
-
- features/rspec_groups_and_filters_basic.feature
|
243
|
-
- features/rspec_groups_and_filters_complex.feature
|
244
|
-
- features/rspec_groups_using_filter_class.feature
|
245
|
-
- features/rspec_without_simplecov.feature
|
246
|
-
- features/skipping_code_blocks_manually.feature
|
247
|
-
- features/step_definitions/html_steps.rb
|
248
|
-
- features/step_definitions/simplecov_steps.rb
|
249
|
-
- features/step_definitions/transformers.rb
|
250
|
-
- features/step_definitions/web_steps.rb
|
251
|
-
- features/support/env.rb
|
252
|
-
- features/test_unit_basic.feature
|
253
|
-
- features/test_unit_groups_and_filters_basic.feature
|
254
|
-
- features/test_unit_groups_and_filters_complex.feature
|
255
|
-
- features/test_unit_groups_using_filter_class.feature
|
256
|
-
- features/test_unit_without_simplecov.feature
|
257
|
-
- features/unicode_compatiblity.feature
|
258
|
-
- spec/1_8_fallbacks_spec.rb
|
259
|
-
- spec/command_guesser_spec.rb
|
260
|
-
- spec/deleted_source_spec.rb
|
261
|
-
- spec/faked_project/Gemfile
|
262
|
-
- spec/faked_project/Rakefile
|
263
|
-
- spec/faked_project/cucumber.yml
|
264
|
-
- spec/faked_project/features/step_definitions/my_steps.rb
|
265
|
-
- spec/faked_project/features/support/env.rb
|
266
|
-
- spec/faked_project/features/test_stuff.feature
|
267
|
-
- spec/faked_project/lib/faked_project.rb
|
268
|
-
- spec/faked_project/lib/faked_project/framework_specific.rb
|
269
|
-
- spec/faked_project/lib/faked_project/meta_magic.rb
|
270
|
-
- spec/faked_project/lib/faked_project/some_class.rb
|
271
|
-
- spec/faked_project/lib/faked_project/untested_class.rb
|
272
|
-
- spec/faked_project/spec/faked_spec.rb
|
273
|
-
- spec/faked_project/spec/forking_spec.rb
|
274
|
-
- spec/faked_project/spec/meta_magic_spec.rb
|
275
|
-
- spec/faked_project/spec/some_class_spec.rb
|
276
|
-
- spec/faked_project/spec/spec_helper.rb
|
277
|
-
- spec/faked_project/test/faked_test.rb
|
278
|
-
- spec/faked_project/test/meta_magic_test.rb
|
279
|
-
- spec/faked_project/test/some_class_test.rb
|
280
|
-
- spec/faked_project/test/test_helper.rb
|
281
|
-
- spec/file_list_spec.rb
|
282
|
-
- spec/filters_spec.rb
|
283
|
-
- spec/fixtures/app/controllers/sample_controller.rb
|
284
|
-
- spec/fixtures/app/models/user.rb
|
285
|
-
- spec/fixtures/deleted_source_sample.rb
|
286
|
-
- spec/fixtures/frameworks/rspec_bad.rb
|
287
|
-
- spec/fixtures/frameworks/rspec_good.rb
|
288
|
-
- spec/fixtures/frameworks/testunit_bad.rb
|
289
|
-
- spec/fixtures/frameworks/testunit_good.rb
|
290
|
-
- spec/fixtures/iso-8859.rb
|
291
|
-
- spec/fixtures/resultset1.rb
|
292
|
-
- spec/fixtures/resultset2.rb
|
293
|
-
- spec/fixtures/sample.rb
|
294
|
-
- spec/fixtures/utf-8.rb
|
295
|
-
- spec/helper.rb
|
296
|
-
- spec/merge_helpers_spec.rb
|
297
|
-
- spec/multi_formatter_spec.rb
|
298
|
-
- spec/result_spec.rb
|
299
|
-
- spec/return_codes_spec.rb
|
300
|
-
- spec/source_file_line_spec.rb
|
301
|
-
- spec/source_file_spec.rb
|
223
|
+
test_files: []
|