@@ -181,3 +181,48 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
181
181
182
182
require .Equal (t , expectedOutput , strings .Replace (context [constants .CTX_CTAGS_OUTPUT ].(string ), "\r \n " , "\n " , - 1 ))
183
183
}
184
+
185
+ func TestCTagsRunnerSketchWithNamespace (t * testing.T ) {
186
+ DownloadCoresAndToolsAndLibraries (t )
187
+
188
+ context := make (map [string ]interface {})
189
+
190
+ buildPath := SetupBuildPath (t , context )
191
+ defer os .RemoveAll (buildPath )
192
+
193
+ context [constants .CTX_HARDWARE_FOLDERS ] = []string {filepath .Join (".." , "hardware" ), "hardware" , "downloaded_hardware" }
194
+ context [constants .CTX_TOOLS_FOLDERS ] = []string {"downloaded_tools" }
195
+ context [constants .CTX_FQBN ] = "arduino:avr:leonardo"
196
+ context [constants .CTX_SKETCH_LOCATION ] = filepath .Join ("sketch_with_namespace" , "sketch.ino" )
197
+ context [constants .CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION ] = "10600"
198
+ context [constants .CTX_BUILT_IN_LIBRARIES_FOLDERS ] = []string {"downloaded_libraries" }
199
+ context [constants .CTX_OTHER_LIBRARIES_FOLDERS ] = []string {"libraries" }
200
+ context [constants .CTX_VERBOSE ] = true
201
+
202
+ commands := []types.Command {
203
+ & builder.SetupHumanLoggerIfMissing {},
204
+
205
+ & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
206
+
207
+ & builder.ContainerMergeCopySketchFiles {},
208
+
209
+ & builder.ContainerFindIncludes {},
210
+
211
+ & builder.PrintUsedLibrariesIfVerbose {},
212
+ & builder.WarnAboutArchIncompatibleLibraries {},
213
+ & builder.CTagsTargetFileSaver {SourceField : constants .CTX_SOURCE },
214
+ & builder.CTagsRunner {},
215
+ }
216
+
217
+ for _ , command := range commands {
218
+ err := command .Run (context )
219
+ NoError (t , err )
220
+ }
221
+
222
+ ctagsTempFileName := context [constants .CTX_CTAGS_TEMP_FILE_NAME ].(string )
223
+ expectedOutput := "value\t " + ctagsTempFileName + "\t /^\t int value() {$/;\" \t kind:function\t line:3\t namespace:Test\t signature:()\t returntype:int\n " +
224
+ "setup\t " + ctagsTempFileName + "\t /^void setup() {}$/;\" \t kind:function\t line:8\t signature:()\t returntype:void\n " +
225
+ "loop\t " + ctagsTempFileName + "\t /^void loop() {}$/;\" \t kind:function\t line:9\t signature:()\t returntype:void\n "
226
+
227
+ require .Equal (t , expectedOutput , strings .Replace (context [constants .CTX_CTAGS_OUTPUT ].(string ), "\r \n " , "\n " , - 1 ))
228
+ }
0 commit comments