github.com/wunderio/silta-cli@v0.0.0-20240508100559-3017e4ab3a20/tests/build_test.go (about)

     1  package cmd_test
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"os/exec"
     7  	"testing"
     8  )
     9  
    10  func TestBuild(t *testing.T) {
    11  
    12  	// Go to main directory
    13  	wd, _ := os.Getwd()
    14  	os.Chdir("..")
    15  
    16  	out, err := exec.Command("bash", "-c", "make build").CombinedOutput()
    17  	fmt.Printf("Output: %s\n", out)
    18  	if err != nil {
    19  		fmt.Printf("Could not make binary for %s: %v", cliBinaryName, err)
    20  		os.Exit(1)
    21  	}
    22  
    23  	// Change dir back to previous
    24  	os.Chdir(wd)
    25  }