@@ -21,7 +21,6 @@ import (
21
21
"path/filepath"
22
22
"testing"
23
23
24
- paths "github.com/arduino/go-paths-helper"
25
24
"github.com/stretchr/testify/require"
26
25
)
27
26
@@ -39,45 +38,6 @@ func tmpDirOrDie() string {
39
38
return dir
40
39
}
41
40
42
- func TestSearchConfigTreeNotFound (t * testing.T ) {
43
- tmp := tmpDirOrDie ()
44
- require .Empty (t , searchConfigTree (paths .New (tmp )))
45
- }
46
-
47
- func TestSearchConfigTreeSameFolder (t * testing.T ) {
48
- tmp := tmpDirOrDie ()
49
- defer os .RemoveAll (tmp )
50
- _ , err := os .Create (filepath .Join (tmp , "arduino-cli.yaml" ))
51
- require .Nil (t , err )
52
- require .Equal (t , tmp , searchConfigTree (paths .New (tmp )).String ())
53
- }
54
-
55
- func TestSearchConfigTreeInParent (t * testing.T ) {
56
- tmp := tmpDirOrDie ()
57
- defer os .RemoveAll (tmp )
58
- target := filepath .Join (tmp , "foo" , "bar" )
59
- err := os .MkdirAll (target , os .ModePerm )
60
- require .Nil (t , err )
61
- _ , err = os .Create (filepath .Join (tmp , "arduino-cli.yaml" ))
62
- require .Nil (t , err )
63
- require .Equal (t , tmp , searchConfigTree (paths .New (target )).String ())
64
- }
65
-
66
- var result * paths.Path
67
-
68
- func BenchmarkSearchConfigTree (b * testing.B ) {
69
- tmp := tmpDirOrDie ()
70
- defer os .RemoveAll (tmp )
71
- target := filepath .Join (tmp , "foo" , "bar" , "baz" )
72
- os .MkdirAll (target , os .ModePerm )
73
-
74
- var s * paths.Path
75
- for n := 0 ; n < b .N ; n ++ {
76
- s = searchConfigTree (paths .New (target ))
77
- }
78
- result = s
79
- }
80
-
81
41
func TestInit (t * testing.T ) {
82
42
tmp := tmpDirOrDie ()
83
43
defer os .RemoveAll (tmp )
@@ -100,16 +60,16 @@ func TestInit(t *testing.T) {
100
60
}
101
61
102
62
func TestFindConfigFile (t * testing.T ) {
103
- configFile := FindConfigFileInArgsOrWorkingDirectory ([]string {"--config-file" })
63
+ configFile := FindConfigFileInArgs ([]string {"--config-file" })
104
64
require .Equal (t , "" , configFile )
105
65
106
- configFile = FindConfigFileInArgsOrWorkingDirectory ([]string {"--config-file" , "some/path/to/config" })
66
+ configFile = FindConfigFileInArgs ([]string {"--config-file" , "some/path/to/config" })
107
67
require .Equal (t , "some/path/to/config" , configFile )
108
68
109
- configFile = FindConfigFileInArgsOrWorkingDirectory ([]string {"--config-file" , "some/path/to/config/arduino-cli.yaml" })
69
+ configFile = FindConfigFileInArgs ([]string {"--config-file" , "some/path/to/config/arduino-cli.yaml" })
110
70
require .Equal (t , "some/path/to/config/arduino-cli.yaml" , configFile )
111
71
112
- configFile = FindConfigFileInArgsOrWorkingDirectory ([]string {})
72
+ configFile = FindConfigFileInArgs ([]string {})
113
73
require .Equal (t , "" , configFile )
114
74
115
75
// Create temporary directories
@@ -124,14 +84,14 @@ func TestFindConfigFile(t *testing.T) {
124
84
require .Nil (t , err )
125
85
f .Close ()
126
86
127
- configFile = FindConfigFileInArgsOrWorkingDirectory ([]string {})
87
+ configFile = FindConfigFileInArgs ([]string {})
128
88
require .Equal (t , filepath .Join (tmp , "foo" , "arduino-cli.yaml" ), configFile )
129
89
130
90
// Create another config file
131
91
f , err = os .Create (filepath .Join (target , "arduino-cli.yaml" ))
132
92
require .Nil (t , err )
133
93
f .Close ()
134
94
135
- configFile = FindConfigFileInArgsOrWorkingDirectory ([]string {})
95
+ configFile = FindConfigFileInArgs ([]string {})
136
96
require .Equal (t , filepath .Join (target , "arduino-cli.yaml" ), configFile )
137
97
}
0 commit comments