Function toCoverageFile

Converts a .lst file content to a CoveredFile structure

CoveredFile toCoverageFile (
  string content,
  string packagePath
);

Example

should convert a .lst file to CoveredFile structure

auto result = `       |/++
     |  The main runner logic. You can find here some LifeCycle logic and test runner
     |  initalization
     |+/
     |module trial.runner;
     |
     |  /// Send the begin run event to all listeners
     |  void begin(ulong testCount) {
   23|    lifecycleListeners.each!(a => a.begin(testCount));
     |  }
lifecycle/trial/runner.d is 74% covered
`.toCoverageFile(buildPath(getcwd, "lifecycle/trial"));

result.path.should.equal("lifecycle/trial/runner.d");
result.isInCurrentProject.should.equal(true);
result.moduleName.should.equal("trial.runner");
result.coveragePercent.should.equal(74);
result.lines.length.should.equal(10);
result.lines[0].code.should.equal("/++");
result.lines[9].code.should.equal("  }");

Example

should mark the trial_.d file as external file

auto result = `trial_package.d is 74% covered
`.toCoverageFile(buildPath(getcwd, "lifecycle/trial"));

result.isInCurrentProject.should.equal(false);