@@ -231,3 +231,47 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
231
231
232
232
require .Equal (t , expectedOutput , strings .Replace (context [constants .CTX_CTAGS_OUTPUT ].(string ), "\r \n " , "\n " , - 1 ))
233
233
}
234
+
235
+ func TestCTagsRunnerSketchWithTemplates (t * testing.T ) {
236
+ DownloadCoresAndToolsAndLibraries (t )
237
+
238
+ context := make (map [string ]interface {})
239
+
240
+ buildPath := SetupBuildPath (t , context )
241
+ defer os .RemoveAll (buildPath )
242
+
243
+ sketchLocation := Abs (t , filepath .Join ("sketch_with_templates_and_shift" , "template_and_shift.cpp" ))
244
+ context [constants .CTX_HARDWARE_FOLDERS ] = []string {filepath .Join (".." , "hardware" ), "hardware" , "downloaded_hardware" }
245
+ context [constants .CTX_TOOLS_FOLDERS ] = []string {"downloaded_tools" }
246
+ context [constants .CTX_FQBN ] = "arduino:avr:leonardo"
247
+ context [constants .CTX_SKETCH_LOCATION ] = sketchLocation
248
+ context [constants .CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION ] = "10600"
249
+ context [constants .CTX_BUILT_IN_LIBRARIES_FOLDERS ] = []string {"downloaded_libraries" }
250
+ context [constants .CTX_OTHER_LIBRARIES_FOLDERS ] = []string {"libraries" }
251
+ context [constants .CTX_VERBOSE ] = true
252
+
253
+ commands := []types.Command {
254
+ & builder.SetupHumanLoggerIfMissing {},
255
+
256
+ & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
257
+
258
+ & builder.ContainerMergeCopySketchFiles {},
259
+
260
+ & builder.ContainerFindIncludes {},
261
+
262
+ & builder.PrintUsedLibrariesIfVerbose {},
263
+ & builder.WarnAboutArchIncompatibleLibraries {},
264
+ & builder.CTagsTargetFileSaver {SourceField : constants .CTX_SOURCE , TargetFileName : constants .FILE_CTAGS_TARGET },
265
+ & ctags.CTagsRunner {},
266
+ }
267
+
268
+ for _ , command := range commands {
269
+ err := command .Run (context )
270
+ NoError (t , err )
271
+ }
272
+
273
+ sketchLocation = strings .Replace (sketchLocation , "\\ " , "\\ \\ " , - 1 )
274
+ expectedOutput := "printGyro\t " + sketchLocation + "\t /^void printGyro()$/;\" \t kind:function\t line:8\t signature:()\t returntype:void\n "
275
+
276
+ require .Equal (t , expectedOutput , strings .Replace (context [constants .CTX_CTAGS_OUTPUT ].(string ), "\r \n " , "\n " , - 1 ))
277
+ }
0 commit comments