8000 Fix End2End test for non-windows platforms by gjrtimmer · Pull Request #37 · alvaroloes/enumer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix End2End test for non-windows platforms #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
17 changes: 16 additions & 1 deletion endtoend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,24 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"
)

var (
// GOEXE defines the executable file name suffix (".exe" on Windows, "" on other systems).
// Must be defined here, cannot be read from ENVIRONMENT variables
GOEXE = ""
)

func init() {
// Set GOEXE for Windows platform
if runtime.GOOS == "windows" {
GOEXE = ".exe"
}
}

// This file contains a test that compiles and runs each program in testdata
// after generating the string method for its type. The rule is that for testdata/x.go
// we run stringer -type X and then compile and run the program. The resulting
Expand All @@ -31,8 +45,9 @@ func TestEndToEnd(t *testing.T) {
t.Fatal(err)
}
defer os.RemoveAll(dir)

// Create stringer in temporary directory.
stringer := filepath.Join(dir, "stringer.exe")
stringer := filepath.Join(dir, fmt.Sprintf("stringer%s", GOEXE))
err = run("go", "build", "-o", stringer)
if err != nil {
t.Fatalf("building stringer: %s", err)
Expand Down
0