@@ -216,3 +216,50 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
216
216
217
217
require .Equal (t , expectedOutput , strings .Replace (ctx .CTagsOutput , "\r \n " , "\n " , - 1 ))
218
218
}
219
+
220
+ func TestCTagsRunnerSketchWithTemplates (t * testing.T ) {
221
+ DownloadCoresAndToolsAndLibraries (t )
222
+
223
+ sketchLocation := Abs (t , paths .New ("sketch_with_templates_and_shift" , "sketch_with_templates_and_shift.ino" ))
224
+
225
+ ctx := & types.Context {
226
+ HardwareDirs : paths .NewPathList (filepath .Join (".." , "hardware" ), "downloaded_hardware" ),
227
+ BuiltInToolsDirs : paths .NewPathList ("downloaded_tools" ),
228
+ BuiltInLibrariesDirs : paths .NewPathList ("downloaded_libraries" ),
229
+ OtherLibrariesDirs : paths .NewPathList ("libraries" ),
230
+ SketchLocation : sketchLocation ,
231
+ FQBN : parseFQBN (t , "arduino:avr:leonardo" ),
232
+ ArduinoAPIVersion : "10600" ,
233
+ Verbose : true ,
234
+ }
235
+
236
+ buildPath := SetupBuildPath (t , ctx )
237
+ defer buildPath .RemoveAll ()
238
+
239
+ commands := []types.Command {
240
+
241
+ & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
242
+
243
+ & builder.ContainerMergeCopySketchFiles {},
244
+
245
+ & builder.ContainerFindIncludes {},
246
+
247
+ & builder.PrintUsedLibrariesIfVerbose {},
248
+ & builder.WarnAboutArchIncompatibleLibraries {},
249
+ & builder.CTagsTargetFileSaver {Source : & ctx .Source , TargetFileName : "ctags_target.cpp" },
250
+ & builder.CTagsRunner {},
251
+ }
252
+
253
+ for _ , command := range commands {
254
+ err := command .Run (ctx )
255
+ NoError (t , err )
256
+ }
257
+
258
+ quotedSketchLocation := strings .Replace (sketchLocation .String (), "\\ " , "\\ \\ " , - 1 )
259
+ expectedOutput := "printGyro\t " + quotedSketchLocation + "\t /^void printGyro()$/;\" \t kind:function\t line:10\t signature:()\t returntype:void\n " +
260
+ "bVar\t " + quotedSketchLocation + "\t /^c< 8 > bVar;$/;\" \t kind:variable\t line:15\n " +
261
+ "aVar\t " + quotedSketchLocation + "\t /^c< 1<<8 > aVar;$/;\" \t kind:variable\t line:16\n " +
262
+ "func\t " + quotedSketchLocation + "\t /^template<int X> func( c< 1<<X> & aParam) {$/;\" \t kind:function\t line:18\t signature:( c< 1<<X> & aParam)\t returntype:template\n "
263
+
264
+ require .Equal (t , expectedOutput , strings .Replace (ctx .CTagsOutput , "\r \n " , "\n " , - 1 ))
265
+ }
0 commit comments