16
16
package configuration
17
17
18
18
import (
19
+ "os"
19
20
"testing"
20
21
21
22
"github.com/arduino/arduino-check/configuration/checkmode"
@@ -24,12 +25,15 @@ import (
24
25
"github.com/arduino/arduino-check/util/test"
25
26
"github.com/arduino/go-paths-helper"
26
27
"github.com/stretchr/testify/assert"
28
+ "github.com/stretchr/testify/require"
27
29
)
28
30
29
31
func TestInitialize (t * testing.T ) {
30
32
flags := test .ConfigurationFlags ()
31
33
32
- projectPaths := []string {"/foo" }
34
+ projectPath , err := os .Getwd ()
35
+ require .Nil (t , err )
36
+ projectPaths := []string {projectPath }
33
37
34
38
flags .Set ("format" , "foo" )
35
39
assert .Error (t , Initialize (flags , projectPaths ))
@@ -125,8 +129,8 @@ func TestInitialize(t *testing.T) {
125
129
assert .Nil (t , Initialize (flags , projectPaths ))
126
130
assert .Equal (t , reportFilePath , ReportFilePath ())
127
131
128
- reportFilePath = paths .New ("/baz" )
129
- projectPaths = []string {reportFilePath .String ()}
130
132
assert .Nil (t , Initialize (flags , projectPaths ))
131
- assert .Equal (t , reportFilePath , TargetPath ())
133
+ assert .Equal (t , paths .New (projectPaths [0 ]), TargetPath ())
134
+
135
+ assert .Error (t , Initialize (flags , []string {"/nonexistent" }))
132
136
}
0 commit comments