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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58f32d0b3917b373713212f99cec0a6d205ce16c46f744169a202d284eb413e7
4
- data.tar.gz: b66f5175e13cacaed2a454f5d3e8449c04971fbbdfdf15fa28cf3ab46486ae0c
3
+ metadata.gz: 4b72bc8a2cb3795c9b240f61f4d65f2d147f4c9ce63115200b6900c0c176f4a7
4
+ data.tar.gz: 1e450d66f9dff150c7538a4e29586bb6dc10a3983ad11d7cf4ea0dcd625045aa
5
5
  SHA512:
6
- metadata.gz: eb761996f33000c60701075e727573303710ec5fde4639021788860c38942c899f889b4d6c8f05124dc7b1b3e1320c0bb59b4ce048695e87ca885b90d917404b
7
- data.tar.gz: 2b3efafdd32173f24d8b4b57ca26ce2b1cad85a800be76ae79af319da680efb08c6fcadef795b5db8baa002fb6344001556878954745c7ed8fa2fc0a179206cb
6
+ metadata.gz: 0fb3b30a00cb9b69e7400ba155576aa2cea483b1a9324f2b3b90201ad54ed742006a11843cff57b5e5d9e641793719ccb5f97206355f5d73e03b47af581b1565
7
+ data.tar.gz: a315a3cd4553e4468283317fe2745746e359bcde354469783f6a0686c0befb97c16f32a9620591d03569d0dbd6d38f5f140052f0c80294c794ced806539aa354
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ .covered.db
@@ -8,4 +8,12 @@ matrix:
8
8
  - rvm: 2.4
9
9
  - rvm: 2.5
10
10
  - rvm: 2.6
11
- env: COVERAGE=BriefSummary,Coveralls
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)
@@ -0,0 +1,7 @@
1
+ <% for @item in @items %>
2
+ <%= @item %>
3
+ <% end %>
4
+
5
+ <% if 1 == 2 %>
6
+ Math is broken.
7
+ <% end %>
@@ -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
- puts "Hello World"
5
+ trace_point.enable
3
6
 
4
- all_the_things = []
7
+ values = {foo: 10}
5
8
 
6
- if all_the_things.any?
7
- puts "I've got all the things"
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
+ ]}
@@ -1,6 +1,5 @@
1
1
 
2
-
3
- trace_point = TracePoint.new(:call, :line) do |trace|
2
+ trace_point = TracePoint.new(:call, :return, :line, :c_call, :c_return, :b_call, :b_return) do |trace|
4
3
  puts [trace.path, trace.lineno].join(":")
5
4
  end
6
5
 
@@ -27,21 +27,26 @@ module Covered
27
27
  def initialize(output)
28
28
  super(output)
29
29
 
30
- @trace = TracePoint.new(:line, :call, :c_call) do |event|
31
- if path = event.path
32
- @output.mark(path, event.lineno, 1)
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.enable
45
+ @trace&.enable
41
46
  end
42
47
 
43
48
  def disable
44
- @trace.disable
49
+ @trace&.disable
45
50
 
46
51
  super
47
52
  end
@@ -42,7 +42,8 @@ module Covered
42
42
  end
43
43
  end
44
44
  end
45
- rescue ArgumentError
45
+ rescue
46
+ warn "Script coverage disabled: #{$!}"
46
47
  @trace = nil
47
48
  end
48
49
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Covered
22
- VERSION = "0.11.0"
22
+ VERSION = "0.12.0"
23
23
  end
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.11.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-02-21 00:00:00.000000000 Z
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