示例#1
0
function get_repo()
{
    $origin = get_origin();
    if (!preg_match('#^.*?[/:]([^/]+)/([^/]+)\\.git$#', $origin, $matches)) {
        printf("Don't know how to parse {$origin}\n");
        exit(1);
    }
    return $matches[2];
}
示例#2
0
function ok($pass, $test_name = '')
{
    global $_test_num;
    global $_num_failures;
    global $_num_skips;
    $_test_num++;
    if ($_num_skips) {
        $_num_skips--;
        return TRUE;
    }
    if (!empty($test_name) && $test_name[0] != '#') {
        $test_name = "- {$test_name}";
    }
    $origin = get_origin();
    $file = $origin['file'];
    $line = $origin['line'];
    if ($pass) {
        echo "ok {$_test_num} {$test_name}\n";
    } else {
        diag("    Failed test (at line {$line})");
        echo "not ok {$_test_num} {$test_name}\n";
        $_num_failures++;
    }
    return $pass;
}