github.com/greenboxal/deis@v1.12.1/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  	t.Parallel()
    11  
    12  	paths := []string{"$HOME/foo/bar", "~/foo/bar"}
    13  	expected := os.Getenv("HOME") + "/foo/bar"
    14  	for _, path := range paths {
    15  		resolved := ResolvePath(path)
    16  		if resolved != expected {
    17  			t.Errorf("Test failed: expected %s, got %s", expected, resolved)
    18  		}
    19  	}
    20  }