ruby-coverage 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 420658ecf7eaba010ff32a306f8b815d9bbff44aa298e013525ff9d8a824783b
4
- data.tar.gz: 1fa3fdb480edcc4c34281d26a64f9d96fe655d49fa2329b14a7e93b91ef794d0
3
+ metadata.gz: 93f33127bec2d7de586f680a5acf8f503b36aa8e7ee2df6eea853e92ebd729ae
4
+ data.tar.gz: aa04f0bba17db2605b2a6991f5d74d77ca298a4683f191314f40498c829bab7e
5
5
  SHA512:
6
- metadata.gz: b82b95ce1e7691d91ab98983f46eaa6e936681a299dc81720aced4cb8399ae145adb44b0921cc208b2da88cb5250886e28748435733e92b3d90bd30288b6bb00
7
- data.tar.gz: 65889110740406d87938f686382d1e6f3209a21fc18e427f7f1eb7086bb5e7b9ccd42049506f149e964e20d5ee28bbff429a4a7357c55bed50ba2d04f91818cc
6
+ metadata.gz: '0517386659ee37d81045946119c8a4bbbdccbe7d529e1345cb8316d15e47886a8da4674bbe968aedd4ffdebe2d77b5cea502b73c29e091af65894f0f3e7418e4'
7
+ data.tar.gz: 3c52e2649e49a8d92a42c484249b5c91c918901bceb534757c61590c07765484a789b357460b904828ffec2b0e86c00900d7a6f31a0013c4cfedc162af59cbc2
checksums.yaml.gz.sig CHANGED
Binary file
data/ext/extconf.rb CHANGED
@@ -27,7 +27,7 @@ if ENV.key?("RUBY_SANITIZE")
27
27
  $LDFLAGS << " -fsanitize=address -fsanitize=undefined"
28
28
  end
29
29
 
30
- have_func("rb_tracearg_instruction_sequence", "ruby/debug.h")
30
+ have_func("rb_tracearg_instruction_sequence((rb_trace_arg_t *)0)", "ruby/debug.h")
31
31
 
32
32
  create_header
33
33
 
@@ -291,9 +291,6 @@ static void Ruby_Coverage_Tracer_on_line(VALUE data, const rb_trace_arg_t *trace
291
291
 
292
292
  static VALUE Ruby_Coverage_Tracer_start(VALUE self)
293
293
  {
294
- struct Ruby_Coverage_Tracer *tracer;
295
- TypedData_Get_Struct(self, struct Ruby_Coverage_Tracer, &Ruby_Coverage_Tracer_type, tracer);
296
-
297
294
  #ifdef HAVE_RB_TRACEARG_INSTRUCTION_SEQUENCE
298
295
  rb_add_event_hook2(
299
296
  (rb_event_hook_func_t)Ruby_Coverage_Tracer_on_script_compiled,
@@ -302,6 +299,9 @@ static VALUE Ruby_Coverage_Tracer_start(VALUE self)
302
299
  RUBY_EVENT_HOOK_FLAG_SAFE | RUBY_EVENT_HOOK_FLAG_RAW_ARG
303
300
  );
304
301
  #else
302
+ struct Ruby_Coverage_Tracer *tracer;
303
+ TypedData_Get_Struct(self, struct Ruby_Coverage_Tracer, &Ruby_Coverage_Tracer_type, tracer);
304
+
305
305
  if (NIL_P(tracer->script_compiled_tracepoint)) {
306
306
  RB_OBJ_WRITE(self, &tracer->script_compiled_tracepoint,
307
307
  rb_tracepoint_new(Qnil, RUBY_EVENT_SCRIPT_COMPILED,
@@ -7,6 +7,6 @@
7
7
  module Ruby
8
8
  # @namespace
9
9
  module Coverage
10
- VERSION = "0.1.1"
10
+ VERSION = "0.1.2"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -8,7 +8,7 @@ A native reimplementation of Ruby's built-in `Coverage` module, backed by `rb_ad
8
8
 
9
9
  Ruby's built-in `Coverage` module ties its counter store to the ISeq. When a file is re-evaluated under the same path — for example when a test framework loads a file into a fresh anonymous module via `module_eval` — Ruby allocates a fresh counter array and discards the previous one. Any coverage accumulated before the re-eval is lost.
10
10
 
11
- `Ruby::Coverage` owns its own counter store. Re-evaluating a file under the same path simply continues incrementing the same counters. The `covered` gem can optionally use `Ruby::Coverage` in place of `::Coverage` to get correct results in test suites that load files multiple times.
11
+ `Ruby::Coverage` owns its own counter store. Re-evaluating a file under the same path simply continues incrementing the same counters, which gives path-oriented reporting tools stable results when test suites load files multiple times. In addition, multiple `Ruby::Coverage::Tracer` instances can be active at the same time, so tools can collect independent coverage streams such as per-test coverage without fighting over Ruby's global `Coverage` state.
12
12
 
13
13
  ## Usage
14
14
 
@@ -16,56 +16,61 @@ Please see the [project documentation](https://socketry.github.io/ruby-coverage/
16
16
 
17
17
  - [Getting Started](https://socketry.github.io/ruby-coverage/guides/getting-started/index) - This guide explains how to use `ruby-coverage` to collect coverage for code that may be evaluated multiple times under the same path.
18
18
 
19
- ### Drop-in module API
19
+ ## Releases
20
20
 
21
- ``` ruby
22
- require "ruby/coverage"
21
+ Please see the [project releases](https://socketry.github.io/ruby-coverage/releases/index) for all releases.
23
22
 
24
- Ruby::Coverage.start
23
+ ### v0.1.2
25
24
 
26
- # ... run code ...
25
+ - Fix native extension builds on Windows when `rb_tracearg_instruction_sequence` is not declared by Ruby's public headers, and avoid an unused variable compiler warning.
27
26
 
28
- result = Ruby::Coverage.result
29
- # => { "/path/to/file.rb" => { lines: [nil, 3, 1, nil, 0, ...] }, ... }
30
- ```
27
+ ### v0.1.1
31
28
 
32
- ### Low-level `Tracer`
29
+ - Fix an unused variable compiler warning in the native extension.
33
30
 
34
- `Ruby::Coverage::Tracer` is the primitive that the module API is built on. It accepts a block that is called once each time execution enters a new file. The block receives the absolute path and must return a Ruby `Array` to use as the line-count store for that file, or `nil` to skip tracking it.
31
+ ### v0.1.0
35
32
 
36
- The block controls the caching strategy: returning the same `Array` for the same path accumulates counts across re-evals; returning a fresh `Array` each time gives per-ISeq isolation.
33
+ - Improve line-count performance by resizing coverage count arrays in one step.
34
+ - Improve the line-count hot path by updating the internal count array directly while keeping counts as saturated Fixnums.
35
+ - Support accumulating coverage counts independently of Ruby's standard `Coverage` module.
36
+ - Use raw trace arguments for line coverage where available.
37
+ - Add benchmark coverage for tracer load and hot-loop overhead, including comparisons with Ruby's standard `Coverage` module.
38
+ - Improve test coverage around count preparation and subprocess coverage collection.
37
39
 
38
- ``` ruby
39
- files = {}
40
+ ### v0.0.1
40
41
 
41
- tracer = Ruby::Coverage::Tracer.new do |path|
42
- # Accumulate across re-evals of the same path:
43
- files[path] ||= []
44
- end
42
+ - Initial release.
45
43
 
46
- tracer.start
47
- # ... run tests ...
48
- tracer.stop
44
+ ## Contributing
49
45
 
50
- # files is now populated with line-count arrays keyed by path.
51
- ```
46
+ We welcome contributions to this project.
47
+
48
+ 1. Fork it.
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
50
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
51
+ 4. Push to the branch (`git push origin my-new-feature`).
52
+ 5. Create new Pull Request.
52
53
 
53
- ## Integration with `covered`
54
+ ### Running Tests
54
55
 
55
- `covered` multiplexes between `Ruby::Coverage` and `::Coverage` internally. Add `ruby-coverage` to your `Gemfile` and `covered` will prefer it automatically.
56
+ To run the test suite:
56
57
 
57
- ``` ruby
58
- # gems.rb / Gemfile
59
- gem "ruby-coverage"
60
- gem "covered"
58
+ ``` shell
59
+ bundle exec sus
61
60
  ```
62
61
 
63
- ## Releases
62
+ ### Making Releases
64
63
 
65
- Please see the [project releases](https://socketry.github.io/ruby-coverage/releases/index) for all releases.
64
+ To make a new release:
66
65
 
67
- ### v0.0.1
66
+ ``` shell
67
+ bundle exec bake gem:release:patch # or minor or major
68
+ ```
69
+
70
+ ### Developer Certificate of Origin
71
+
72
+ In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
68
73
 
69
- ## See Also
74
+ ### Community Guidelines
70
75
 
71
- - [covered](https://github.com/socketry/covered) the coverage reporting gem that uses this library.
76
+ This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
data/releases.md CHANGED
@@ -1,3 +1,22 @@
1
1
  # Releases
2
2
 
3
+ ## v0.1.2
4
+
5
+ - Fix native extension builds on Windows when `rb_tracearg_instruction_sequence` is not declared by Ruby's public headers, and avoid an unused variable compiler warning.
6
+
7
+ ## v0.1.1
8
+
9
+ - Fix an unused variable compiler warning in the native extension.
10
+
11
+ ## v0.1.0
12
+
13
+ - Improve line-count performance by resizing coverage count arrays in one step.
14
+ - Improve the line-count hot path by updating the internal count array directly while keeping counts as saturated Fixnums.
15
+ - Support accumulating coverage counts independently of Ruby's standard `Coverage` module.
16
+ - Use raw trace arguments for line coverage where available.
17
+ - Add benchmark coverage for tracer load and hot-loop overhead, including comparisons with Ruby's standard `Coverage` module.
18
+ - Improve test coverage around count preparation and subprocess coverage collection.
19
+
3
20
  ## v0.0.1
21
+
22
+ - Initial release.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-coverage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file