src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/shell/interact_unix_test.go (about)

     1  //go:build unix
     2  
     3  package shell
     4  
     5  import (
     6  	"path/filepath"
     7  	"testing"
     8  
     9  	"src.elv.sh/pkg/env"
    10  	"src.elv.sh/pkg/must"
    11  
    12  	. "src.elv.sh/pkg/prog/progtest"
    13  	"src.elv.sh/pkg/testutil"
    14  )
    15  
    16  func TestInteract_RCPath_Default(t *testing.T) {
    17  	home := setupCleanHomePaths(t)
    18  	testutil.Unsetenv(t, env.XDG_CONFIG_HOME)
    19  	must.WriteFile(
    20  		filepath.Join(home, ".config", "elvish", "rc.elv"), "echo hello new rc.elv")
    21  
    22  	Test(t, &Program{},
    23  		thatElvishInteract().WritesStdout("hello new rc.elv\n"),
    24  	)
    25  }
    26  
    27  func TestInteract_DBPath_Default(t *testing.T) {
    28  	sockPath := startDaemon(t)
    29  	home := setupCleanHomePaths(t)
    30  
    31  	Test(t, &Program{ActivateDaemon: fakeActivate(sockPath)},
    32  		thatElvishInteract().
    33  			WritesStderrContaining("db requested: "+
    34  				filepath.Join(home, ".local", "state", "elvish", "db.bolt")),
    35  	)
    36  }