@@ -133,3 +133,48 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
133133
134134 require .Equal (t , expectedOutput , strings .Replace (context [constants .CTX_CTAGS_OUTPUT ].(string ), "\r \n " , "\n " , - 1 ))
135135}
136+
137+ func TestCTagsRunnerSketchWithTypename (t * testing.T ) {
138+ DownloadCoresAndToolsAndLibraries (t )
139+
140+ context := make (map [string ]interface {})
141+
142+ buildPath := SetupBuildPath (t , context )
143+ defer os .RemoveAll (buildPath )
144+
145+ context [constants .CTX_HARDWARE_FOLDERS ] = []string {filepath .Join (".." , "hardware" ), "hardware" , "downloaded_hardware" }
146+ context [constants .CTX_TOOLS_FOLDERS ] = []string {"downloaded_tools" }
147+ context [constants .CTX_FQBN ] = "arduino:avr:leonardo"
148+ context [constants .CTX_SKETCH_LOCATION ] = filepath .Join ("sketch_with_typename" , "sketch.ino" )
149+ context [constants .CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION ] = "10600"
150+ context [constants .CTX_LIBRARIES_FOLDERS ] = []string {"libraries" , "downloaded_libraries" }
151+ context [constants .CTX_VERBOSE ] = true
152+
153+ commands := []types.Command {
154+ & builder.SetupHumanLoggerIfMissing {},
155+
156+ & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
157+
158+ & builder.ContainerMergeCopySketchFiles {},
159+
160+ & builder.ContainerFindIncludes {},
161+
162+ & builder.PrintUsedLibrariesIfVerbose {},
163+ & builder.WarnAboutArchIncompatibleLibraries {},
164+ & builder.CTagsTargetFileSaver {SourceField : constants .CTX_SOURCE },
165+ & builder.CTagsRunner {},
166+ }
167+
168+ for _ , command := range commands {
169+ err := command .Run (context )
170+ NoError (t , err )
171+ }
172+
173+ ctagsTempFileName := context [constants .CTX_CTAGS_TEMP_FILE_NAME ].(string )
174+ expectedOutput := "Foo\t " + ctagsTempFileName + "\t /^ struct Foo{$/;\" \t kind:struct\t line:3\n " +
175+ "setup\t " + ctagsTempFileName + "\t /^void setup() {$/;\" \t kind:function\t line:7\t signature:()\t returntype:void\n " +
176+ "loop\t " + ctagsTempFileName + "\t /^void loop() {}$/;\" \t kind:function\t line:11\t signature:()\t returntype:void\n " +
177+ "func\t " + ctagsTempFileName + "\t /^typename Foo<char>::Bar func(){$/;\" \t kind:function\t line:13\t signature:()\t returntype:Foo::Bar\n "
178+
179+ require .Equal (t , expectedOutput , strings .Replace (context [constants .CTX_CTAGS_OUTPUT ].(string ), "\r \n " , "\n " , - 1 ))
180+ }
0 commit comments