relevance-rcov 0.8.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/BLURB ADDED
@@ -0,0 +1,149 @@
1
+
2
+ Source code, additional information, screenshots... available at
3
+ http://eigenclass.org/hiki/rcov
4
+
5
+ If you're on win32, you can also find a pre-built rcovrt.so (which makes
6
+ code coverage analysis >100 times faster) in the above-mentioned pages.
7
+
8
+ Overview
9
+ ========
10
+ rcov is a code coverage tool for Ruby. It is commonly used for viewing overall
11
+ test coverage of target code. It features:
12
+ * fast execution: 20-300 times faster than previous tools
13
+ * multiple analysis modes: standard, bogo-profile, "intentional testing",
14
+ dependency analysis...
15
+ * detection of uncovered code introduced since the last run ("differential
16
+ code coverage")
17
+ * fairly accurate coverage information through code linkage inference using
18
+ simple heuristics
19
+ * cross-referenced XHTML and several kinds of text reports
20
+ * support for easy automation with Rake
21
+ * colorblind-friendliness
22
+
23
+ How do I use it?
24
+ ================
25
+
26
+ In the common scenario, your tests are under test/ and the target code
27
+ (whose coverage you want) is in lib/. In that case, all you have to do is
28
+ use rcov to run the tests (instead of testrb), and a number of XHTML files
29
+ with the code coverage information will be generated, e.g.
30
+
31
+ rcov -Ilib test/*.rb
32
+
33
+ will execute all the .rb files under test/ and generate the code coverage
34
+ report for the target code (i.e. for the files in lib/) under coverage/. The
35
+ target code needs not be under lib/; rcov will detect is as long as it is
36
+ require()d by the tests. rcov is smart enough to ignore "uninteresting"
37
+ files: the tests themselves, files installed in Ruby's standard locations,
38
+ etc. See rcov --help for the list of regexps rcov matches filenames
39
+ against.
40
+
41
+ rcov can also be used from Rake; see readme_for_rake or the RDoc documentation
42
+ for more information.
43
+
44
+ rcov can output information in several formats, and perform different kinds
45
+ of analyses in addition to plain code coverage. See rcov --help for a
46
+ description of the available options.
47
+
48
+ Sample output
49
+ =============
50
+
51
+ See http://eigenclass.org/hiki.rb?rcov (once again) for screenshots.
52
+
53
+ The text report (also used by default in RcovTasks) resembles
54
+
55
+
56
+ +-----------------------------------------------------+-------+-------+--------+
57
+ | File | Lines | LOC | COV |
58
+ +-----------------------------------------------------+-------+-------+--------+
59
+ |lib/rcov.rb | 572 | 358 | 91.3% |
60
+ +-----------------------------------------------------+-------+-------+--------+
61
+ |Total | 572 | 358 | 91.3% |
62
+ +-----------------------------------------------------+-------+-------+--------+
63
+ 91.3% 1 file(s) 572 Lines 358 LOC
64
+
65
+
66
+
67
+ The (undecorated) textual output with execution count information looks like this:
68
+
69
+ $ rcov --no-html --text-counts b.rb
70
+ ================================================================================
71
+ ./b.rb
72
+ ================================================================================
73
+ | 2
74
+ a, b, c = (1..3).to_a | 2
75
+ 10.times do | 1
76
+ a += 1 | 10
77
+ 20.times do |i| | 10
78
+ b += i | 200
79
+ b.times do | 200
80
+ c += (j = (b-a).abs) > 0 ? j : 0 | 738800
81
+ end | 0
82
+ end | 0
83
+ end | 0
84
+
85
+
86
+ rcov can detect when you've added code that was not covered by your unit
87
+ tests:
88
+
89
+ $ rcov --text-coverage-diff --no-color test/*.rb
90
+ Started
91
+ .......................................
92
+ Finished in 1.163085 seconds.
93
+
94
+ 39 tests, 415 assertions, 0 failures, 0 errors
95
+
96
+ ================================================================================
97
+ !!!!! Uncovered code introduced in lib/rcov.rb
98
+
99
+ ### lib/rcov.rb:207
100
+
101
+ def precompute_coverage(comments_run_by_default = true)
102
+ changed = false
103
+ lastidx = lines.size - 1
104
+ if (!is_code?(lastidx) || /^__END__$/ =~ @lines[-1]) && !@coverage[lastidx]
105
+ !! # mark the last block of comments
106
+ !! @coverage[lastidx] ||= :inferred
107
+ !! (lastidx-1).downto(0) do |i|
108
+ !! break if is_code?(i)
109
+ !! @coverage[i] ||= :inferred
110
+ !! end
111
+ !! end
112
+ (0...lines.size).each do |i|
113
+ next if @coverage[i]
114
+ line = @lines[i]
115
+
116
+
117
+
118
+ License
119
+ -------
120
+ rcov is released under the terms of Ruby's license.
121
+ rcov includes xx 0.1.0, which is subject to the following conditions:
122
+
123
+ ePark Labs Public License version 1
124
+ Copyright (c) 2005, ePark Labs, Inc. and contributors
125
+ All rights reserved.
126
+
127
+ Redistribution and use in source and binary forms, with or without modification,
128
+ are permitted provided that the following conditions are met:
129
+
130
+ 1. Redistributions of source code must retain the above copyright notice, this
131
+ list of conditions and the following disclaimer.
132
+ 2. Redistributions in binary form must reproduce the above copyright notice,
133
+ this list of conditions and the following disclaimer in the documentation
134
+ and/or other materials provided with the distribution.
135
+ 3. Neither the name of ePark Labs nor the names of its contributors may be
136
+ used to endorse or promote products derived from this software without
137
+ specific prior written permission.
138
+
139
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
140
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
141
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
142
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
143
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
144
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
145
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
146
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
147
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
148
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
149
+
data/CHANGES ADDED
@@ -0,0 +1,177 @@
1
+
2
+ User-visible changes.
3
+
4
+ Since 0.8.1.1 (2007-11-20)
5
+ ==========================
6
+ Bugfixes
7
+ --------
8
+ * REXML from 1.8.6-p11[01] is more broken than anticipated; more invasive
9
+ workarounds. Tested on 1.8.6-p110 and 1.8.5. Note that code using REXML to
10
+ generate XML will behave differently under rcov in 1.8.6-p11[01] (to begin
11
+ with, it won't crash in REXML::Document#write).
12
+
13
+ Since 0.8.1 (2007-11-19)
14
+ ========================
15
+ Bugfixes
16
+ --------
17
+ * REXML workaround incorrectly applied to 1.8.6 < p110
18
+ * --spec-only should work with RSpec trunk and detect when it cannot work
19
+
20
+ Since 0.8.0 (2007-02-28)
21
+ ========================
22
+ Features
23
+ --------
24
+ * you can use an existent data file to generate coverage reports without
25
+ having to execute your code again
26
+ * --spec-only: only consider cover code executed inside a spec
27
+ (tested with RSpec 1.0.5, 1.0.8)
28
+ * --charset can be used to specify the charset in the Content-Type declaration
29
+
30
+ Bugfixes
31
+ --------
32
+ * workaround for bugs in Safari, IE (self-closing anchors break colorization)
33
+ * workaround for bugs in REXML shipped with 1.8.6-p110
34
+ * rethrow exceptions generated by traced scripts
35
+ * compatibility with Ruby < 1.8.5
36
+
37
+ Since 0.7.0 (2006-08-04)
38
+ ========================
39
+ Features
40
+ --------
41
+ * --annotate mode, which dumps annotated source code which can be used to
42
+ follow the control flow (very useful when reading third-party code)
43
+ * --gcc option to display uncovered lines in GCC error format
44
+ * superior Emacs support: running rcov, jumping to uncovered code, navigate
45
+ through cross-referenced annotated code
46
+ * --[no-]validator-links
47
+
48
+ Bugfixes
49
+ --------
50
+ * differential code coverage reports work with filenames containing special
51
+ characters
52
+ * fixed recent segfaults happening with rspec
53
+ * more care name mangling
54
+
55
+ Minor enhancements
56
+ ------------------
57
+ * relevant summary values are identified using separate CSS classes
58
+ (microformat-style)
59
+
60
+ Since 0.6.0 (2006-06-12)
61
+ ========================
62
+ Features
63
+ --------
64
+ * coverage/callsite data from multiple runs can be aggregated (--aggregate)
65
+
66
+ Bugfixes
67
+ --------
68
+ * the SCRIPT_LINES__ workaround works better
69
+ * fixed silly bug in coverage data acquisition (line after the correct one
70
+ marked in some situations)
71
+ * avoid problems with repeated path separators in default ignore list, based
72
+ on rbconfig's data
73
+
74
+
75
+ Minor enhancements
76
+ ------------------
77
+
78
+ Since 0.5.0 (2006-05-30)
79
+ ========================
80
+ Features
81
+ --------
82
+ * differential coverage report: --text-coverage-diff (-D) and --save
83
+ Tells you when you've added new code that was not covered by the tests and
84
+ when code that used to be covered isn't anymore. Integration with vim
85
+ (contributions for other editors/IDEs welcome).
86
+ * fully cross-referenced reports, indicating where methods are called from
87
+ and which methods were called for each line (--xrefs)
88
+ * cross-referenced report generation is now over 4 times faster for
89
+ applications with deep call stacks (such as Rails apps)
90
+
91
+ Bugfixes
92
+ --------
93
+ * comments at EOF are marked now
94
+ * better handling of multiline hashes/arrays
95
+ * better handling of end/}: support chained method calls and more expressions
96
+ on the same line
97
+ * better handling of heredocs with interpolation
98
+
99
+ Minor enhancements
100
+ ------------------
101
+ * more readable --text-coverage
102
+ * set whether comments are "run" by default instead of attaching them to
103
+ the following block of code (--[no-]comments)
104
+ * --report-cov-bug can be used to report bugs in the coverage analysis
105
+
106
+ Since 0.4.0 (2006-05-22)
107
+ ========================
108
+ Features
109
+ --------
110
+ * ability to create cross-referenced reports, indicating where methods are
111
+ called from (--callsites)
112
+ * more refinements in the heuristics: now several kinds of multi-line quoted
113
+ strings are handled properly
114
+ * --include-file to specify files not to be ignored in the report(s)
115
+ * implemented a task generator for Rant
116
+
117
+ Bugfixes
118
+ --------
119
+ * corrected the LOC counts in the XHTML summaries
120
+ * pure-Ruby tracing module works again; was broken in 0.4.0
121
+ * RcovTask#ruby_opts fixed; they were being passed to rcov instead of ruby
122
+ * solved the DOCTYPE issue (it'd get put at the end of the file under some
123
+ Ruby versions)
124
+
125
+ Minor enhancements
126
+ ------------------
127
+ * slightly more readable XHTML reports, esp. for IE
128
+ * text reports fit in 79 columns so they look OK with cmd.exe
129
+ * try to guide the user when all files were considered "uninteresting" by rcov
130
+ * the output_dir is preserved in RcovTasks when the user specifies --profile
131
+ via the RCOVOPTS env. var.
132
+
133
+ Since 0.3.0 (2006-05-05)
134
+ ========================
135
+
136
+ Features
137
+ --------
138
+ * easy automation via Rake using the bundled Rcov::RcovTask
139
+ * better heuristics: supports heredocs at last, including variants your editor
140
+ is probably unable to handle, and =begin/=end comments
141
+ * --rails option to ignore files under vendor/, enviroment/ and config/
142
+ * parts of the runtime exposed and documented for external use
143
+ * new color scheme, with alternating shades of the base colors
144
+ * -w to set $VERBOSE=true (turns on warnings)
145
+ * --text-report and --text-summary
146
+ * --sort and --sort-reverse for the summaries and reports
147
+ * --threshold and --only-uncovered
148
+ * --replace-progname
149
+
150
+ Backwards incompatible changes
151
+ ------------------------------
152
+ * renamed --text to --text-counts and --rich-text to --text-coverage: they
153
+ were misnamed to begin with
154
+ * changed the meaning of -t and -T (--text-summary and --text-report)
155
+ * $0 is not changed by default for each loaded file anymore; the old
156
+ behavior (modulo a small bugfix) can be reproduced with --replace-progname
157
+
158
+ Since 0.2.0 (2006-02-25)
159
+ ========================
160
+
161
+ Features
162
+ --------
163
+ * --exclude-only
164
+ * consolidate multiple references to the same underlying .rb file
165
+ (much needed for Rails)
166
+ * --test-unit-only
167
+
168
+ Fixes
169
+ -----
170
+ * consider and/op operators
171
+ * honor --no-color in (rich) text mode
172
+ * output valid XHTML indices
173
+
174
+ Since 0.1.0
175
+ ===========
176
+ Tons. Better output, MUCH faster (two orders of magnitude), better command
177
+ line...
data/LEGAL ADDED
@@ -0,0 +1,36 @@
1
+
2
+ LEGAL NOTICE
3
+ ------------
4
+
5
+ rcov itself is subject to the terms specified in LICENSE.
6
+
7
+ rcov includes xx-0.1.0, which can be redistributed and used under the
8
+ following conditions:
9
+
10
+
11
+ ePark Labs Public License version 1
12
+ Copyright (c) 2005, ePark Labs, Inc. and contributors
13
+ All rights reserved.
14
+
15
+ Redistribution and use in source and binary forms, with or without modification,
16
+ are permitted provided that the following conditions are met:
17
+
18
+ 1. Redistributions of source code must retain the above copyright notice, this
19
+ list of conditions and the following disclaimer.
20
+ 2. Redistributions in binary form must reproduce the above copyright notice,
21
+ this list of conditions and the following disclaimer in the documentation
22
+ and/or other materials provided with the distribution.
23
+ 3. Neither the name of ePark Labs nor the names of its contributors may be
24
+ used to endorse or promote products derived from this software without
25
+ specific prior written permission.
26
+
27
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
28
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
31
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
34
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/LICENSE ADDED
@@ -0,0 +1,56 @@
1
+ rcov is copyrighted free software by Mauricio Fernandez <mfp@acm.org>.
2
+ You can redistribute it and/or modify it under either the terms of the GPL
3
+ (see the file GPL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a) distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c) give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
@@ -0,0 +1,93 @@
1
+ # This Rakefile serves as an example of how to use Rcov::RcovTask.
2
+ # Take a look at the RDoc documentation (or readme_for_rake) for further
3
+ # information.
4
+
5
+ $:.unshift "lib" if File.directory? "lib"
6
+ require 'rcov/rcovtask'
7
+ require 'rcov/version'
8
+ require 'rake/testtask'
9
+ require 'rake/rdoctask'
10
+ require 'rake/gempackagetask'
11
+ require 'rake/clean'
12
+
13
+ # Use the specified rcov executable instead of the one in $PATH
14
+ # (this way we get a sort of informal functional test).
15
+ # This could also be specified from the command like, e.g.
16
+ # rake rcov RCOVPATH=/path/to/myrcov
17
+ ENV["RCOVPATH"] = "bin/rcov"
18
+
19
+ # The following task is largely equivalent to:
20
+ # Rcov::RcovTask.new
21
+ desc "Create a cross-referenced code coverage report."
22
+ Rcov::RcovTask.new do |t|
23
+ t.test_files = FileList['test/*_test.rb']
24
+ t.ruby_opts << "-Ilib:ext/rcovrt" # in order to use this rcov
25
+ t.rcov_opts << "--xrefs" # comment to disable cross-references
26
+ t.verbose = true
27
+ end
28
+
29
+ desc "Analyze code coverage for the FileStatistics class."
30
+ Rcov::RcovTask.new(:rcov_sourcefile) do |t|
31
+ t.test_files = FileList['test/file_statistics_test.rb']
32
+ t.verbose = true
33
+ t.rcov_opts << "--test-unit-only"
34
+ t.ruby_opts << "-Ilib:ext/rcovrt" # in order to use this rcov
35
+ t.output_dir = "coverage.sourcefile"
36
+ end
37
+
38
+ Rcov::RcovTask.new(:rcov_ccanalyzer) do |t|
39
+ t.test_files = FileList['test/code_coverage_analyzer_test.rb']
40
+ t.verbose = true
41
+ t.rcov_opts << "--test-unit-only"
42
+ t.ruby_opts << "-Ilib:ext/rcovrt" # in order to use this rcov
43
+ t.output_dir = "coverage.ccanalyzer"
44
+ end
45
+
46
+ desc "Run the unit tests with rcovrt."
47
+ if RUBY_PLATFORM == 'java'
48
+ Rake::TestTask.new(:test_rcovrt => ["lib/rcovrt.jar"]) do |t|
49
+ t.libs << "lib"
50
+ t.test_files = FileList['test/*_test.rb']
51
+ t.verbose = true
52
+ end
53
+ else
54
+ Rake::TestTask.new(:test_rcovrt => ["ext/rcovrt/rcovrt.so"]) do |t|
55
+ system("cd ext/rcovrt && make clean && rm Makefile")
56
+ t.libs << "ext/rcovrt"
57
+ t.test_files = FileList['test/*_test.rb']
58
+ t.verbose = true
59
+ end
60
+ end
61
+
62
+ file "ext/rcovrt/rcovrt.so" => FileList["ext/rcovrt/*.c"] do
63
+ ruby "setup.rb config"
64
+ ruby "setup.rb setup"
65
+ end
66
+
67
+ desc "Run the unit tests in pure-Ruby mode ."
68
+ Rake::TestTask.new(:test_pure_ruby) do |t|
69
+ t.libs << "ext/rcovrt"
70
+ t.test_files = FileList['test/turn_off_rcovrt.rb', 'test/*_test.rb']
71
+ t.verbose = true
72
+ end
73
+
74
+ desc "Run the unit tests"
75
+ task :test => [:test_rcovrt]
76
+
77
+ desc "install by setup.rb"
78
+ task :install do
79
+ sh "sudo ruby setup.rb install"
80
+ end
81
+
82
+ task :default => :test
83
+
84
+ desc "Generate rdoc documentation for the rcov library"
85
+ Rake::RDocTask.new("rdoc") { |rdoc|
86
+ rdoc.rdoc_dir = 'doc'
87
+ rdoc.title = "rcov"
88
+ rdoc.options << "--line-numbers" << "--inline-source"
89
+ rdoc.rdoc_files.include('doc/readme_for_api')
90
+ rdoc.rdoc_files.include('doc/readme_for_rake')
91
+ rdoc.rdoc_files.include('doc/readme_for_vim')
92
+ rdoc.rdoc_files.include('lib/**/*.rb')
93
+ }