github.com/drone/runner-go@v1.12.0/shell/shell_test.go (about)

     1  // Copyright 2019 Drone.IO Inc. All rights reserved.
     2  // Use of this source code is governed by the Polyform License
     3  // that can be found in the LICENSE file.
     4  
     5  // +build !windows
     6  
     7  package shell
     8  
     9  import (
    10  	"reflect"
    11  	"testing"
    12  )
    13  
    14  func TestCommands(t *testing.T) {
    15  	cmd, args := Command()
    16  	{
    17  		got, want := cmd, "/bin/sh"
    18  		if !reflect.DeepEqual(got, want) {
    19  			t.Errorf("Want command %v, got %v", want, got)
    20  		}
    21  	}
    22  	{
    23  		got, want := args, []string{"-e"}
    24  		if !reflect.DeepEqual(got, want) {
    25  			t.Errorf("Want command %v, got %v", want, got)
    26  		}
    27  	}
    28  }
    29  
    30  func TestScript(t *testing.T) {
    31  	got, want := Script([]string{"go build", "go test"}), exampleScript
    32  	if got != want {
    33  		t.Errorf("Want %q, got %q", want, got)
    34  	}
    35  }
    36  
    37  var exampleScript = `
    38  set -e
    39  
    40  echo + "go build"
    41  go build
    42  
    43  echo + "go test"
    44  go test
    45  `