rcov 0.9.11 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rcov +26 -3
- data/ext/rcovrt/1.8/callsite.c +38 -53
- data/ext/rcovrt/1.8/rcovrt.c +84 -100
- data/ext/rcovrt/extconf.rb +7 -12
- data/lib/rcov/formatters/html_erb_template.rb +7 -7
- data/lib/rcov/formatters/html_profiling.rb +51 -0
- data/lib/rcov/formatters/ruby_annotation.rb +110 -0
- data/lib/rcov/templates/index.html.erb +18 -14
- data/lib/rcov/version.rb +2 -6
- metadata +35 -75
- data/BLURB +0 -111
- data/LICENSE +0 -53
- data/Rakefile +0 -103
- data/THANKS +0 -110
- data/doc/readme_for_api.markdown +0 -22
- data/doc/readme_for_emacs.markdown +0 -52
- data/doc/readme_for_rake.markdown +0 -51
- data/doc/readme_for_vim.markdown +0 -34
- data/editor-extensions/rcov.el +0 -131
- data/editor-extensions/rcov.vim +0 -38
- data/ext/rcovrt/1.9/callsite.c +0 -234
- data/ext/rcovrt/1.9/rcovrt.c +0 -264
- data/setup.rb +0 -1588
- data/test/assets/sample_01.rb +0 -7
- data/test/assets/sample_02.rb +0 -5
- data/test/assets/sample_03.rb +0 -20
- data/test/assets/sample_04.rb +0 -10
- data/test/assets/sample_05-new.rb +0 -17
- data/test/assets/sample_05-old.rb +0 -13
- data/test/assets/sample_05.rb +0 -17
- data/test/assets/sample_06.rb +0 -8
- data/test/call_site_analyzer_test.rb +0 -171
- data/test/code_coverage_analyzer_test.rb +0 -220
- data/test/expected_coverage/diff-gcc-all.out +0 -7
- data/test/expected_coverage/diff-gcc-diff.out +0 -11
- data/test/expected_coverage/diff-gcc-original.out +0 -5
- data/test/expected_coverage/diff-no-color.out +0 -12
- data/test/expected_coverage/diff.out +0 -12
- data/test/expected_coverage/gcc-text.out +0 -10
- data/test/expected_coverage/sample_03_rb.html +0 -651
- data/test/expected_coverage/sample_03_rb.rb +0 -28
- data/test/expected_coverage/sample_04_rb.html +0 -641
- data/test/file_statistics_test.rb +0 -471
- data/test/functional_test.rb +0 -91
- data/test/test_helper.rb +0 -4
- data/test/turn_off_rcovrt.rb +0 -4
data/BLURB
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
Overview
|
2
|
-
========
|
3
|
-
rcov is a code coverage tool for Ruby. It is commonly used for viewing overall
|
4
|
-
test coverage of target code. It features:
|
5
|
-
* fast execution: 20-300 times faster than previous tools
|
6
|
-
* multiple analysis modes: standard, bogo-profile, "intentional testing",
|
7
|
-
dependency analysis...
|
8
|
-
* detection of uncovered code introduced since the last run ("differential
|
9
|
-
code coverage")
|
10
|
-
* fairly accurate coverage information through code linkage inference using
|
11
|
-
simple heuristics
|
12
|
-
* cross-referenced XHTML and several kinds of text reports
|
13
|
-
* support for easy automation with Rake
|
14
|
-
* colorblind-friendliness
|
15
|
-
|
16
|
-
How do I use it?
|
17
|
-
================
|
18
|
-
|
19
|
-
In the common scenario, your tests are under test/ and the target code
|
20
|
-
(whose coverage you want) is in lib/. In that case, all you have to do is
|
21
|
-
use rcov to run the tests (instead of testrb), and a number of XHTML files
|
22
|
-
with the code coverage information will be generated, e.g.
|
23
|
-
|
24
|
-
rcov -Ilib test/*.rb
|
25
|
-
|
26
|
-
will execute all the .rb files under test/ and generate the code coverage
|
27
|
-
report for the target code (i.e. for the files in lib/) under coverage/. The
|
28
|
-
target code needs not be under lib/; rcov will detect is as long as it is
|
29
|
-
require()d by the tests. rcov is smart enough to ignore "uninteresting"
|
30
|
-
files: the tests themselves, files installed in Ruby's standard locations,
|
31
|
-
etc. See rcov --help for the list of regexps rcov matches filenames
|
32
|
-
against.
|
33
|
-
|
34
|
-
rcov can also be used from Rake; see readme_for_rake or the RDoc documentation
|
35
|
-
for more information.
|
36
|
-
|
37
|
-
rcov can output information in several formats, and perform different kinds
|
38
|
-
of analyses in addition to plain code coverage. See rcov --help for a
|
39
|
-
description of the available options.
|
40
|
-
|
41
|
-
Sample output
|
42
|
-
=============
|
43
|
-
|
44
|
-
The text report (also used by default in RcovTasks) resembles
|
45
|
-
|
46
|
-
|
47
|
-
+-----------------------------------------------------+-------+-------+--------+
|
48
|
-
| File | Lines | LOC | COV |
|
49
|
-
+-----------------------------------------------------+-------+-------+--------+
|
50
|
-
|lib/rcov.rb | 572 | 358 | 91.3% |
|
51
|
-
+-----------------------------------------------------+-------+-------+--------+
|
52
|
-
|Total | 572 | 358 | 91.3% |
|
53
|
-
+-----------------------------------------------------+-------+-------+--------+
|
54
|
-
91.3% 1 file(s) 572 Lines 358 LOC
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
The (undecorated) textual output with execution count information looks like this:
|
59
|
-
|
60
|
-
$ rcov --no-html --text-counts b.rb
|
61
|
-
================================================================================
|
62
|
-
./b.rb
|
63
|
-
================================================================================
|
64
|
-
| 2
|
65
|
-
a, b, c = (1..3).to_a | 2
|
66
|
-
10.times do | 1
|
67
|
-
a += 1 | 10
|
68
|
-
20.times do |i| | 10
|
69
|
-
b += i | 200
|
70
|
-
b.times do | 200
|
71
|
-
c += (j = (b-a).abs) > 0 ? j : 0 | 738800
|
72
|
-
end | 0
|
73
|
-
end | 0
|
74
|
-
end | 0
|
75
|
-
|
76
|
-
|
77
|
-
rcov can detect when you've added code that was not covered by your unit
|
78
|
-
tests:
|
79
|
-
|
80
|
-
$ rcov --text-coverage-diff --no-color test/*.rb
|
81
|
-
Started
|
82
|
-
.......................................
|
83
|
-
Finished in 1.163085 seconds.
|
84
|
-
|
85
|
-
39 tests, 415 assertions, 0 failures, 0 errors
|
86
|
-
|
87
|
-
================================================================================
|
88
|
-
!!!!! Uncovered code introduced in lib/rcov.rb
|
89
|
-
|
90
|
-
### lib/rcov.rb:207
|
91
|
-
|
92
|
-
def precompute_coverage(comments_run_by_default = true)
|
93
|
-
changed = false
|
94
|
-
lastidx = lines.size - 1
|
95
|
-
if (!is_code?(lastidx) || /^__END__$/ =~ @lines[-1]) && !@coverage[lastidx]
|
96
|
-
!! # mark the last block of comments
|
97
|
-
!! @coverage[lastidx] ||= :inferred
|
98
|
-
!! (lastidx-1).downto(0) do |i|
|
99
|
-
!! break if is_code?(i)
|
100
|
-
!! @coverage[i] ||= :inferred
|
101
|
-
!! end
|
102
|
-
!! end
|
103
|
-
(0...lines.size).each do |i|
|
104
|
-
next if @coverage[i]
|
105
|
-
line = @lines[i]
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
License
|
110
|
-
-------
|
111
|
-
rcov is released under the terms of Ruby's license.
|
data/LICENSE
DELETED
@@ -1,53 +0,0 @@
|
|
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
|
-
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
|
-
5. The scripts and library files supplied as input to or produced as
|
45
|
-
output from the software do not automatically fall under the
|
46
|
-
copyright of the software, but belong to whomever generated them,
|
47
|
-
and may be sold commercially, and may be aggregated with this
|
48
|
-
software.
|
49
|
-
|
50
|
-
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
51
|
-
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
52
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
53
|
-
PURPOSE.
|
data/Rakefile
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
$:.unshift "lib" if File.directory? "lib"
|
2
|
-
require 'rcov/rcovtask'
|
3
|
-
require 'rcov/version'
|
4
|
-
require 'rake/testtask'
|
5
|
-
require 'rake/rdoctask'
|
6
|
-
require 'rake/gempackagetask'
|
7
|
-
require 'rake/clean'
|
8
|
-
|
9
|
-
# Use the specified rcov executable instead of the one in $PATH
|
10
|
-
# (this way we get a sort of informal functional test).
|
11
|
-
# This could also be specified from the command like, e.g.
|
12
|
-
# rake rcov RCOVPATH=/path/to/myrcov
|
13
|
-
ENV["RCOVPATH"] = "bin/rcov"
|
14
|
-
|
15
|
-
# The following task is largely equivalent to:
|
16
|
-
# Rcov::RcovTask.new
|
17
|
-
desc "Create a cross-referenced code coverage report."
|
18
|
-
Rcov::RcovTask.new do |t|
|
19
|
-
t.test_files = FileList['test/*_test.rb']
|
20
|
-
t.ruby_opts << "-Ilib:ext/rcovrt" # in order to use this rcov
|
21
|
-
t.rcov_opts << "--xrefs" # comment to disable cross-references
|
22
|
-
t.verbose = true
|
23
|
-
end
|
24
|
-
|
25
|
-
desc "Analyze code coverage for the FileStatistics class."
|
26
|
-
Rcov::RcovTask.new(:rcov_sourcefile) do |t|
|
27
|
-
t.test_files = FileList['test/file_statistics_test.rb']
|
28
|
-
t.verbose = true
|
29
|
-
t.rcov_opts << "--test-unit-only"
|
30
|
-
t.ruby_opts << "-Ilib:ext/rcovrt" # in order to use this rcov
|
31
|
-
t.output_dir = "coverage.sourcefile"
|
32
|
-
end
|
33
|
-
|
34
|
-
Rcov::RcovTask.new(:rcov_ccanalyzer) do |t|
|
35
|
-
t.test_files = FileList['test/code_coverage_analyzer_test.rb']
|
36
|
-
t.verbose = true
|
37
|
-
t.rcov_opts << "--test-unit-only"
|
38
|
-
t.ruby_opts << "-Ilib:ext/rcovrt" # in order to use this rcov
|
39
|
-
t.output_dir = "coverage.ccanalyzer"
|
40
|
-
end
|
41
|
-
|
42
|
-
desc "Run the unit tests with rcovrt."
|
43
|
-
if RUBY_PLATFORM == 'java'
|
44
|
-
Rake::TestTask.new(:test_rcovrt => ["lib/rcovrt.jar"]) do |t|
|
45
|
-
t.libs << "lib"
|
46
|
-
t.ruby_opts << "--debug"
|
47
|
-
t.test_files = FileList['test/*_test.rb']
|
48
|
-
t.verbose = true
|
49
|
-
end
|
50
|
-
|
51
|
-
file "lib/rcovrt.jar" => FileList["ext/java/**/*.java"] do |t|
|
52
|
-
rm_f "lib/rcovrt.jar"
|
53
|
-
mkdir_p "pkg/classes"
|
54
|
-
sh "javac -classpath #{Java::JavaLang::System.getProperty('java.class.path')} -d pkg/classes #{t.prerequisites.join(' ')}"
|
55
|
-
sh "jar cf #{t.name} -C pkg/classes ."
|
56
|
-
end
|
57
|
-
else
|
58
|
-
Rake::TestTask.new(:test_rcovrt => ["ext/rcovrt/rcovrt.so"]) do |t|
|
59
|
-
system("cd ext/rcovrt && make clean && rm Makefile")
|
60
|
-
t.libs << "ext/rcovrt"
|
61
|
-
t.test_files = FileList['test/*_test.rb']
|
62
|
-
t.verbose = true
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
file "ext/rcovrt/rcovrt.so" => FileList["ext/rcovrt/*.c"] do
|
67
|
-
ruby "setup.rb config"
|
68
|
-
ruby "setup.rb setup"
|
69
|
-
end
|
70
|
-
|
71
|
-
desc "Run the unit tests in pure-Ruby mode ."
|
72
|
-
Rake::TestTask.new(:test_pure_ruby) do |t|
|
73
|
-
t.libs << "ext/rcovrt"
|
74
|
-
t.test_files = FileList['test/turn_off_rcovrt.rb', 'test/*_test.rb']
|
75
|
-
t.verbose = true
|
76
|
-
end
|
77
|
-
|
78
|
-
desc "Run the unit tests"
|
79
|
-
task :test => [:test_rcovrt]
|
80
|
-
|
81
|
-
desc "install by setup.rb"
|
82
|
-
task :install do
|
83
|
-
sh "sudo ruby setup.rb install"
|
84
|
-
end
|
85
|
-
|
86
|
-
task :default => :test
|
87
|
-
|
88
|
-
begin
|
89
|
-
%w{sdoc sdoc-helpers rdiscount}.each { |name| gem name }
|
90
|
-
require 'sdoc_helpers'
|
91
|
-
rescue LoadError => ex
|
92
|
-
puts "sdoc support not enabled:"
|
93
|
-
puts ex.inspect
|
94
|
-
end
|
95
|
-
|
96
|
-
require 'rake/rdoctask'
|
97
|
-
Rake::RDocTask.new do |rdoc|
|
98
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
99
|
-
rdoc.rdoc_dir = 'rdoc'
|
100
|
-
rdoc.title = "rcov #{version}"
|
101
|
-
rdoc.rdoc_files.include('README*')
|
102
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
103
|
-
end
|
data/THANKS
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
Jay McGaffigan:
|
2
|
-
* JRuby support integrated from original rcov4j
|
3
|
-
|
4
|
-
Aaron Bedra:
|
5
|
-
* major refactoring
|
6
|
-
* added threshold testing
|
7
|
-
* Took on the task of keeping RCov going
|
8
|
-
|
9
|
-
Corey Ehmke (Bantik):
|
10
|
-
* redesigned index and detail XHTML
|
11
|
-
* added sortable columns in coverage table
|
12
|
-
* added file and coverage threshold filters to index XHTML
|
13
|
-
* added print-specific style sheet
|
14
|
-
* added support for custom CSS for XHTML output
|
15
|
-
|
16
|
-
Tom Dolbilin:
|
17
|
-
* identified and fixed backslash problem on win32 for generated filenames
|
18
|
-
|
19
|
-
Andrew Kreiling:
|
20
|
-
* made the index XHTML compliant
|
21
|
-
* consolidate multiple references to the same underlying .rb file
|
22
|
-
|
23
|
-
Robert Feldt:
|
24
|
-
* pointed me to dynamic uses of the tracing hooks, provided the inspiration
|
25
|
-
for RCOV__.run_hooked
|
26
|
-
* helped to refine the color scheme
|
27
|
-
|
28
|
-
Andre Nathan:
|
29
|
-
* identified a bug in the heuristics: missing propagation for lines
|
30
|
-
with only }, ), ]
|
31
|
-
|
32
|
-
David Roberts:
|
33
|
-
* reported confusing behavior when all files are ignored because they match
|
34
|
-
a regexp in the reject list
|
35
|
-
* tested the RubyGems package for win32
|
36
|
-
|
37
|
-
John-Mason Shackelford:
|
38
|
-
* reported an important bug in the pure-Ruby tracer module, which broke it
|
39
|
-
altogether in 0.4.0
|
40
|
-
* suggested a change in the CSS to make XHTML reports more readable under IE
|
41
|
-
|
42
|
-
Dave Burt:
|
43
|
-
* reported an issue with text reports under cmd.exe (should use < 80 cols)
|
44
|
-
|
45
|
-
Alex Wayne:
|
46
|
-
* reported problem with heredocs: they were not being marked as a whole if
|
47
|
-
the "header" wasn't reported by Ruby.
|
48
|
-
* reported problem with the last line of literal data structs not being
|
49
|
-
covered if there was stuff after the end delimiter
|
50
|
-
|
51
|
-
Coda Hale:
|
52
|
-
* reported problem with blocks were the first line is not being marked
|
53
|
-
and ditto for the last line when end/} is followed by more stuff
|
54
|
-
|
55
|
-
Tim Shadel:
|
56
|
-
* reported that the last comment block was not being marked even when
|
57
|
-
it was the last thing in the file
|
58
|
-
|
59
|
-
Thomas Leitner:
|
60
|
-
* reported that the SCRIPT_LINES__ workaround did not always work
|
61
|
-
* fixed the bug which broke differential reports for filenames with
|
62
|
-
special characters
|
63
|
-
|
64
|
-
Assaph Mehr:
|
65
|
-
* beta-tested 0.7.0 and found a bug in --aggregate (missing files)
|
66
|
-
|
67
|
-
Ryan Kinderman:
|
68
|
-
* suggested that -Ipath be passed to ruby instead of rcov in RcovTasks
|
69
|
-
|
70
|
-
Jan Svitok:
|
71
|
-
* reported typo in rcovtask.rb's RDoc
|
72
|
-
|
73
|
-
rubikitch:
|
74
|
-
* implemented --annotate mode
|
75
|
-
* implemented --gcc option
|
76
|
-
* superior emacs support
|
77
|
-
* testing, refactoring...
|
78
|
-
* many other things, see darcs changes
|
79
|
-
|
80
|
-
Zed A. Shaw:
|
81
|
-
* reported and fixed segfault triggered by rspec
|
82
|
-
|
83
|
-
Lee Marlow:
|
84
|
-
* patch allowing to run rcov against a data file with no input code
|
85
|
-
|
86
|
-
Kurt Stephens:
|
87
|
-
* patch to rethrow any exceptions generated by the traced scripts after
|
88
|
-
report generation; notably SystemExit, allowing to use the exit code from
|
89
|
-
test runners under rake.
|
90
|
-
|
91
|
-
Brian Candler:
|
92
|
-
* found compatibility issues with the REXML lib included in ruby-1.8.6-p110
|
93
|
-
and provided a workaround
|
94
|
-
|
95
|
-
Mat Schaffer:
|
96
|
-
* reported missing line colorization on Safari and probably other browsers,
|
97
|
-
owing to self-closing <a> not being handled properly despite being valid
|
98
|
-
XHTML 1.0.
|
99
|
-
|
100
|
-
Sam Granieri:
|
101
|
-
* tested workaround for REXML bug
|
102
|
-
|
103
|
-
Kosmas Schütz, Daniel Berger, François Beausoleil, Bil Kleb:
|
104
|
-
* provided information about the ruby-1.8.6-p11[01] REXML problems
|
105
|
-
|
106
|
-
Chad Humphries:
|
107
|
-
* indicated that Spec::DSL::Example has changed in RSpec trunk
|
108
|
-
|
109
|
-
Jeremy Hinegardner:
|
110
|
-
* more info about REXML's bugs in 1.8.6-p11[01]
|
data/doc/readme_for_api.markdown
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# RCov
|
2
|
-
|
3
|
-
RCov is a:
|
4
|
-
|
5
|
-
1. tool for code coverage analysis for Ruby
|
6
|
-
2. library for collecting code coverage and execution count information introspectively
|
7
|
-
|
8
|
-
If you want to use the command line tool, the output from `rcov -h` is self explanatory. If you want to automate the execution of RCov via Rake take a look at [readme for rake]("http://github.com/relevance/rcov/blob/master/doc/readme_for_rake.markdown"). If you want to use the associated library, read on.
|
9
|
-
|
10
|
-
## Usage of the RCov runtime/library
|
11
|
-
|
12
|
-
RCov is primarily a tool for code coverage analysis, but since 0.4.0 it exposes some of its code so that you can build on top of its heuristics for code analysis and its capabilities for coverage information and execution count gathering. The main classes of interest are `Rcov::FileStatistics`, `Rcov::CodeCoverageAnalyzer` and `Rcov::CallSiteAnalyzer`.
|
13
|
-
|
14
|
-
* `Rcov::FileStatistics` can use some heuristics to determine which parts of the file are executable and which are mere comments.
|
15
|
-
|
16
|
-
* `Rcov::CodeCoverageAnalyzer` is used to gather code coverage and execution count information inside a running Ruby program.
|
17
|
-
|
18
|
-
* `Rcov::CallSiteAnalyzer` is used to obtain information about where methods are defined and who calls them.
|
19
|
-
|
20
|
-
The parts of RCov's runtime meant to be reused (i.e. the external API) are documented with RDoc. Those not meant to be used are clearly marked as so or were deliberately removed from the present documentation.
|
21
|
-
|
22
|
-
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# rcov.el
|
2
|
-
|
3
|
-
`rcov.el` allows you to use rcov from Emacs conveniently.
|
4
|
-
|
5
|
-
* Run unit tests and jump to uncovered code by <code>C-x `</code>
|
6
|
-
* Run unit tests and save the current coverage status.
|
7
|
-
* Run unit tests and jump to uncovered code introduced since the last run.
|
8
|
-
* View cross-reference annotated code.
|
9
|
-
|
10
|
-
## Installation
|
11
|
-
|
12
|
-
Copy <tt>rcov.el</tt> to the appropriate directory, which is in load-path then require it.
|
13
|
-
|
14
|
-
`(require 'rcov)`
|
15
|
-
|
16
|
-
## Usage
|
17
|
-
|
18
|
-
There are some commands to run RCov in Emacs. All of them will display RCov window, whose `major-mode` is `compilation-mode`. This allow you to jump to uncovered code using C-x `. rcov-command-line, rcovsave-command-line, and rcovdiff-command-line define command line to run rcov. If you do not use RCov from Rake, you must modify them.
|
19
|
-
|
20
|
-
### Finding uncovered code
|
21
|
-
|
22
|
-
Type the following while editing your program:
|
23
|
-
|
24
|
-
`M-x rcov`
|
25
|
-
|
26
|
-
### Setting the reference point
|
27
|
-
|
28
|
-
RCov's `--text-coverage-diff` mode compares the current coverage status against the saved one. It therefore needs that information to be recorded before you write new code (typically right after you perform a commit) in order to have something to compare against. You can save the current status with the `--save` option. Type the following to save the current status in Emacs:
|
29
|
-
|
30
|
-
`M-x rcovsave`
|
31
|
-
|
32
|
-
If you do not use RCov from Rake, you must modify `rcovsave-command-line` variable.
|
33
|
-
|
34
|
-
### Finding new uncovered code
|
35
|
-
|
36
|
-
Type the following to save the current status in Emacs:
|
37
|
-
|
38
|
-
`M-x rcovdiff`
|
39
|
-
|
40
|
-
### Viewing cross-reference annotated code
|
41
|
-
|
42
|
-
If you read cross-reference annotated code, issue
|
43
|
-
|
44
|
-
`rake rcov RCOVOPTS='-a'`
|
45
|
-
|
46
|
-
at the beginning. This command creates a `coverage` directory and many `*.rb` files in it. Filenames of these Ruby scripts are converted from original path. You can browse them by normally `C-x C-f`. You can think of `-a` option as `--xrefs` option and output format is Ruby script. After `find-file-ed` annotated script, the `major-mode` is `rcov-xref-mode`,
|
47
|
-
which is derived from `ruby-mode` and specializes navigation.
|
48
|
-
|
49
|
-
* `Tab` and `M-Tab` goes forward/backward links.
|
50
|
-
* `Ret` follows selected link.
|
51
|
-
|
52
|
-
This feature is useful to read third-party code or to follow control flow.
|