github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/utils/which/which_test.go (about)

     1  package which
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/lmorg/murex/test/count"
     8  )
     9  
    10  func TestPath(t *testing.T) {
    11  	count.Tests(t, 1)
    12  
    13  	path := os.Getenv("PATH")
    14  	if path == "" {
    15  		t.Error("$PATH is empty. This will undoubtably cause problems running murex and will likely cause other tests to fail as well")
    16  	}
    17  }
    18  func TestWhich(t *testing.T) {
    19  	count.Tests(t, 1)
    20  
    21  	if Which("go") == "" {
    22  		t.Error("Which() couldn't find the `go` executable in your $PATH")
    23  		t.Log("$PATH: " + os.Getenv("PATH"))
    24  	}
    25  }