@@ -71,6 +71,8 @@ func TestDetermineBuildPathAndSketchName(t *testing.T) {
71
71
fqbn , err := cores .ParseFQBN ("arduino:samd:mkr1000" )
72
72
require .NoError (t , err )
73
73
74
+ srv := NewArduinoCoreServer ().(* arduinoCoreServerImpl )
75
+
74
76
tests := []test {
75
77
// 00: error: no data passed in
76
78
{"" , "" , nil , nil , "<nil>" , "" },
@@ -81,7 +83,7 @@ func TestDetermineBuildPathAndSketchName(t *testing.T) {
81
83
// 03: error: used both importPath and importFile
82
84
{"testdata/upload/build_path_2/Blink.ino.hex" , "testdata/upload/build_path_2" , nil , nil , "<nil>" , "" },
83
85
// 04: only sketch without FQBN
84
- {"" , "" , blonk , nil , blonk . DefaultBuildPath ( ).String (), "Blonk.ino" },
86
+ {"" , "" , blonk , nil , srv . getDefaultSketchBuildPath ( blonk , nil ).String (), "Blonk.ino" },
85
87
// 05: use importFile to detect build.path and project_name, sketch is ignored.
86
88
{"testdata/upload/build_path_2/Blink.ino.hex" , "" , blonk , nil , "testdata/upload/build_path_2" , "Blink.ino" },
87
89
// 06: use importPath as build.path and Blink as project name, ignore the sketch Blonk
@@ -97,7 +99,7 @@ func TestDetermineBuildPathAndSketchName(t *testing.T) {
97
99
// 11: error: used both importPath and importFile
98
100
{"testdata/upload/build_path_2/Blink.ino.hex" , "testdata/upload/build_path_2" , nil , fqbn , "<nil>" , "" },
99
101
// 12: use sketch to determine project name and sketch+fqbn to determine build path
100
- {"" , "" , blonk , fqbn , blonk . DefaultBuildPath ( ).String (), "Blonk.ino" },
102
+ {"" , "" , blonk , fqbn , srv . getDefaultSketchBuildPath ( blonk , nil ).String (), "Blonk.ino" },
101
103
// 13: use importFile to detect build.path and project_name, sketch+fqbn is ignored.
102
104
{"testdata/upload/build_path_2/Blink.ino.hex" , "" , blonk , fqbn , "testdata/upload/build_path_2" , "Blink.ino" },
103
105
// 14: use importPath as build.path and Blink as project name, ignore the sketch Blonk, ignore fqbn
@@ -111,7 +113,7 @@ func TestDetermineBuildPathAndSketchName(t *testing.T) {
111
113
}
112
114
for i , test := range tests {
113
115
t .Run (fmt .Sprintf ("SubTest%02d" , i ), func (t * testing.T ) {
114
- buildPath , sketchName , err := determineBuildPathAndSketchName (test .importFile , test .importDir , test .sketch )
116
+ buildPath , sketchName , err := srv . determineBuildPathAndSketchName (test .importFile , test .importDir , test .sketch )
115
117
if test .resBuildPath == "<nil>" {
116
118
require .Error (t , err )
117
119
require .Nil (t , buildPath )
@@ -183,10 +185,11 @@ func TestUploadPropertiesComposition(t *testing.T) {
183
185
pme , release := pm .NewExplorer ()
184
186
defer release ()
185
187
188
+ srv := NewArduinoCoreServer ().(* arduinoCoreServerImpl )
186
189
testRunner := func (t * testing.T , test test , verboseVerify bool ) {
187
190
outStream := & bytes.Buffer {}
188
191
errStream := & bytes.Buffer {}
189
- _ , err := runProgramAction (
192
+ _ , err := srv . runProgramAction (
190
193
context .Background (),
191
194
pme ,
192
195
nil , // sketch
0 commit comments