るりまサーチ

最速Rubyリファレンスマニュアル検索!
28件ヒット [1-28件を表示] (0.021秒)
トップページ > クエリ:times[x] > クエリ:coverage[x]

別のキーワード

  1. _builtin times
  2. integer times
  3. process times
  4. times _builtin
  5. times

ライブラリ

クラス

キーワード

検索結果

coverage (38156.0)

カバレッジを測定するためのライブラリです。

...(1) require "coverage" で、ライブラリを読み込む。
(2) Coverage.start を実行し、測定を開始する。
(3) require や load で測定対象のファイルを実行する。
(4) Coverage.result や Coverage.peek_result で結果を確認する。

Coverage
.result は、...
...s = 0
10.times do |x|
s += x
end

if s == 45
p :ok
else
p :ng
end
//}

以下のようにして測定を行います。

//emlist[][ruby]{
require "coverage"
Coverage
.start
load "foo.rb"
p Coverage.result # => {"foo.rb"=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil]}
//}

この Coverage.result["f...
...oo.rb"] から得られる配列は各行の実行回数になっています。


=== カバレッジモードの指定

Ruby 2.5 以降では、Coverage.start の引数で、計測対象の種類を変更するモード機能があります。

==== linesカバレッジモード

linesカバレッ...

Coverage.line_stub(file) -> Array (17018.0)

行カバレッジの配列のスタブを返します。

...ます。

//emlist[foo.rb][ruby]{
s = 0
10.times do |x|
s += x
end

if s == 45
p :ok
else
p :ng
end
//}

このファイルに対して line_stub を実行すると、次のようになります。

//emlist[][ruby]{
require "coverage"
p Coverage.line_stub("foo.rb") #=> [0, 0, 0, nil, nil, 0...

NEWS for Ruby 2.5.0 (60.0)

NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...りました。
coerceがnilを返す場合、変換は不可能です。7688

* Process
* getrusage(2) が存在する場合 Process.#times の精度を改良しました 11952
* Process.last_status を追加。$? と同じです 14043

* Range
* Range.new no longer hides exce...
...igDecimal.ver
* BigDecimal#clone と BigDecimal#dup は新しいインスタンスを作らなくなりました。selfを返します。

* coverage
* ブランチカバレッジとメソッドカバレッジの計測をサポートしました 13901
この新機能と一緒にテ...
...す。
Coverage
.start に与えるオプションによって計測する対象を指定することができます。
//emlist[][ruby]{
Coverage
.start(lines: true, branches: true, methods: true)
//}
* Rubyで書かれたファイルをいくつか読み込んでから、Coverage.result...

NEWS for Ruby 3.0.0 (12.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...partitioning cold paths.
* Instance variables
* Eliminate some redundant checks.
* Skip checking a class and a object multiple times in a method when possible.
* Optimize accesses in some core classes like Hash and their subclasses.
* Method inlining support for some...
...e, and prints the analysis result in RBS format.
* Though it supports only a subset of the Ruby language yet, we will continuously improve the coverage of language features, analysis performance, and usability.

//emlist[][ruby]{
# test.rb
def foo(x)
if x > 10
x.to_s
else
nil
end
e...