rcov 0.8.1.2.0 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/BLURB +2 -40
  2. data/LICENSE +2 -5
  3. data/Rakefile +32 -106
  4. data/THANKS +14 -0
  5. data/bin/rcov +277 -1090
  6. data/doc/readme_for_api.markdown +22 -0
  7. data/doc/readme_for_emacs.markdown +52 -0
  8. data/doc/readme_for_rake.markdown +51 -0
  9. data/doc/readme_for_vim.markdown +34 -0
  10. data/{rcov.el → editor-extensions/rcov.el} +0 -0
  11. data/{rcov.vim → editor-extensions/rcov.vim} +0 -0
  12. data/ext/rcovrt/1.8/callsite.c +216 -0
  13. data/ext/rcovrt/1.8/rcovrt.c +287 -0
  14. data/ext/rcovrt/1.9/callsite.c +234 -0
  15. data/ext/rcovrt/1.9/rcovrt.c +264 -0
  16. data/ext/rcovrt/extconf.rb +12 -2
  17. data/lib/rcov.rb +13 -968
  18. data/lib/rcov/call_site_analyzer.rb +225 -0
  19. data/lib/rcov/code_coverage_analyzer.rb +268 -0
  20. data/lib/rcov/coverage_info.rb +36 -0
  21. data/lib/rcov/differential_analyzer.rb +116 -0
  22. data/lib/rcov/file_statistics.rb +334 -0
  23. data/lib/rcov/formatters.rb +13 -0
  24. data/lib/rcov/formatters/base_formatter.rb +173 -0
  25. data/lib/rcov/formatters/failure_report.rb +15 -0
  26. data/lib/rcov/formatters/full_text_report.rb +48 -0
  27. data/lib/rcov/formatters/html_coverage.rb +274 -0
  28. data/lib/rcov/formatters/html_erb_template.rb +62 -0
  29. data/lib/rcov/formatters/text_coverage_diff.rb +193 -0
  30. data/lib/rcov/formatters/text_report.rb +32 -0
  31. data/lib/rcov/formatters/text_summary.rb +11 -0
  32. data/lib/rcov/lowlevel.rb +16 -17
  33. data/lib/rcov/rcovtask.rb +21 -22
  34. data/lib/rcov/templates/detail.html.erb +64 -0
  35. data/lib/rcov/templates/index.html.erb +93 -0
  36. data/lib/rcov/templates/jquery-1.3.2.min.js +19 -0
  37. data/lib/rcov/templates/jquery.tablesorter.min.js +15 -0
  38. data/lib/rcov/templates/print.css +12 -0
  39. data/lib/rcov/templates/rcov.js +42 -0
  40. data/lib/rcov/templates/screen.css +270 -0
  41. data/lib/rcov/version.rb +5 -8
  42. data/setup.rb +5 -2
  43. data/test/{sample_01.rb → assets/sample_01.rb} +0 -0
  44. data/test/{sample_02.rb → assets/sample_02.rb} +0 -0
  45. data/test/{sample_03.rb → assets/sample_03.rb} +0 -0
  46. data/test/{sample_04.rb → assets/sample_04.rb} +0 -0
  47. data/test/{sample_05-new.rb → assets/sample_05-new.rb} +0 -0
  48. data/test/{sample_05-old.rb → assets/sample_05-old.rb} +0 -0
  49. data/test/{sample_05.rb → assets/sample_05.rb} +0 -0
  50. data/test/{test_CallSiteAnalyzer.rb → call_site_analyzer_test.rb} +57 -81
  51. data/test/{test_CodeCoverageAnalyzer.rb → code_coverage_analyzer_test.rb} +71 -35
  52. data/test/{test_FileStatistics.rb → file_statistics_test.rb} +34 -36
  53. data/test/{test_functional.rb → functional_test.rb} +21 -35
  54. metadata +91 -69
  55. data/CHANGES +0 -177
  56. data/LEGAL +0 -36
  57. data/README.API +0 -42
  58. data/README.emacs +0 -64
  59. data/README.en +0 -130
  60. data/README.rake +0 -62
  61. data/README.rant +0 -68
  62. data/README.vim +0 -47
  63. data/Rantfile +0 -76
  64. data/ext/rcovrt/callsite.c +0 -242
  65. data/ext/rcovrt/rcovrt.c +0 -329
  66. data/lib/rcov/rant.rb +0 -87
  67. data/lib/rcov/report.rb +0 -1236
  68. data/mingw-rbconfig.rb +0 -174
data/CHANGES DELETED
@@ -1,177 +0,0 @@
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 DELETED
@@ -1,36 +0,0 @@
1
-
2
- LEGAL NOTICE
3
- ------------
4
-
5
- rcov itself is subject to the terms specified in LICENSE.
6
-
7
- rcov includes (in the DATA area) xx-0.1.0, which can be redistributed
8
- and used under the 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/README.API DELETED
@@ -1,42 +0,0 @@
1
-
2
- = +rcov+
3
-
4
- +rcov+ is a:
5
- 1. tool for code coverage analysis for Ruby
6
- 2. library for collecting code coverage and execution count information
7
- introspectively
8
-
9
- If you want to use the command line tool, the output from
10
- rcov -h
11
- is self-explicative.
12
-
13
- If you want to automate the execution of +rcov+ via Rake or Rant, take a look at
14
- README.rake[link:files/README_rake.html] or
15
- README.rant[link:files/README_rant.html], respectively.
16
-
17
- If you want to use the associated library, read on.
18
-
19
- == Usage of the +rcov+ runtime/library
20
-
21
- +rcov+ is primarily a tool for code coverage analysis, but since 0.4.0 it
22
- exposes some of its code so that you can build on top of its heuristics for
23
- code analysis and its capabilities for coverage information and execution
24
- count gathering.
25
-
26
- The main classes of interest are Rcov::FileStatistics,
27
- Rcov::CodeCoverageAnalyzer and Rcov::CallSiteAnalyzer.
28
-
29
- Rcov::FileStatistics can use some heuristics to determine
30
- which parts of the file are executable and which are mere comments.
31
-
32
- Rcov::CodeCoverageAnalyzer is used to gather code coverage and execution
33
- count information inside a running Ruby program.
34
-
35
- Rcov::CallSiteAnalyzer is used to obtain information about where methods are
36
- defined and who calls them.
37
-
38
- The parts of +rcov+'s runtime meant to be reused (i.e. the external API) are
39
- documented with RDoc. Those not meant to be used are clearly marked as so or
40
- were deliberately removed from the present documentation.
41
-
42
-
data/README.emacs DELETED
@@ -1,64 +0,0 @@
1
-
2
- <tt>rcov.el</tt> allows you to use rcov from Emacs conveniently.
3
- * Run unit tests and jump to uncovered code by <tt>C-x `</tt>.
4
- * Run unit tests and save the current coverage status.
5
- * Run unit tests and jump to uncovered code introduced since the last run.
6
- * View cross-reference annotated code.
7
-
8
- == Installation
9
-
10
- Copy <tt>rcov.el</tt> to the appropriate directory, which is in load-path.
11
- Then require it.
12
- (require 'rcov)
13
-
14
-
15
- == Usage
16
-
17
- There are some commands to run rcov in Emacs.
18
- All of them displays +rcov+ window, whose major-mode is compilation-mode.
19
- Therefore you can jump to uncovered code by <tt>C-x `</tt>.
20
-
21
- +rcov-command-line+, +rcovsave-command-line+, and +rcovdiff-command-line+ define
22
- command line to run rcov.
23
- If you do not use +rcov+ from Rake, you must modify them.
24
-
25
- === Finding uncovered code
26
-
27
- Type the following while editing your program:
28
- M-x rcov
29
-
30
- === Setting the reference point
31
-
32
- +rcov+'s <tt>--text-coverage-diff</tt> mode compares the current coverage status against
33
- the saved one. It therefore needs that information to be recorded
34
- before you write new code (typically right after you perform a commit) in
35
- order to have something to compare against.
36
-
37
- You can save the current status with the <tt>--save</tt> option.
38
-
39
- Type the following to save the current status in Emacs:
40
- M-x rcovsave
41
- If you do not use +rcov+ from Rake, you must modify +rcovsave-command-line+ variable.
42
-
43
- === Finding new uncovered code
44
-
45
- Type the following to save the current status in Emacs:
46
- M-x rcovdiff
47
-
48
- === Viewing cross-reference annotated code
49
-
50
- If you read cross-reference annotated code, issue
51
- rake rcov RCOVOPTS='-a'
52
- at the beginning.
53
- This command creates +coverage+ directory and many *.rb files in it.
54
- Filenames of these Ruby scripts are converted from original path.
55
- You can browse them by normally <tt>C-x C-f</tt>.
56
- You can think of <tt>-a</tt> option as <tt>--xrefs</tt> option and output format is Ruby script.
57
-
58
- After find-file-ed annotated script, the major-mode is rcov-xref-mode,
59
- which is derived from ruby-mode and specializes navigation.
60
-
61
- <tt>Tab</tt> and <tt>M-Tab</tt> goes forward/backward links.
62
- <tt>Ret</tt> follows selected link.
63
-
64
- This feature is useful to read third-party code or to follow control flow.
data/README.en DELETED
@@ -1,130 +0,0 @@
1
- rcov copyright (c) 2004-2006 Mauricio Fernandez <mfp@acm.org>
2
- rcov includes xx 0.1.0, copyright (c) 2005, ePark Labs, Inc. and contributors
3
-
4
- rcov README
5
- ============
6
-
7
- rcov is a code coverage tool for Ruby. It is commonly used for viewing
8
- overall test coverage of target code. It features:
9
- * fast execution: 20-300 times faster than previous tools
10
- * multiple analysis modes: standard, bogo-profile, "intentional testing",
11
- dependency analysis...
12
- * detection of uncovered code introduced since the last run ("differential
13
- code coverage")
14
- * fairly accurate coverage information through code linkage inference using
15
- simple heuristics
16
- * cross-referenced XHTML and several kinds of text reports
17
- * support for easy automation with Rake and Rant
18
- * colorblind-friendliness
19
-
20
- Requirements
21
- ------------
22
-
23
- * Ruby 1.8
24
- * (recommended) C compiler: you can also use rcov without the rcovrt
25
- extension but rcov will be two orders of magnitude slower. The extension
26
- requires Ruby 1.8.3 or later.
27
- If you're on win32, you can find a pre-built rcovrt extension at
28
- http://eigenclass.org/hiki.rb?rcov
29
-
30
-
31
- Normal install
32
- --------------
33
-
34
- De-compress the archive and enter its top directory.
35
- Then type:
36
-
37
- ($ su)
38
- # ruby setup.rb
39
-
40
- This simple step installs rcov under the default location for Ruby
41
- libraries. You can also customize the installation by supplying some
42
- options to setup.rb.
43
- Try "ruby setup.rb --help".
44
-
45
- A normal (rcovrt-enabled) install requires Ruby >= 1.8.3 and a working C
46
- toolchain; if you cannot compile Ruby extensions proceed as described below.
47
-
48
- If you're on win32, you can find a pre-built rcovrt extension at
49
- http://eigenclass.org/hiki.rb?rcov
50
-
51
- You might have to install a "development package" (often named ruby-dev or
52
- ruby1.8-dev), or alternatively build ruby from the sources, if the compiler
53
- cannot find the headers (ruby.h and friends).
54
-
55
- Install without the rcovrt extension
56
- ------------------------------------
57
-
58
- ($su )
59
- # ruby setup.rb all --without-ext
60
-
61
- will install rcov without building the rcovrt extension.
62
-
63
- Usage
64
- -----
65
-
66
- In the common scenario, your tests are under test/ and the target code
67
- (whose coverage you want) is in lib/. In that case, all you have to do is
68
- use rcov to run the tests (instead of testrb), and a number of XHTML files
69
- with the code coverage information will be generated, e.g.
70
-
71
- rcov -Ilib test/*.rb
72
-
73
- will execute all the .rb files under test/ and generate the code coverage
74
- report for the target code (i.e. for the files in lib/) under coverage/. The
75
- target code needs not be under lib/; rcov will detect is as long as it is
76
- require()d by the tests. rcov is smart enough to ignore "uninteresting"
77
- files: the tests themselves, files installed in Ruby's standard locations,
78
- etc. See rcov --help for the list of regexps rcov matches filenames
79
- against.
80
-
81
- rcov can also be used from Rake; see README.rake or the RDoc documentation
82
- for more information. The Rakefile included in rcov's sources holds a few
83
- tasks that run rcov on itself, producing a number of reports. You can try
84
- rake rcov
85
- preferably after a full install or
86
- ruby setup.rb config
87
- ruby setup.rb setup
88
- so that the rcovrt extension can be used to speed up the process.
89
- This will generate a cross-referenced XHTML report under coverage/.
90
-
91
- rcov can output information in several formats, and perform different kinds
92
- of analyses in addition to plain code coverage. See rcov --help for a
93
- description of the available options.
94
-
95
- License
96
- -------
97
-
98
- rcov is licensed under the same terms as Ruby. See LICENSE.
99
- rcov includes a copy of the xx library, which carries the following
100
- copyright notice:
101
-
102
- ePark Labs Public License version 1
103
- Copyright (c) 2005, ePark Labs, Inc. and contributors
104
- All rights reserved.
105
-
106
- Redistribution and use in source and binary forms, with or without modification,
107
- are permitted provided that the following conditions are met:
108
-
109
- 1. Redistributions of source code must retain the above copyright notice, this
110
- list of conditions and the following disclaimer.
111
- 2. Redistributions in binary form must reproduce the above copyright notice,
112
- this list of conditions and the following disclaimer in the documentation
113
- and/or other materials provided with the distribution.
114
- 3. Neither the name of ePark Labs nor the names of its contributors may be
115
- used to endorse or promote products derived from this software without
116
- specific prior written permission.
117
-
118
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
119
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
120
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
121
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
122
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
123
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
124
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
125
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
127
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
128
-
129
-
130
- Mauricio Fernandez <mfp@acm.org>