rcov 0.8.0.2-mswin32 → 0.8.1.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/BLURB CHANGED
@@ -1,8 +1,6 @@
1
1
 
2
2
  Source code, additional information, screenshots... available at
3
- http://eigenclass.org/hiki.rb?rcov
4
- Release information:
5
- http://eigenclass.org/hiki.rb?rcov-0.8.0
3
+ http://eigenclass.org/hiki/rcov
6
4
 
7
5
  If you're on win32, you can also find a pre-built rcovrt.so (which makes
8
6
  code coverage analysis >100 times faster) in the above-mentioned pages.
data/CHANGES CHANGED
@@ -1,6 +1,23 @@
1
1
 
2
2
  User-visible changes.
3
3
 
4
+ Since 0.8.0 (2007-02-28)
5
+ ========================
6
+ Features
7
+ --------
8
+ * you can use an existent data file to generate coverage reports without
9
+ having to execute your code again
10
+ * --spec-only: only consider cover code executed inside a spec
11
+ (tested with RSpec 1.0.5, 1.0.8)
12
+ * --charset can be used to specify the charset in the Content-Type declaration
13
+
14
+ Bugfixes
15
+ --------
16
+ * workaround for bugs in Safari, IE (self-closing anchors break colorization)
17
+ * workaround for bugs in REXML shipped with 1.8.6-p110
18
+ * rethrow exceptions generated by traced scripts
19
+ * compatibility with Ruby < 1.8.5
20
+
4
21
  Since 0.7.0 (2006-08-04)
5
22
  ========================
6
23
  Features
data/Rakefile CHANGED
@@ -87,7 +87,7 @@ Rake::RDocTask.new("rdoc") { |rdoc|
87
87
 
88
88
  require 'rcov/version'
89
89
 
90
- PKG_REVISION = ".2"
90
+ PKG_REVISION = ".0"
91
91
  PKG_FILES = FileList[
92
92
  "bin/rcov",
93
93
  "lib/**/*.rb",
data/THANKS CHANGED
@@ -63,6 +63,28 @@ rubikitch:
63
63
  * testing, refactoring...
64
64
  * many other things, see darcs changes
65
65
 
66
-
67
66
  Zed A. Shaw:
68
67
  * reported and fixed segfault triggered by rspec
68
+
69
+ Lee Marlow:
70
+ * patch allowing to run rcov against a data file with no input code
71
+
72
+ Kurt Stephens:
73
+ * patch to rethrow any exceptions generated by the traced scripts after
74
+ report generation; notably SystemExit, allowing to use the exit code from
75
+ test runners under rake.
76
+
77
+ Brian Candler:
78
+ * found compatibility issues with the REXML lib included in ruby-1.8.6-p110
79
+ and provided a workaround
80
+
81
+ Mat Schaffer:
82
+ * reported missing line colorization on Safari and probably other browsers,
83
+ owing to self-closing <a> not being handled properly despite being valid
84
+ XHTML 1.0.
85
+
86
+ Sam Granieri:
87
+ * tested workaround for REXML bug
88
+
89
+ Kosmas Schütz, Daniel Berger, François Beausoleil, Bil Kleb:
90
+ * provided information about the ruby-1.8.6-p11[01] REXML problems
data/bin/rcov CHANGED
@@ -45,6 +45,7 @@ options.include = []
45
45
  options.html = true
46
46
  options.comments_run_by_default = false
47
47
  options.test_unit_only = false
48
+ options.spec_only = false
48
49
  options.sort = :name
49
50
  options.sort_reverse = false
50
51
  options.output_threshold = 101
@@ -59,6 +60,7 @@ options.report_cov_bug_for = nil
59
60
  options.aggregate_file = nil
60
61
  options.gcc_output = false
61
62
  options.show_validator_links = true
63
+ options.charset = nil
62
64
 
63
65
  EXTRA_HELP = <<-EOF
64
66
 
@@ -99,9 +101,13 @@ EOF
99
101
  options.comments_run_by_default = comments_run_p
100
102
  end
101
103
  opts.on("--test-unit-only",
102
- "Only trace code executed in TestCases.") do
104
+ "Only trace code executed inside TestCases.") do
103
105
  options.test_unit_only = true
104
106
  end
107
+ opts.on("--spec-only",
108
+ "Only trace code executed inside RSpec specs.") do
109
+ options.spec_only = true
110
+ end
105
111
  opts.on("-n", "--no-color", "Create colorblind-safe output.") do
106
112
  options.color = false
107
113
  end
@@ -230,6 +236,10 @@ EOF
230
236
  end
231
237
  options.output_threshold = threshold
232
238
  end
239
+ opts.on("--charset CHARSET",
240
+ "Charset used in Content-Type declaration of HTML reports.") do |c|
241
+ options.charset = c
242
+ end
233
243
  opts.on("--[no-]validator-links", "Add link to W3C's validation services.",
234
244
  "(default: true)") do |show_validator_links|
235
245
  options.show_validator_links = show_validator_links
@@ -300,7 +310,7 @@ rescue OptionParser::InvalidOption, OptionParser::InvalidArgument,
300
310
  exit(-1)
301
311
  end
302
312
  options.destdir ||= "coverage"
303
- unless ARGV[0]
313
+ unless ARGV[0] or options.aggregate_file && File.file?(options.aggregate_file)
304
314
  puts opts
305
315
  exit
306
316
  end
@@ -365,7 +375,8 @@ make_formatter = lambda do |klass|
365
375
  :diff_cmd => options.diff_cmd,
366
376
  :comments_run_by_default => options.comments_run_by_default,
367
377
  :gcc_output => options.gcc_output,
368
- :validator_links => options.show_validator_links
378
+ :validator_links => options.show_validator_links,
379
+ :charset => options.charset
369
380
  )
370
381
  end
371
382
 
@@ -398,6 +409,11 @@ end
398
409
  $rcov_code_coverage_analyzer ||= Rcov::CodeCoverageAnalyzer.new
399
410
 
400
411
  # must be registered before test/unit puts its own
412
+
413
+
414
+ # The exception to rethrow after reporting has been handled.
415
+ $__rcov_exit_exception = nil
416
+
401
417
  END {
402
418
  $rcov_code_coverage_analyzer.remove_hook
403
419
  $rcov_callsite_analyzer.remove_hook if $rcov_callsite_analyzer
@@ -468,6 +484,8 @@ You can solve this by doing one or more of the following:
468
484
  documentation or README.rake in the source distribution).
469
485
  EOF
470
486
  end
487
+
488
+ raise $__rcov_exit_exception if $__rcov_exit_exception
471
489
  }
472
490
 
473
491
  if options.test_unit_only
@@ -501,11 +519,20 @@ if options.test_unit_only
501
519
  end
502
520
  end
503
521
  end
522
+ elsif options.spec_only
523
+ require 'spec'
524
+ class Spec::DSL::Example
525
+ oldrun = instance_method(:run)
526
+ define_method(:run) do |*args|
527
+ $rcov_code_coverage_analyzer.run_hooked { oldrun.bind(self).call(*args) }
528
+ end
529
+ end
504
530
  else
505
531
  $rcov_code_coverage_analyzer.install_hook
506
532
  end
507
533
 
508
534
  #{{{ Load scripts
535
+ begin
509
536
  pending_scripts = ARGV.clone
510
537
  ARGV.replace extra_args
511
538
  until pending_scripts.empty?
@@ -515,7 +542,9 @@ until pending_scripts.empty?
515
542
  end
516
543
  load prog
517
544
  end
518
-
545
+ rescue Object => err
546
+ $__rcov_exit_exception = err
547
+ end
519
548
 
520
549
  # xx-0.1.0-1 follows
521
550
  __END__
data/lib/rcov.rb CHANGED
@@ -590,6 +590,18 @@ class CodeCoverageAnalyzer < DifferentialAnalyzer
590
590
  refine_coverage_info(@script_lines__[filename], raw_data[filename])
591
591
  end
592
592
 
593
+ # Data for the first file matching the given regexp.
594
+ # See #data.
595
+ def data_matching(filename_re)
596
+ raw_data = raw_data_relative
597
+ update_script_lines__
598
+
599
+ match = raw_data.keys.sort.grep(filename_re).first
600
+ return nil unless match
601
+
602
+ refine_coverage_info(@script_lines__[match], raw_data[match])
603
+ end
604
+
593
605
  # Execute the code in the given block, monitoring it in order to gather
594
606
  # information about which code was executed.
595
607
  def run_hooked; super end
data/lib/rcov/report.rb CHANGED
@@ -4,6 +4,28 @@
4
4
  require 'pathname'
5
5
  module Rcov
6
6
 
7
+ # Try to fix bug in the REXML shipped with Ruby 1.8.6
8
+ # This affects Mac OSX 10.5.1 users and motivates endless bug reports.
9
+ if RUBY_VERSION == "1.8.6" && defined? REXML
10
+ class REXML::Document
11
+ def write( output=$stdout, indent=-1, trans=false, ie_hack=false )
12
+ if xml_decl.encoding != "UTF-8" && !output.kind_of?(Output)
13
+ output = Output.new( output, xml_decl.encoding )
14
+ end
15
+ formatter = if indent > -1
16
+ if trans
17
+ REXML::Formatters::Transitive.new( indent, ie_hack )
18
+ else
19
+ REXML::Formatters::Pretty.new( indent, ie_hack )
20
+ end
21
+ else
22
+ REXML::Formatters::Default.new( ie_hack )
23
+ end
24
+ formatter.write( self, output )
25
+ end
26
+ end
27
+ end
28
+
7
29
  class Formatter # :nodoc:
8
30
  require 'pathname'
9
31
  ignore_files = [
@@ -226,7 +248,17 @@ class FullTextReport < Formatter # :nodoc:
226
248
  puts "=" * 80
227
249
  puts filename
228
250
  puts "=" * 80
229
- SCRIPT_LINES__[filename].each_with_index do |line, i|
251
+ lines = SCRIPT_LINES__[filename]
252
+ unless lines
253
+ # try to get the source code from the global code coverage
254
+ # analyzer
255
+ re = /#{Regexp.escape(filename)}\z/
256
+ if $rcov_code_coverage_analyzer and
257
+ (data = $rcov_code_coverage_analyzer.data_matching(re))
258
+ lines = data[0]
259
+ end
260
+ end
261
+ (lines || []).each_with_index do |line, i|
230
262
  case @textmode
231
263
  when :counts
232
264
  puts "%-70s| %6d" % [line.chomp[0,70], fileinfo.counts[i]]
@@ -616,7 +648,7 @@ EOS
616
648
 
617
649
  DEFAULT_OPTS = {:color => false, :fsr => 30, :destdir => "coverage",
618
650
  :callsites => false, :cross_references => false,
619
- :validator_links => true
651
+ :validator_links => true, :charset => nil
620
652
  }
621
653
  def initialize(opts = {})
622
654
  options = DEFAULT_OPTS.clone.update(opts)
@@ -628,6 +660,7 @@ EOS
628
660
  @do_cross_references = options[:cross_references]
629
661
  @span_class_index = 0
630
662
  @show_validator_links = options[:validator_links]
663
+ @charset = options[:charset]
631
664
  end
632
665
 
633
666
  def execute
@@ -699,7 +732,7 @@ EOS
699
732
  [f.code_coverage, "coverage_code"]].each do |value, css_class|
700
733
  value *= 100
701
734
  td_ {
702
- table_(:cellpadding => 0, :cellspacing => 0, :align => "right") {
735
+ table_(:cellpadding => "0", :cellspacing => "0", :align => "right") {
703
736
  tr_ {
704
737
  td_ {
705
738
  tt_(:class => css_class) { "%3.1f%%" % value }
@@ -707,11 +740,11 @@ EOS
707
740
  }
708
741
  ivalue = value.round
709
742
  td_ {
710
- table_(:class => "percent_graph", :cellpadding => 0,
711
- :cellspacing => 0, :width => 100) {
743
+ table_(:class => "percent_graph", :cellpadding => "0",
744
+ :cellspacing => "0", :width => "100") {
712
745
  tr_ {
713
- td_(:class => "covered", :width => ivalue)
714
- td_(:class => "uncovered", :width => (100-ivalue))
746
+ td_(:class => "covered", :width => ivalue.to_s)
747
+ td_(:class => "uncovered", :width => (100-ivalue).to_s)
715
748
  }
716
749
  }
717
750
  }
@@ -740,6 +773,10 @@ EOS
740
773
  title = default_title
741
774
  output = xhtml_ { html_ {
742
775
  head_ {
776
+ if @charset
777
+ meta_("http-equiv".to_sym => "Content-Type",
778
+ :content => "text/html;charset=#{@charset}")
779
+ end
743
780
  title_{ title }
744
781
  style_(:type => "text/css") { t_{ "body { background-color: #{default_color}; }" } }
745
782
  style_(:type => "text/css") { CSS_PROLOG }
@@ -763,7 +800,7 @@ EOS
763
800
  p_ {
764
801
  a_(:href => "http://validator.w3.org/check/referer") {
765
802
  img_(:src => "http://www.w3.org/Icons/valid-xhtml11",
766
- :alt => "Valid XHTML 1.1!", :height => 31, :width => 88)
803
+ :alt => "Valid XHTML 1.1!", :height => "31", :width => "88")
767
804
  }
768
805
  a_(:href => "http://jigsaw.w3.org/css-validator/check/referer") {
769
806
  img_(:style => "border:0;width:88px;height:31px",
@@ -801,7 +838,7 @@ EOS
801
838
  end_of_span = "</span>"
802
839
  end
803
840
  end
804
- result += %[<a name="line#{i+1}" />] + (format_line % (i+1)) +
841
+ result += %[<a name="line#{i+1}"></a>] + (format_line % (i+1)) +
805
842
  " " + create_cross_refs(file.name, i+1, CGI.escapeHTML(line)) + "\n"
806
843
  last = spanclass
807
844
  end
@@ -877,6 +914,10 @@ EOS
877
914
  do_ctable = output_color_table?
878
915
  output = xhtml_ { html_ {
879
916
  head_ {
917
+ if @charset
918
+ meta_("http-equiv".to_sym => "Content-Type",
919
+ :content => "text/html;charset=#{@charset}")
920
+ end
880
921
  title_{ title }
881
922
  style_(:type => "text/css") { t_{ "body { background-color: #{default_color}; }" } }
882
923
  style_(:type => "text/css") { CSS_PROLOG }
@@ -910,7 +951,7 @@ EOS
910
951
  p_ {
911
952
  a_(:href => "http://validator.w3.org/check/referer") {
912
953
  img_(:src => "http://www.w3.org/Icons/valid-xhtml10",
913
- :alt => "Valid XHTML 1.0!", :height => 31, :width => 88)
954
+ :alt => "Valid XHTML 1.0!", :height => "31", :width => "88")
914
955
  }
915
956
  a_(:href => "http://jigsaw.w3.org/css-validator/check/referer") {
916
957
  img_(:style => "border:0;width:88px;height:31px",
@@ -1080,8 +1121,8 @@ class RubyAnnotation < Formatter # :nodoc:
1080
1121
  return linetext unless @callsite_analyzer && @do_callsites
1081
1122
  ref_blocks = []
1082
1123
  _get_defsites(ref_blocks, filename, lineno, linetext, ">>") do |ref|
1083
- ref.file.sub!(%r!^./!, '')
1084
1124
  if ref.file
1125
+ ref.file.sub!(%r!^./!, '')
1085
1126
  where = "at #{mangle_filename(ref.file)}:#{ref.line}"
1086
1127
  else
1087
1128
  where = "(C extension/core)"
data/lib/rcov/version.rb CHANGED
@@ -4,10 +4,10 @@
4
4
 
5
5
  module Rcov
6
6
 
7
- VERSION = "0.8.0"
8
- RELEASE_DATE = "2007-02-28"
7
+ VERSION = "0.8.1"
8
+ RELEASE_DATE = "2007-11-19"
9
9
  RCOVRT_ABI = [2,0,0]
10
- UPSTREAM_URL = "http://eigenclass.org/hiki.rb?rcov"
10
+ UPSTREAM_URL = "http://eigenclass.org/hiki/rcov"
11
11
 
12
12
  end
13
13
  # vi: set sw=2:
data/lib/rcovrt.so CHANGED
Binary file
@@ -26,12 +26,12 @@ $rcov --no-html --gcc --include-file=sample --exclude=rcov sample_05.rb > expect
26
26
  class TestFunctional < Test::Unit::TestCase
27
27
  @@dir = Pathname(__FILE__).expand_path.dirname
28
28
 
29
- def strip_time(str)
30
- str.sub(/Generated on.+$/, '')
29
+ def strip_variable_sections(str)
30
+ str.sub(/Generated on.+$/, '').sub(/Generated using the.+$/, '')
31
31
  end
32
32
 
33
33
  def cmp(file)
34
- content = lambda{|dir| strip_time(File.read(@@dir+dir+file))}
34
+ content = lambda{|dir| strip_variable_sections(File.read(@@dir+dir+file))}
35
35
  assert_equal(content["expected_coverage"], content["actual_coverage"])
36
36
  end
37
37
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.1
3
3
  specification_version: 1
4
4
  name: rcov
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.8.0.2
7
- date: 2007-02-28 00:00:00 +01:00
6
+ version: 0.8.1.0
7
+ date: 2007-11-19 00:00:00 +01:00
8
8
  summary: Code coverage analysis tool for Ruby
9
9
  require_paths:
10
10
  - lib
@@ -31,11 +31,11 @@ authors:
31
31
  files:
32
32
  - bin/rcov
33
33
  - lib/rcov.rb
34
- - lib/rcov/rcovtask.rb
35
- - lib/rcov/version.rb
36
34
  - lib/rcov/lowlevel.rb
35
+ - lib/rcov/version.rb
37
36
  - lib/rcov/rant.rb
38
37
  - lib/rcov/report.rb
38
+ - lib/rcov/rcovtask.rb
39
39
  - ext/rcovrt/extconf.rb
40
40
  - ext/rcovrt/rcovrt.c
41
41
  - ext/rcovrt/callsite.c
@@ -43,25 +43,25 @@ files:
43
43
  - LICENSE
44
44
  - Rakefile
45
45
  - Rantfile
46
- - README.en
47
46
  - README.rake
48
- - README.API
49
- - README.vim
50
47
  - README.rant
51
48
  - README.emacs
49
+ - README.en
50
+ - README.vim
51
+ - README.API
52
52
  - THANKS
53
- - test/sample_02.rb
54
- - test/sample_01.rb
53
+ - test/test_functional.rb
54
+ - test/test_FileStatistics.rb
55
55
  - test/sample_03.rb
56
- - test/sample_04.rb
56
+ - test/sample_05-new.rb
57
57
  - test/test_CodeCoverageAnalyzer.rb
58
- - test/test_FileStatistics.rb
58
+ - test/sample_04.rb
59
+ - test/sample_02.rb
60
+ - test/sample_05-old.rb
61
+ - test/sample_01.rb
59
62
  - test/turn_off_rcovrt.rb
60
63
  - test/test_CallSiteAnalyzer.rb
61
64
  - test/sample_05.rb
62
- - test/test_functional.rb
63
- - test/sample_05-new.rb
64
- - test/sample_05-old.rb
65
65
  - mingw-rbconfig.rb
66
66
  - rcov.vim
67
67
  - rcov.el
@@ -70,10 +70,10 @@ files:
70
70
  - CHANGES
71
71
  - lib/rcovrt.so
72
72
  test_files:
73
- - test/test_CodeCoverageAnalyzer.rb
73
+ - test/test_functional.rb
74
74
  - test/test_FileStatistics.rb
75
+ - test/test_CodeCoverageAnalyzer.rb
75
76
  - test/test_CallSiteAnalyzer.rb
76
- - test/test_functional.rb
77
77
  rdoc_options:
78
78
  - --main
79
79
  - README.API