github.com/spg/deis@v1.7.3/deisctl/utils/utils_test.go (about)

     1  package utils
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  )
     7  
     8  // TestResolvePath ensures ResolvePath replaces $HOME and ~ as expected
     9  func TestResolvePath(t *testing.T) {
    10  	paths := []string{"$HOME/foo/bar", "~/foo/bar"}
    11  	expected := os.Getenv("HOME") + "/foo/bar"
    12  	for _, path := range paths {
    13  		resolved := ResolvePath(path)
    14  		if resolved != expected {
    15  			t.Errorf("Test failed: expected %s, got %s", expected, resolved)
    16  		}
    17  	}
    18  }