Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5e6feb4a20cc
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6cd4115290f9
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Mar 26, 2018

  1. Copy the full SHA
    d2c30bd View commit details
  2. Copy the full SHA
    6cd4115 View commit details
Showing with 17 additions and 0 deletions.
  1. +6 −0 core/src/main/java/org/jruby/ext/coverage/CoverageData.java
  2. +11 −0 test/jruby/test_coverage.rb
  3. BIN test/jruby/testapp/testapp
6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/ext/coverage/CoverageData.java
Original file line number Diff line number Diff line change
@@ -92,6 +92,12 @@ private boolean hasCodeBeenPartiallyCovered(int[] lines) {
public synchronized Map<String, int[]> prepareCoverage(String filename, int[] lines) {
assert lines != null;

if (filename == null) {
// null filename from certain evals, Ruby.executeScript, etc (jruby/jruby#5111)
// we opt to ignore scripts with no filename, since coverage means nothing
return coverage;
}

Map<String, int[]> coverage = this.coverage;

if (coverage != null) {
11 changes: 11 additions & 0 deletions test/jruby/test_coverage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'test/unit/testcase'
require 'coverage'

class TestCoverage < Test::Unit::TestCase
def test_coverage_handles_null_filename # jruby/jruby#5099
Coverage.start
JRuby.runtime.executeScript('1 + 1', nil)
assert_nothing_raised { Coverage.result }
end
end

Binary file added test/jruby/testapp/testapp
Binary file not shown.