github.com/konsorten/ktn-build-info@v1.0.11/ver/go_test.go (about)

     1  package ver
     2  
     3  import (
     4  	"os"
     5  	"runtime"
     6  	"testing"
     7  
     8  	log "github.com/sirupsen/logrus"
     9  )
    10  
    11  func TestWriteGoSysoFiles(t *testing.T) {
    12  	log.SetLevel(log.DebugLevel)
    13  
    14  	// this feature works on windows, only
    15  	if runtime.GOOS != "windows" {
    16  		t.Logf("Skipping test, supported on Windows, only")
    17  		return
    18  	}
    19  
    20  	// change to test data dir
    21  	currDir, _ := os.Getwd()
    22  	os.Chdir("examples/go-build-test")
    23  	defer os.Chdir(currDir)
    24  
    25  	// get version
    26  	vi := createTestVersionInformationFromYAML(t)
    27  
    28  	// write files
    29  	err := WriteGoSysoFile(vi)
    30  
    31  	if err != nil {
    32  		t.Fatalf("Failed to write files: %v", err)
    33  	}
    34  }