github.com/blend/go-sdk@v1.20220411.3/filelock/main_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package filelock_test
     9  
    10  import (
    11  	"runtime"
    12  	"testing"
    13  )
    14  
    15  // HasExec reports whether the current system can start new processes
    16  // using os.StartProcess or (more commonly) exec.Command.
    17  func HasExec() bool {
    18  	switch runtime.GOOS {
    19  	case "js", "ios":
    20  		return false
    21  	}
    22  	return true
    23  }
    24  
    25  // MustHaveExec checks that the current system can start new processes
    26  // using os.StartProcess or (more commonly) exec.Command.
    27  // If not, MustHaveExec calls t.Skip with an explanation.
    28  func MustHaveExec(t testing.TB) {
    29  	if !HasExec() {
    30  		t.Skipf("skipping test: cannot exec subprocess on %s/%s", runtime.GOOS, runtime.GOARCH)
    31  	}
    32  }