github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/ci/local_windows_test.go (about)

     1  package ci_test
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/quickfeed/quickfeed/ci"
     8  )
     9  
    10  func TestLocalWindows(t *testing.T) {
    11  	const (
    12  		cmd      = `printf "Hello World"`
    13  		expected = "Hello World"
    14  	)
    15  
    16  	out := runCmd(t, []string{cmd})
    17  
    18  	if expected != out {
    19  		t.Errorf("Have %#v want %#v", out, expected)
    20  	}
    21  }
    22  
    23  func runCmd(t *testing.T, cmds []string) string {
    24  	local := ci.Local{}
    25  	out, err := local.Run(context.Background(), &ci.Job{
    26  		Commands: cmds,
    27  	})
    28  	if err != nil {
    29  		t.Fatal(err)
    30  	}
    31  	return out
    32  }