org.jruby.Ruby.getCoverageData()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.jruby.Ruby.getCoverageData方法的一些代码示例,展示了Ruby.getCoverageData的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getCoverageData方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getCoverageData

Ruby.getCoverageData介绍

暂无

代码示例

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Zero out coverable lines as they're encountered
 */
public void coverLine(int i) {
  if (i < 0) return; // JRUBY-6868: why would there be negative line numbers?
  if (runtime.getCoverageData().isCoverageEnabled()) {
    if (coverage == null) {
      coverage = new Integer[i + 1];
    } else if (coverage.length <= i) {
      Integer[] newCoverage = new Integer[i + 1];
      System.arraycopy(coverage, 0, newCoverage, 0, coverage.length);
      coverage = newCoverage;
    }
    // zero means coverable, but not yet covered
    coverage[i] = 0;
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Zero out coverable lines as they're encountered
 */
public void coverLine(int i) {
  if (i < 0) return; // JRUBY-6868: why would there be negative line numbers?
  if (runtime.getCoverageData().isCoverageEnabled()) {
    if (coverage == null) {
      coverage = new Integer[i + 1];
    } else if (coverage.length <= i) {
      Integer[] newCoverage = new Integer[i + 1];
      System.arraycopy(coverage, 0, newCoverage, 0, coverage.length);
      coverage = newCoverage;
    }
    // zero means coverable, but not yet covered
    coverage[i] = 0;
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(module = true)
public static IRubyObject start(ThreadContext context, IRubyObject self) {
  Ruby runtime = context.runtime;
  
  if (!runtime.getCoverageData().isCoverageEnabled()) {
    runtime.getCoverageData().setCoverageEnabled(runtime, true);
  }
  
  return context.nil;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(module = true)
public static IRubyObject start(ThreadContext context, IRubyObject self) {
  Ruby runtime = context.runtime;
  
  if (!runtime.getCoverageData().isCoverageEnabled()) {
    runtime.getCoverageData().setCoverageEnabled(runtime, true);
  }
  
  return context.nil;
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(module = true)
public static IRubyObject start(ThreadContext context, IRubyObject self) {
  Ruby runtime = context.runtime;
  
  if (!runtime.getCoverageData().isCoverageEnabled()) {
    runtime.getCoverageData().setCoverageEnabled(runtime, true);
  }
  
  return context.nil;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(module = true)
public static IRubyObject start(ThreadContext context, IRubyObject self) {
  Ruby runtime = context.runtime;
  
  if (!runtime.getCoverageData().isCoverageEnabled()) {
    runtime.getCoverageData().setCoverageEnabled(runtime, true);
  }
  
  return context.nil;
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(module = true)
public static IRubyObject result(ThreadContext context, IRubyObject self) {
  Ruby runtime = context.runtime;
  
  if (!runtime.getCoverageData().isCoverageEnabled()) {
    throw runtime.newRuntimeError("coverage measurement is not enabled");
  }
  IRubyObject result = convertCoverageToRuby(context, runtime, runtime.getCoverageData().getCoverage());
  runtime.getCoverageData().resetCoverage(runtime);
  return result;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(module = true)
public static IRubyObject result(ThreadContext context, IRubyObject self) {
  Ruby runtime = context.runtime;
  
  if (!runtime.getCoverageData().isCoverageEnabled()) {
    throw runtime.newRuntimeError("coverage measurement is not enabled");
  }
  IRubyObject result = convertCoverageToRuby(context, runtime, runtime.getCoverageData().getCoverage());
  runtime.getCoverageData().resetCoverage(runtime);
  return result;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "running?", module = true)
public static IRubyObject running_p(ThreadContext context, IRubyObject self) {
  return context.runtime.getCoverageData().isCoverageEnabled() ? context.tru : context.fals;
}

代码示例来源:origin: org.jruby/jruby-complete

public boolean isCoverageEnabled() {
  return !isEvalParse() && runtime.getCoverageData().isCoverageEnabled();
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "running?", module = true)
public static IRubyObject running_p(ThreadContext context, IRubyObject self) {
  return context.runtime.getCoverageData().isCoverageEnabled() ? context.tru : context.fals;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(module = true)
public static IRubyObject peek_result(ThreadContext context, IRubyObject self) {
  Ruby runtime = context.runtime;
  if (!runtime.getCoverageData().isCoverageEnabled()) {
    throw runtime.newRuntimeError("coverage measurement is not enabled");
  }
  
  return convertCoverageToRuby(context, runtime, runtime.getCoverageData().getCoverage());
}

代码示例来源:origin: org.jruby/jruby-core

public boolean isCoverageEnabled() {
  return !isEvalParse() && runtime.getCoverageData().isCoverageEnabled();
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(module = true)
public static IRubyObject peek_result(ThreadContext context, IRubyObject self) {
  Ruby runtime = context.runtime;
  if (!runtime.getCoverageData().isCoverageEnabled()) {
    throw runtime.newRuntimeError("coverage measurement is not enabled");
  }
  
  return convertCoverageToRuby(context, runtime, runtime.getCoverageData().getCoverage());
}

代码示例来源:origin: org.jruby/jruby-complete

/**
 * At end of a parse if coverage is enabled we will do final processing
 * of the primitive coverage array and make sure runtimes coverage data
 * has been updated with this new data.
 */
public CoverageData finishCoverage(String file, int lines) {
  if (!isCoverageEnabled()) return null;
  growCoverageLines(lines);
  CoverageData data = runtime.getCoverageData();
  data.prepareCoverage(file, coverage);
  return data;
}

代码示例来源:origin: org.jruby/jruby-core

/**
 * At end of a parse if coverage is enabled we will do final processing
 * of the primitive coverage array and make sure runtimes coverage data
 * has been updated with this new data.
 */
public CoverageData finishCoverage(String file, int lines) {
  if (!isCoverageEnabled()) return null;
  growCoverageLines(lines);
  CoverageData data = runtime.getCoverageData();
  data.prepareCoverage(file, coverage);
  return data;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(module = true)
public static IRubyObject result(ThreadContext context, IRubyObject self) {
  Ruby runtime = context.runtime;
  
  if (!runtime.getCoverageData().isCoverageEnabled()) {
    throw runtime.newRuntimeError("coverage measurement is not enabled");
  }
  
  Map<String, Integer[]> coverage = runtime.getCoverageData().resetCoverage(runtime);
  
  // populate a Ruby Hash with coverage data
  RubyHash covHash = RubyHash.newHash(runtime);
  for (Map.Entry<String, Integer[]> entry : coverage.entrySet()) {
    RubyArray ary = RubyArray.newArray(runtime, entry.getValue().length);
    for (int i = 0; i < entry.getValue().length; i++) {
      Integer integer = entry.getValue()[i];
      ary.store(i, integer == null ? runtime.getNil() : runtime.newFixnum(integer));
      covHash.fastASetCheckString(runtime, RubyString.newString(runtime, entry.getKey()), ary);
    }
  }
  
  return covHash;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(module = true)
public static IRubyObject result(ThreadContext context, IRubyObject self) {
  Ruby runtime = context.runtime;
  
  if (!runtime.getCoverageData().isCoverageEnabled()) {
    throw runtime.newRuntimeError("coverage measurement is not enabled");
  }
  
  Map<String, Integer[]> coverage = runtime.getCoverageData().resetCoverage(runtime);
  
  // populate a Ruby Hash with coverage data
  RubyHash covHash = RubyHash.newHash(runtime);
  for (Map.Entry<String, Integer[]> entry : coverage.entrySet()) {
    RubyArray ary = RubyArray.newArray(runtime, entry.getValue().length);
    for (int i = 0; i < entry.getValue().length; i++) {
      Integer integer = entry.getValue()[i];
      ary.store(i, integer == null ? runtime.getNil() : runtime.newFixnum(integer));
      covHash.fastASetCheckString(runtime, RubyString.newString(runtime, entry.getKey()), ary);
    }
  }
  
  return covHash;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

if (runtime.getCoverageData().isCoverageEnabled()) {
  runtime.getCoverageData().prepareCoverage(file, configuration.getCoverage());

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

if (runtime.getCoverageData().isCoverageEnabled()) {
  runtime.getCoverageData().prepareCoverage(file, configuration.getCoverage());

相关文章

Ruby类方法