github.com/engineyard/workflow-cli@v2.21.6+incompatible/settings/home_unix_test.go (about)

     1  // +build linux darwin
     2  
     3  package settings
     4  
     5  import (
     6  	"os"
     7  	"testing"
     8  
     9  	"github.com/arschles/assert"
    10  )
    11  
    12  // TestFindHome ensures the correct home directory is returned by FindHome().
    13  func TestFindHome(t *testing.T) {
    14  	expectedHomeDir := "/d/e/f"
    15  	os.Setenv("HOME", expectedHomeDir)
    16  
    17  	assert.Equal(t, FindHome(), expectedHomeDir, "output")
    18  }
    19  
    20  // TestSetHome ensures the correct env vars are set when SetHome() is called.
    21  func TestSetHome(t *testing.T) {
    22  	homeDir := "/a/b/c"
    23  	SetHome(homeDir)
    24  
    25  	assert.Equal(t, os.Getenv("HOME"), homeDir, "output")
    26  }