github.com/sohaha/zlsgo@v1.7.13-0.20240501141223-10dd1a906f76/zutil/env_test.go (about)

     1  package zutil_test
     2  
     3  import (
     4  	"runtime"
     5  	"testing"
     6  
     7  	"github.com/sohaha/zlsgo"
     8  	"github.com/sohaha/zlsgo/zutil"
     9  )
    10  
    11  func TestOs(T *testing.T) {
    12  	t := zlsgo.NewTest(T)
    13  	osName := runtime.GOOS
    14  	t.Log(osName)
    15  	isWin := zutil.IsWin()
    16  	t.Log("isWin", isWin)
    17  	isLinux := zutil.IsLinux()
    18  	t.Log("isLinux", isLinux)
    19  	isMac := zutil.IsMac()
    20  	t.Log("isMac", isMac)
    21  }
    22  func TestEnv(T *testing.T) {
    23  	t := zlsgo.NewTest(T)
    24  	t.Log(zutil.Getenv("HOME"))
    25  	t.Log(zutil.Getenv("myos"))
    26  	t.Log(zutil.Getenv("我不存在", "66"))
    27  }
    28  
    29  func TestGOROOT(t *testing.T) {
    30  	t.Log(zutil.GOROOT())
    31  }