covered 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +9 -1
- data/examples/coverage/erb/coverage.rb +21 -0
- data/examples/coverage/erb/template.erb +7 -0
- data/examples/coverage/test.rb +12 -4
- data/examples/coverage/tracepoint.rb +1 -2
- data/lib/covered/capture.rb +10 -5
- data/lib/covered/source.rb +2 -1
- data/lib/covered/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b72bc8a2cb3795c9b240f61f4d65f2d147f4c9ce63115200b6900c0c176f4a7
|
4
|
+
data.tar.gz: 1e450d66f9dff150c7538a4e29586bb6dc10a3983ad11d7cf4ea0dcd625045aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fb3b30a00cb9b69e7400ba155576aa2cea483b1a9324f2b3b90201ad54ed742006a11843cff57b5e5d9e641793719ccb5f97206355f5d73e03b47af581b1565
|
7
|
+
data.tar.gz: a315a3cd4553e4468283317fe2745746e359bcde354469783f6a0686c0befb97c16f32a9620591d03569d0dbd6d38f5f140052f0c80294c794ced806539aa354
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -8,4 +8,12 @@ matrix:
|
|
8
8
|
- rvm: 2.4
|
9
9
|
- rvm: 2.5
|
10
10
|
- rvm: 2.6
|
11
|
-
|
11
|
+
- rvm: 2.6
|
12
|
+
env: COVERAGE=PartialSummary,Coveralls
|
13
|
+
- rvm: ruby-head
|
14
|
+
- rvm: jruby-head
|
15
|
+
- rvm: truffleruby
|
16
|
+
allow_failures:
|
17
|
+
- rvm: ruby-head
|
18
|
+
- rvm: jruby-head
|
19
|
+
- rvm: truffleruby
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
require 'erb'
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
|
4
|
+
|
5
|
+
template_path = File.expand_path("template.erb", __dir__)
|
6
|
+
|
7
|
+
ENV['COVERAGE'] ||= 'PartialSummary'
|
8
|
+
require 'covered/policy/default'
|
9
|
+
|
10
|
+
$covered.enable
|
11
|
+
|
12
|
+
template = ERB.new(File.read(template_path)).tap do |template|
|
13
|
+
template.filename = template_path
|
14
|
+
end
|
15
|
+
|
16
|
+
@items = ["Cats", "Dogs", "Chickens"]
|
17
|
+
puts template.result(binding)
|
18
|
+
|
19
|
+
$covered.disable
|
20
|
+
|
21
|
+
$covered.call($stdout)
|
data/examples/coverage/test.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
|
+
trace_point = TracePoint.new(:call, :return, :line, :c_call, :c_return, :b_call, :b_return) do |trace|
|
2
|
+
puts [trace.path, trace.lineno].join(":")
|
3
|
+
end
|
1
4
|
|
2
|
-
|
5
|
+
trace_point.enable
|
3
6
|
|
4
|
-
|
7
|
+
values = {foo: 10}
|
5
8
|
|
6
|
-
|
7
|
-
|
9
|
+
def shell_escape(x)
|
10
|
+
x
|
8
11
|
end
|
12
|
+
|
13
|
+
values.map{|key, value| [
|
14
|
+
key.to_s.upcase,
|
15
|
+
shell_escape(value) # TracePoint is never triggered for this line.
|
16
|
+
]}
|
data/lib/covered/capture.rb
CHANGED
@@ -27,21 +27,26 @@ module Covered
|
|
27
27
|
def initialize(output)
|
28
28
|
super(output)
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
begin
|
31
|
+
@trace = TracePoint.new(:line, :call, :c_call) do |event|
|
32
|
+
if path = event.path
|
33
|
+
@output.mark(path, event.lineno, 1)
|
34
|
+
end
|
33
35
|
end
|
36
|
+
rescue
|
37
|
+
warn "Line coverage disabled: #{$!}"
|
38
|
+
@trace = nil
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
37
42
|
def enable
|
38
43
|
super
|
39
44
|
|
40
|
-
@trace
|
45
|
+
@trace&.enable
|
41
46
|
end
|
42
47
|
|
43
48
|
def disable
|
44
|
-
@trace
|
49
|
+
@trace&.disable
|
45
50
|
|
46
51
|
super
|
47
52
|
end
|
data/lib/covered/source.rb
CHANGED
data/lib/covered/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: covered
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -152,6 +152,8 @@ files:
|
|
152
152
|
- Rakefile
|
153
153
|
- covered.gemspec
|
154
154
|
- examples/coverage/covered.rb
|
155
|
+
- examples/coverage/erb/coverage.rb
|
156
|
+
- examples/coverage/erb/template.erb
|
155
157
|
- examples/coverage/parser.rb
|
156
158
|
- examples/coverage/simplecov.rb
|
157
159
|
- examples/coverage/test.rb
|