github.com/dnephin/dobi@v0.15.0/config/mount_test.go (about)

     1  package config
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  	"testing"
     7  
     8  	"gotest.tools/v3/assert"
     9  )
    10  
    11  func TestResolveBind(t *testing.T) {
    12  	resolver := newFakeResolver(map[string]string{
    13  		"~/{FOO}/": "~/bar/",
    14  	})
    15  	mount := &MountConfig{
    16  		Bind: filepath.FromSlash("~/{FOO}/"),
    17  	}
    18  
    19  	res, err := mount.Resolve(resolver)
    20  	assert.NilError(t, err)
    21  	expected := filepath.Join(os.Getenv("HOME"), "bar")
    22  	assert.Equal(t, res.(*MountConfig).Bind, expected)
    23  }