Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions tap_test_engine/src/TAPTestEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ final class TAPTestEngine extends ArcanistUnitTestEngine {
public function run() {
$projectRoot = $this->getWorkingCopy()->getProjectRoot();
$command = $this->getConfigurationManager()->getConfigFromAnySource('unit.engine.tap.command');
$eol = $this->getConfigurationManager()->getConfigFromAnySource(
'unit.engine.tap.eol'
);

/**
* Specifying line endings via config is optional, so default to PHP_EOL if not specified.
*/
if (!$eol) {
$eol = PHP_EOL;
}

$future = new ExecFuture($command);
$future->setCWD(Filesystem::resolvePath($projectRoot));
Expand All @@ -17,16 +27,16 @@ public function run() {
} while (!$future->isReady());

list($error, $stdout, $stderr) = $future->resolve();
return $this->parseOutput($stdout);
return $this->parseOutput($stdout, $eol);
}

public function shouldEchoTestResults() {
return true;
}

private function parseOutput($output) {
private function parseOutput($output, $eol) {
$results = array();
$lines = explode(PHP_EOL, $output);
$lines = explode($eol, $output);

foreach($lines as $index => $line) {
preg_match('/^(not ok|ok)\s+\d+\s+-?(.*)/', $line, $matches);
Expand Down