@@ -2,7 +2,6 @@ package handler
2
2
3
3
import (
4
4
"errors"
5
- "fmt"
6
5
"os"
7
6
"path/filepath"
8
7
"testing"
@@ -15,13 +14,17 @@ func TestParseConfig(t *testing.T) {
15
14
projectDir1 := filepath .Join (tmpRoot , project1Name )
16
15
projectDir2 := filepath .Join (tmpRoot , project2Name )
17
16
projects := []string {projectDir1 , projectDir2 }
18
- os .Mkdir (projectDir1 , 0755 )
19
- os .Mkdir (projectDir2 , 0755 )
17
+ if err := os .Mkdir (projectDir1 , 0755 ); err != nil {
18
+ t .Errorf ("failed to make project1 directory" )
19
+ }
20
+ if err := os .Mkdir (projectDir2 , 0755 ); err != nil {
21
+ t .Errorf ("failed to make project2 directory" )
22
+ }
20
23
21
- configContent := fmt . Sprintf ( "default=%s" , tmpRoot )
24
+ configContent := "default=" + tmpRoot
22
25
23
26
tmpConfigFile := filepath .Join (tmpRoot , ".tmux-sessionizer" )
24
- if err := os .WriteFile (tmpConfigFile , []byte (configContent ), 0644 ); err != nil {
27
+ if err := os .WriteFile (tmpConfigFile , []byte (configContent ), 0600 ); err != nil {
25
28
t .Errorf ("failed to write config file: %v" , err )
26
29
}
27
30
@@ -73,7 +76,6 @@ func TestExpandPath(t *testing.T) {
73
76
},
74
77
}
75
78
for _ , tt := range tests {
76
- tt := tt
77
79
t .Run (tt .name , func (t * testing.T ) {
78
80
t .Parallel ()
79
81
sh := SessionHandler {}
0 commit comments