RCov 开始分析加载的库(包括 Rdoc 本身)–使用rvm(Ruby版本管理器)时

发布于 2024-09-05 05:29:03 字数 1887 浏览 2 评论 0原文

上下文

文件

测试设置是一个“lib”文件夹,其中包含一个定义类的文件,文件夹“test”和“test/sub_test”,其中“sub_test”包含单个“test_example_lib.rb”和一个如下的 Rakefile:

require 'rcov/rcovtask'

task :default => [:rcov]

desc "RCov"
Rcov::RcovTask.new do | t |
    t.test_files = FileList[ 'test/**/test_*.rb' ]
end

结果

#rake
(in /Users/stephan/tmp/rcov_example)
rm -r coverage
Loaded suite /Users/stephan/.rvm/gems/ruby-1.8.7-p174/bin/rcov
Started
.
Finished in 0.000508 seconds.

1 tests, 2 assertions, 0 failures, 0 errors
+----------------------------------------------------+-------+-------+--------+
|                  File                              | Lines |  LOC  |  COV   |
+----------------------------------------------------+-------+-------+--------+
|...ms/rcov-0.9.8/lib/rcov/code_coverage_analyzer.rb |   271 |   156 |   5.1% |
|...ems/rcov-0.9.8/lib/rcov/differential_analyzer.rb |   116 |    82 |   9.8% |
|lib/example_lib.rb                                  |    16 |    11 |  72.7% |
+----------------------------------------------------+-------+-------+--------+
|Total                                               |   403 |   249 |   9.6% |
+----------------------------------------------------+-------+-------+--------+
9.6%   3 file(s)   403 Lines   249 LOC

问题

为什么 RCov 本身是分析到这里? 我希望如此(使用“rvm use system”时不会发生这种情况)。 事实上,这似乎是因为我使用了通过 rvm 安装的 Ruby。

Context

  • rcov 0.9.8 2010-02-28
  • ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.3.0]
  • rvm 0.1.38 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]
  • System Ruby (rvm use system): ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10]

Files

The test setup is a 'lib' folder containing a single file which defines a class, the folders 'test' and 'test/sub_test', with 'sub_test' containing the single 'test_example_lib.rb' and a Rakefile like this:

require 'rcov/rcovtask'

task :default => [:rcov]

desc "RCov"
Rcov::RcovTask.new do | t |
    t.test_files = FileList[ 'test/**/test_*.rb' ]
end

Result

#rake
(in /Users/stephan/tmp/rcov_example)
rm -r coverage
Loaded suite /Users/stephan/.rvm/gems/ruby-1.8.7-p174/bin/rcov
Started
.
Finished in 0.000508 seconds.

1 tests, 2 assertions, 0 failures, 0 errors
+----------------------------------------------------+-------+-------+--------+
|                  File                              | Lines |  LOC  |  COV   |
+----------------------------------------------------+-------+-------+--------+
|...ms/rcov-0.9.8/lib/rcov/code_coverage_analyzer.rb |   271 |   156 |   5.1% |
|...ems/rcov-0.9.8/lib/rcov/differential_analyzer.rb |   116 |    82 |   9.8% |
|lib/example_lib.rb                                  |    16 |    11 |  72.7% |
+----------------------------------------------------+-------+-------+--------+
|Total                                               |   403 |   249 |   9.6% |
+----------------------------------------------------+-------+-------+--------+
9.6%   3 file(s)   403 Lines   249 LOC

Question

Why is RCov itself analysed here?
I'd expect that (and it doesn't happen when using 'rvm use system').
In fact it seems to be due to me using a Ruby installed via rvm.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧竹 2024-09-12 05:29:03

在 rcov 中添加一些排除:

--exclude /gems/,/Library/,/usr/,spec,lib/tasks

require 'rcov/rcovtask'

task :default => [:rcov]

desc "RCov"
Rcov::RcovTask.new do | t |
    t.test_files = FileList[ 'test/**/test_*.rb' ]
    t.rcov_opts << '--exclude /gems/,/Library/,/usr/,spec,lib/tasks'
end

Add some exclusion in rcov :

--exclude /gems/,/Library/,/usr/,spec,lib/tasks

require 'rcov/rcovtask'

task :default => [:rcov]

desc "RCov"
Rcov::RcovTask.new do | t |
    t.test_files = FileList[ 'test/**/test_*.rb' ]
    t.rcov_opts << '--exclude /gems/,/Library/,/usr/,spec,lib/tasks'
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文