Skip to content

Commit

Permalink
Showing 2 changed files with 20 additions and 3 deletions.
16 changes: 15 additions & 1 deletion main_test.go
Original file line number Diff line number Diff line change
@@ -4,13 +4,16 @@ package main

import (
"bytes"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"syscall"
"testing"

"regexp"

"github.com/elliotchance/c2go/util"
)

@@ -99,7 +102,8 @@ func TestIntegrationScripts(t *testing.T) {

// Check if both exit codes are zero (or non-zero)
if cProgram.isZero != goProgram.isZero {
t.Fatalf("Expected: %t, Got: %t", cProgram.isZero, goProgram.isZero)
t.Fatalf("Exit statuses did not match.\n" + util.ShowDiff(cProgram.stdout.String(), goProgram.stdout.String()))
// t.Fatalf("Expected: %t, Got: %t", cProgram.isZero, goProgram.isZero)
}

// Check stderr
@@ -111,6 +115,16 @@ func TestIntegrationScripts(t *testing.T) {
if cProgram.stdout.String() != goProgram.stdout.String() {
t.Fatalf(util.ShowDiff(cProgram.stdout.String(), goProgram.stdout.String()))
}

// Extact the number of tests run.
firstLine := strings.Split(goProgram.stdout.String(), "\n")[0]

matches := regexp.MustCompile(`1..(\d+)`).FindStringSubmatch(firstLine)
if len(matches) == 0 {
t.Fatalf("Test did not output tap: %s", file)
}

fmt.Println(file + " TAP TESTS: " + matches[1])
})
}
}
7 changes: 5 additions & 2 deletions tests/argv.c
Original file line number Diff line number Diff line change
@@ -5,11 +5,14 @@

int main(int argc, const char **argv)
{
plan(4);
plan(3);

is_eq(argc, 3);

is_streq(argv[0], "build/go.out");
// We cannot compare the zeroth argument becuase it will be different for C
// and Go.
// is_streq(argv[0], "build/go.out");

is_streq(argv[1], "some");
is_streq(argv[2], "args");

0 comments on commit 1d385d4

Please sign in to comment.