simplecov 0.9.2 → 0.10.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 +7 -7
- data/.gitignore +0 -1
- data/.rubocop.yml +69 -0
- data/CHANGELOG.md +39 -22
- data/Gemfile +16 -15
- data/MIT-LICENSE +1 -1
- data/README.md +183 -178
- data/Rakefile +16 -7
- data/doc/alternate-formatters.md +36 -0
- data/doc/commercial-services.md +20 -0
- data/doc/editor-integration.md +13 -0
- data/features/rspec_basic.feature +3 -2
- data/features/rspec_groups_and_filters_complex.feature +2 -0
- data/features/rspec_groups_using_filter_class.feature +3 -2
- data/features/step_definitions/html_steps.rb +6 -7
- data/features/step_definitions/simplecov_steps.rb +18 -16
- data/features/step_definitions/transformers.rb +2 -2
- data/features/step_definitions/web_steps.rb +4 -4
- data/features/support/env.rb +17 -15
- data/lib/simplecov.rb +35 -24
- data/lib/simplecov/command_guesser.rb +33 -34
- data/lib/simplecov/configuration.rb +238 -234
- data/lib/simplecov/defaults.rb +37 -36
- data/lib/simplecov/exit_codes.rb +7 -5
- data/lib/simplecov/file_list.rb +38 -36
- data/lib/simplecov/filter.rb +12 -2
- data/lib/simplecov/formatter.rb +2 -2
- data/lib/simplecov/formatter/simple_formatter.rb +1 -1
- data/lib/simplecov/jruby_fix.rb +4 -4
- data/lib/simplecov/last_run.rb +15 -13
- data/lib/simplecov/merge_helpers.rb +26 -27
- data/lib/simplecov/no_defaults.rb +2 -2
- data/lib/simplecov/profiles.rb +21 -19
- data/lib/simplecov/railtie.rb +1 -1
- data/lib/simplecov/railties/tasks.rake +7 -7
- data/lib/simplecov/result.rb +5 -5
- data/lib/simplecov/result_merger.rb +65 -62
- data/lib/simplecov/source_file.rb +23 -24
- data/lib/simplecov/version.rb +20 -1
- data/simplecov.gemspec +14 -12
- data/test/faked_project/Gemfile +5 -5
- data/test/faked_project/Rakefile +4 -4
- data/test/faked_project/features/step_definitions/my_steps.rb +3 -4
- data/test/faked_project/features/support/env.rb +5 -5
- data/test/faked_project/lib/faked_project.rb +1 -1
- data/test/faked_project/lib/faked_project/some_class.rb +3 -4
- data/test/faked_project/spec/faked_spec.rb +2 -2
- data/test/faked_project/spec/forking_spec.rb +7 -0
- data/test/faked_project/spec/meta_magic_spec.rb +1 -1
- data/test/faked_project/spec/some_class_spec.rb +3 -3
- data/test/faked_project/spec/spec_helper.rb +4 -8
- data/test/faked_project/test/faked_test.rb +2 -2
- data/test/faked_project/test/meta_magic_test.rb +1 -1
- data/test/faked_project/test/some_class_test.rb +3 -3
- data/test/faked_project/test/test_helper.rb +5 -9
- data/test/fixtures/app/controllers/sample_controller.rb +1 -1
- data/test/fixtures/app/models/user.rb +1 -1
- data/test/fixtures/deleted_source_sample.rb +3 -3
- data/test/fixtures/frameworks/rspec_bad.rb +4 -4
- data/test/fixtures/frameworks/rspec_good.rb +4 -4
- data/test/fixtures/frameworks/testunit_bad.rb +3 -3
- data/test/fixtures/frameworks/testunit_good.rb +3 -3
- data/test/fixtures/resultset2.rb +0 -1
- data/test/fixtures/sample.rb +1 -1
- data/test/fixtures/utf-8.rb +1 -1
- data/test/helper.rb +8 -8
- data/test/test_1_8_fallbacks.rb +6 -6
- data/test/test_command_guesser.rb +7 -7
- data/test/test_deleted_source.rb +2 -2
- data/test/test_file_list.rb +8 -6
- data/test/test_filters.rb +29 -13
- data/test/test_merge_helpers.rb +26 -23
- data/test/test_result.rb +32 -23
- data/test/test_return_codes.rb +3 -3
- data/test/test_source_file.rb +4 -4
- data/test/test_source_file_line.rb +13 -13
- metadata +145 -63
- data/lib/simplecov/json.rb +0 -27
@@ -1,32 +1,32 @@
|
|
1
1
|
#
|
2
2
|
# Helper that tries to find out what test suite is running (for SimpleCov.command_name)
|
3
3
|
#
|
4
|
-
module SimpleCov
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
module SimpleCov
|
5
|
+
module CommandGuesser
|
6
|
+
class << self
|
7
|
+
# Storage for the original command line call that invoked the test suite.
|
8
|
+
# This has got to be stored as early as possible because i.e. rake and test/unit 2
|
9
|
+
# have a habit of tampering with ARGV, which makes i.e. the automatic distinction
|
10
|
+
# between rails unit/functional/integration tests impossible without this cached
|
11
|
+
# item.
|
12
|
+
attr_accessor :original_run_command
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
def guess
|
15
|
+
from_env || from_command_line_options || from_defined_constants
|
16
|
+
end
|
16
17
|
|
17
18
|
private
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
number = ENV[
|
23
|
-
number =
|
20
|
+
def from_env
|
21
|
+
# If being run from inside parallel_tests set the command name according to the process number
|
22
|
+
return unless ENV["PARALLEL_TEST_GROUPS"] && ENV["TEST_ENV_NUMBER"]
|
23
|
+
number = ENV["TEST_ENV_NUMBER"]
|
24
|
+
number = "1" if number.empty?
|
24
25
|
"(#{number}/#{ENV['PARALLEL_TEST_GROUPS']})"
|
25
26
|
end
|
26
|
-
end
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
def from_command_line_options
|
29
|
+
case original_run_command
|
30
30
|
when /test\/functional\//, /test\/\{.*functional.*\}\//
|
31
31
|
"Functional Tests"
|
32
32
|
when /test\/integration\//
|
@@ -37,23 +37,22 @@ module SimpleCov::CommandGuesser
|
|
37
37
|
"RSpec"
|
38
38
|
when /cucumber/, /features/
|
39
39
|
"Cucumber Features"
|
40
|
-
|
41
|
-
nil
|
40
|
+
end
|
42
41
|
end
|
43
|
-
end
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
43
|
+
def from_defined_constants
|
44
|
+
# If the command regexps fail, let's try checking defined constants.
|
45
|
+
if defined?(RSpec)
|
46
|
+
"RSpec"
|
47
|
+
elsif defined?(Test::Unit)
|
48
|
+
"Unit Tests"
|
49
|
+
elsif defined?(MiniTest)
|
50
|
+
"MiniTest"
|
51
|
+
else
|
52
|
+
# TODO: Provide link to docs/wiki article
|
53
|
+
warn "SimpleCov failed to recognize the test framework and/or suite used. Please specify manually using SimpleCov.command_name 'Unit Tests'."
|
54
|
+
"Unknown Test Framework"
|
55
|
+
end
|
57
56
|
end
|
58
57
|
end
|
59
58
|
end
|
@@ -1,268 +1,272 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "fileutils"
|
2
|
+
require "docile"
|
3
|
+
require "simplecov/formatter/multi_formatter"
|
4
4
|
#
|
5
5
|
# Bundles the configuration options used for SimpleCov. All methods
|
6
6
|
# defined here are usable from SimpleCov directly. Please check out
|
7
7
|
# SimpleCov documentation for further info.
|
8
8
|
#
|
9
|
-
module SimpleCov
|
10
|
-
|
9
|
+
module SimpleCov
|
10
|
+
module Configuration
|
11
|
+
attr_writer :filters, :groups, :formatter
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
#
|
14
|
+
# The root for the project. This defaults to the
|
15
|
+
# current working directory.
|
16
|
+
#
|
17
|
+
# Configure with SimpleCov.root('/my/project/path')
|
18
|
+
#
|
19
|
+
def root(root = nil)
|
20
|
+
return @root if defined?(@root) && root.nil?
|
21
|
+
@root = File.expand_path(root || Dir.getwd)
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
#
|
25
|
+
# The name of the output and cache directory. Defaults to 'coverage'
|
26
|
+
#
|
27
|
+
# Configure with SimpleCov.coverage_dir('cov')
|
28
|
+
#
|
29
|
+
def coverage_dir(dir = nil)
|
30
|
+
return @coverage_dir if defined?(@coverage_dir) && dir.nil?
|
31
|
+
@coverage_dir = (dir || "coverage")
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
34
|
+
#
|
35
|
+
# Returns the full path to the output directory using SimpleCov.root
|
36
|
+
# and SimpleCov.coverage_dir, so you can adjust this by configuring those
|
37
|
+
# values. Will create the directory if it's missing
|
38
|
+
#
|
39
|
+
def coverage_path
|
40
|
+
coverage_path = File.expand_path(coverage_dir, root)
|
41
|
+
FileUtils.mkdir_p coverage_path
|
42
|
+
coverage_path
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
#
|
46
|
+
# Returns the list of configured filters. Add filters using SimpleCov.add_filter.
|
47
|
+
#
|
48
|
+
def filters
|
49
|
+
@filters ||= []
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
52
|
+
# The name of the command (a.k.a. Test Suite) currently running. Used for result
|
53
|
+
# merging and caching. It first tries to make a guess based upon the command line
|
54
|
+
# arguments the current test suite is running on and should automatically detect
|
55
|
+
# unit tests, functional tests, integration tests, rpsec and cucumber and label
|
56
|
+
# them properly. If it fails to recognize the current command, the command name
|
57
|
+
# is set to the shell command that the current suite is running on.
|
58
|
+
#
|
59
|
+
# You can specify it manually with SimpleCov.command_name("test:units") - please
|
60
|
+
# also check out the corresponding section in README.rdoc
|
61
|
+
def command_name(name = nil)
|
62
|
+
@name = name unless name.nil?
|
63
|
+
@name ||= SimpleCov::CommandGuesser.guess
|
64
|
+
@name
|
65
|
+
end
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
67
|
+
#
|
68
|
+
# Gets or sets the configured formatter.
|
69
|
+
#
|
70
|
+
# Configure with: SimpleCov.formatter(SimpleCov::Formatter::SimpleFormatter)
|
71
|
+
#
|
72
|
+
def formatter(formatter = nil)
|
73
|
+
return @formatter if defined?(@formatter) && formatter.nil?
|
74
|
+
@formatter = formatter
|
75
|
+
fail "No formatter configured. Please specify a formatter using SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter" unless @formatter
|
76
|
+
@formatter
|
77
|
+
end
|
77
78
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
#
|
80
|
+
# Sets the configured formatters.
|
81
|
+
#
|
82
|
+
def formatters=(formatters)
|
83
|
+
@formatter = SimpleCov::Formatter::MultiFormatter[*formatters]
|
84
|
+
end
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
86
|
+
#
|
87
|
+
# Gets the configured formatters.
|
88
|
+
#
|
89
|
+
def formatters
|
90
|
+
if @formatter.is_a?(SimpleCov::Formatter::MultiFormatter)
|
91
|
+
@formatter.formatters
|
92
|
+
else
|
93
|
+
Array(formatter)
|
94
|
+
end
|
93
95
|
end
|
94
|
-
end
|
95
96
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
97
|
+
#
|
98
|
+
# Certain code blocks (i.e. Ruby-implementation specific code) can be excluded from
|
99
|
+
# the coverage metrics by wrapping it inside # :nocov: comment blocks. The nocov token
|
100
|
+
# can be configured to be any other string using this.
|
101
|
+
#
|
102
|
+
# Configure with SimpleCov.nocov_token('skip') or it's alias SimpleCov.skip_token('skip')
|
103
|
+
#
|
104
|
+
def nocov_token(nocov_token = nil)
|
105
|
+
return @nocov_token if defined?(@nocov_token) && nocov_token.nil?
|
106
|
+
@nocov_token = (nocov_token || "nocov")
|
107
|
+
end
|
108
|
+
alias_method :skip_token, :nocov_token
|
108
109
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
#
|
111
|
+
# Returns the configured groups. Add groups using SimpleCov.add_group
|
112
|
+
#
|
113
|
+
def groups
|
114
|
+
@groups ||= {}
|
115
|
+
end
|
115
116
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
#
|
118
|
+
# Returns the hash of available profiles
|
119
|
+
#
|
120
|
+
def profiles
|
121
|
+
@profiles ||= SimpleCov::Profiles.new
|
122
|
+
end
|
122
123
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
def adapters
|
125
|
+
warn "method adapters is deprecated. use profiles instead"
|
126
|
+
profiles
|
127
|
+
end
|
127
128
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
129
|
+
#
|
130
|
+
# Allows you to configure simplecov in a block instead of prepending SimpleCov to all config methods
|
131
|
+
# you're calling.
|
132
|
+
#
|
133
|
+
# SimpleCov.configure do
|
134
|
+
# add_filter 'foobar'
|
135
|
+
# end
|
136
|
+
#
|
137
|
+
# This is equivalent to SimpleCov.add_filter 'foobar' and thus makes it easier to set a bunch of configure
|
138
|
+
# options at once.
|
139
|
+
#
|
140
|
+
def configure(&block)
|
141
|
+
return false unless SimpleCov.usable?
|
142
|
+
Docile.dsl_eval(self, &block)
|
143
|
+
end
|
143
144
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
145
|
+
#
|
146
|
+
# Gets or sets the behavior to process coverage results.
|
147
|
+
#
|
148
|
+
# By default, it will call SimpleCov.result.format!
|
149
|
+
#
|
150
|
+
# Configure with:
|
151
|
+
# SimpleCov.at_exit do
|
152
|
+
# puts "Coverage done"
|
153
|
+
# SimpleCov.result.format!
|
154
|
+
# end
|
155
|
+
#
|
156
|
+
def at_exit(&block)
|
157
|
+
return proc {} unless running || block_given?
|
158
|
+
@at_exit = block if block_given?
|
159
|
+
@at_exit ||= proc { SimpleCov.result.format! }
|
160
|
+
end
|
160
161
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
162
|
+
#
|
163
|
+
# Returns the project name - currently assuming the last dirname in
|
164
|
+
# the SimpleCov.root is this.
|
165
|
+
#
|
166
|
+
def project_name(new_name = nil)
|
167
|
+
return @project_name if defined?(@project_name) && @project_name && new_name.nil?
|
168
|
+
@project_name = new_name if new_name.is_a?(String)
|
169
|
+
@project_name ||= File.basename(root.split("/").last).capitalize.gsub("_", " ")
|
170
|
+
end
|
170
171
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
172
|
+
#
|
173
|
+
# Defines whether to use result merging so all your test suites (test:units, test:functionals, cucumber, ...)
|
174
|
+
# are joined and combined into a single coverage report
|
175
|
+
#
|
176
|
+
def use_merging(use = nil)
|
177
|
+
@use_merging = use unless use.nil?
|
178
|
+
@use_merging = true unless defined?(@use_merging) && @use_merging == false
|
179
|
+
end
|
179
180
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
181
|
+
#
|
182
|
+
# Defines them maximum age (in seconds) of a resultset to still be included in merged results.
|
183
|
+
# i.e. If you run cucumber features, then later rake test, if the stored cucumber resultset is
|
184
|
+
# more seconds ago than specified here, it won't be taken into account when merging (and is also
|
185
|
+
# purged from the resultset cache)
|
186
|
+
#
|
187
|
+
# Of course, this only applies when merging is active (e.g. SimpleCov.use_merging is not false!)
|
188
|
+
#
|
189
|
+
# Default is 600 seconds (10 minutes)
|
190
|
+
#
|
191
|
+
# Configure with SimpleCov.merge_timeout(3600) # 1hr
|
192
|
+
#
|
193
|
+
def merge_timeout(seconds = nil)
|
194
|
+
@merge_timeout = seconds if seconds.is_a?(Fixnum)
|
195
|
+
@merge_timeout ||= 600
|
196
|
+
end
|
196
197
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
198
|
+
#
|
199
|
+
# Defines the minimum overall coverage required for the testsuite to pass.
|
200
|
+
# SimpleCov will return non-zero if the current coverage is below this threshold.
|
201
|
+
#
|
202
|
+
# Default is 0% (disabled)
|
203
|
+
#
|
204
|
+
def minimum_coverage(coverage = nil)
|
205
|
+
@minimum_coverage ||= (coverage || 0).to_f.round(2)
|
206
|
+
end
|
206
207
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
208
|
+
#
|
209
|
+
# Defines the maximum coverage drop at once allowed for the testsuite to pass.
|
210
|
+
# SimpleCov will return non-zero if the coverage decreases by more than this threshold.
|
211
|
+
#
|
212
|
+
# Default is 100% (disabled)
|
213
|
+
#
|
214
|
+
def maximum_coverage_drop(coverage_drop = nil)
|
215
|
+
@maximum_coverage_drop ||= (coverage_drop || 100).to_f.round(2)
|
216
|
+
end
|
216
217
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
218
|
+
#
|
219
|
+
# Refuses any coverage drop. That is, coverage is only allowed to increase.
|
220
|
+
# SimpleCov will return non-zero if the coverage decreases.
|
221
|
+
#
|
222
|
+
def refuse_coverage_drop
|
223
|
+
maximum_coverage_drop 0
|
224
|
+
end
|
224
225
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
226
|
+
#
|
227
|
+
# Add a filter to the processing chain.
|
228
|
+
# There are three ways to define a filter:
|
229
|
+
#
|
230
|
+
# * as a String that will then be matched against all source files' file paths,
|
231
|
+
# SimpleCov.add_filter 'app/models' # will reject all your models
|
232
|
+
# * as a block which will be passed the source file in question and should either
|
233
|
+
# return a true or false value, depending on whether the file should be removed
|
234
|
+
# SimpleCov.add_filter do |src_file|
|
235
|
+
# File.basename(src_file.filename) == 'environment.rb'
|
236
|
+
# end # Will exclude environment.rb files from the results
|
237
|
+
# * as an instance of a subclass of SimpleCov::Filter. See the documentation there
|
238
|
+
# on how to define your own filter classes
|
239
|
+
#
|
240
|
+
def add_filter(filter_argument = nil, &filter_proc)
|
241
|
+
filters << parse_filter(filter_argument, &filter_proc)
|
242
|
+
end
|
242
243
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
244
|
+
#
|
245
|
+
# Define a group for files. Works similar to add_filter, only that the first
|
246
|
+
# argument is the desired group name and files PASSING the filter end up in the group
|
247
|
+
# (while filters exclude when the filter is applicable).
|
248
|
+
#
|
249
|
+
def add_group(group_name, filter_argument = nil, &filter_proc)
|
250
|
+
groups[group_name] = parse_filter(filter_argument, &filter_proc)
|
251
|
+
end
|
251
252
|
|
252
253
|
private
|
253
254
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
255
|
+
#
|
256
|
+
# The actal filter processor. Not meant for direct use
|
257
|
+
#
|
258
|
+
def parse_filter(filter_argument = nil, &filter_proc)
|
259
|
+
if filter_argument.is_a?(SimpleCov::Filter)
|
260
|
+
filter_argument
|
261
|
+
elsif filter_argument.is_a?(String)
|
262
|
+
SimpleCov::StringFilter.new(filter_argument)
|
263
|
+
elsif filter_proc
|
264
|
+
SimpleCov::BlockFilter.new(filter_proc)
|
265
|
+
elsif filter_argument.is_a?(Array)
|
266
|
+
SimpleCov::ArrayFilter.new(filter_argument)
|
267
|
+
else
|
268
|
+
fail ArgumentError, "Please specify either a string or a block to filter with"
|
269
|
+
end
|
266
270
|
end
|
267
271
|
end
|
268
272
|
end
|