@@ -71,6 +71,8 @@ func TestDetermineBuildPathAndSketchName(t *testing.T) {
7171 fqbn , err := cores .ParseFQBN ("arduino:samd:mkr1000" )
7272 require .NoError (t , err )
7373
74+ srv := NewArduinoCoreServer ().(* arduinoCoreServerImpl )
75+
7476 tests := []test {
7577 // 00: error: no data passed in
7678 {"" , "" , nil , nil , "<nil>" , "" },
@@ -81,7 +83,7 @@ func TestDetermineBuildPathAndSketchName(t *testing.T) {
8183 // 03: error: used both importPath and importFile
8284 {"testdata/upload/build_path_2/Blink.ino.hex" , "testdata/upload/build_path_2" , nil , nil , "<nil>" , "" },
8385 // 04: only sketch without FQBN
84- {"" , "" , blonk , nil , blonk . DefaultBuildPath ( ).String (), "Blonk.ino" },
86+ {"" , "" , blonk , nil , srv . getDefaultSketchBuildPath ( blonk , nil ).String (), "Blonk.ino" },
8587 // 05: use importFile to detect build.path and project_name, sketch is ignored.
8688 {"testdata/upload/build_path_2/Blink.ino.hex" , "" , blonk , nil , "testdata/upload/build_path_2" , "Blink.ino" },
8789 // 06: use importPath as build.path and Blink as project name, ignore the sketch Blonk
@@ -97,7 +99,7 @@ func TestDetermineBuildPathAndSketchName(t *testing.T) {
9799 // 11: error: used both importPath and importFile
98100 {"testdata/upload/build_path_2/Blink.ino.hex" , "testdata/upload/build_path_2" , nil , fqbn , "<nil>" , "" },
99101 // 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" },
101103 // 13: use importFile to detect build.path and project_name, sketch+fqbn is ignored.
102104 {"testdata/upload/build_path_2/Blink.ino.hex" , "" , blonk , fqbn , "testdata/upload/build_path_2" , "Blink.ino" },
103105 // 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) {
111113 }
112114 for i , test := range tests {
113115 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 )
115117 if test .resBuildPath == "<nil>" {
116118 require .Error (t , err )
117119 require .Nil (t , buildPath )
@@ -183,10 +185,11 @@ func TestUploadPropertiesComposition(t *testing.T) {
183185 pme , release := pm .NewExplorer ()
184186 defer release ()
185187
188+ srv := NewArduinoCoreServer ().(* arduinoCoreServerImpl )
186189 testRunner := func (t * testing.T , test test , verboseVerify bool ) {
187190 outStream := & bytes.Buffer {}
188191 errStream := & bytes.Buffer {}
189- _ , err := runProgramAction (
192+ _ , err := srv . runProgramAction (
190193 context .Background (),
191194 pme ,
192195 nil , // sketch
0 commit comments