Module: Coverage

### Home Classes Methods

### In Files

- lib/simplecov/jruby_fix.rb

### Methods

- ::__broken_result__
- ::result

### Class/Module Index

Quicksearch

- SimpleCov
- SimpleCov::ArrayFilter
- SimpleCov::ArrayMergeHelper
- SimpleCov::BlockFilter
- SimpleCov::CommandGuesser
- SimpleCov::Configuration
- SimpleCov::ExitCodes
- SimpleCov::FileList
- SimpleCov::Filter
- SimpleCov::Formatter
- SimpleCov::Formatter::MultiFormatter
- SimpleCov::Formatter::SimpleFormatter
- SimpleCov::HashMergeHelper
- SimpleCov::LastRun
- SimpleCov::Profiles
- SimpleCov::Railtie
- SimpleCov::Result
- SimpleCov::ResultMerger
- SimpleCov::SourceFile
- SimpleCov::SourceFile::Line
- SimpleCov::StringFilter
- SimpleCov::VERSION
- Coverage

No matching classes.

# Coverage

Coverage for JRuby < 1.7.0 does not work correctly

    - does not distinguish lines that cannot be executed
    - does (partial) coverage for files loaded before `Coverage.start`.
    - does not expand a path like `lib/../spec` to `spec`.

This monkey patches Coverage to address those issues

### Public Class Methods

__broken_result__() click to toggle source
Alias for: result
result() click to toggle source

    # File lib/simplecov/jruby_fix.rb, line 16
    def result # rubocop:disable Metrics/MethodLength
      fixed = {}
      __broken_result__.each do |path, executed_lines|
        next unless File.file? path

        covered_lines = executed_lines.dup

        process = lambda do |node|
          if node.node_type == NodeType::NEWLINENODE
            pos = node.position
            covered_lines[pos.line] ||= 0
          end
          node.child_nodes.each(&process)
        end

        process[JRuby.parse(File.read(path), path)]

        if (first = covered_lines.detect { |x| x }) && first > 0
          fixed[File.expand_path(path)] = covered_lines
        end
      end

      fixed
    end

Also aliased as: __broken_result__

[Validate]

Generated with the Darkfish Rdoc Generator 2.