-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared_test.go
More file actions
40 lines (33 loc) · 753 Bytes
/
shared_test.go
File metadata and controls
40 lines (33 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main_test
import (
"math/rand"
"os"
"path/filepath"
. "github.com/stroiman/muxify"
)
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
func randStringRunes(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = letterRunes[rand.Intn(len(letterRunes))]
}
return string(b)
}
func CreateRandomName() string {
return randStringRunes(10)
}
func CreateRandomProjectName() string {
return "project-" + CreateRandomName()
}
func MustCreateTestServer() TmuxServer {
wd, err := os.Getwd()
if err != nil {
panic(err)
}
configFile := filepath.Join(wd, "tmux.conf")
socketName := "test-socket-" + CreateRandomName()
return TmuxServer{
SocketName: socketName,
ConfigFile: configFile,
}
}