@@ -907,3 +907,44 @@ func TestPrototypesAdderSketchWithDosEol(t *testing.T) {
907907 }
908908 // only requires no error as result
909909}
910+
911+ func TestPrototypesAdderSketchWithSubstringFunctionMember (t * testing.T ) {
912+ DownloadCoresAndToolsAndLibraries (t )
913+ sketchLocation := paths .New ("sketch_with_class_and_method_substring" , "sketch_with_class_and_method_substring.ino" )
914+ quotedSketchLocation := utils .QuoteCppString (Abs (t , sketchLocation ).String ())
915+
916+ ctx := & types.Context {
917+ HardwareDirs : paths .NewPathList (filepath .Join (".." , "hardware" ), "hardware" , "downloaded_hardware" ),
918+ BuiltInToolsDirs : paths .NewPathList ("downloaded_tools" ),
919+ BuiltInLibrariesDirs : paths .NewPathList ("downloaded_libraries" ),
920+ OtherLibrariesDirs : paths .NewPathList ("libraries" ),
921+ SketchLocation : sketchLocation ,
922+ FQBN : parseFQBN (t , "arduino:avr:uno" ),
923+ ArduinoAPIVersion : "10600" ,
924+ Verbose : true ,
925+ }
926+
927+ buildPath := SetupBuildPath (t , ctx )
928+ defer buildPath .RemoveAll ()
929+
930+ commands := []types.Command {
931+
932+ & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
933+
934+ & builder.ContainerMergeCopySketchFiles {},
935+
936+ & builder.ContainerFindIncludes {},
937+
938+ & builder.PrintUsedLibrariesIfVerbose {},
939+ & builder.WarnAboutArchIncompatibleLibraries {},
940+
941+ & builder.ContainerAddPrototypes {},
942+ }
943+
944+ for _ , command := range commands {
945+ err := command .Run (ctx )
946+ NoError (t , err )
947+ }
948+
949+ require .Contains (t , ctx .Source , "class Foo {\n int blooper(int x) { return x+1; }\n };\n \n Foo foo;\n \n #line 7 " + quotedSketchLocation + "\n void setup();" )
950+ }
0 commit comments