Skip to content

Commit 45b5865

Browse files
author
Federico Fissore
committed
Testing that prototype of a function containing a typename is not generated
Signed-off-by: Federico Fissore <[email protected]>
1 parent 951f1f9 commit 45b5865

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/arduino.cc/builder/test/prototypes_adder_test.go

+40
Original file line numberDiff line numberDiff line change
@@ -658,3 +658,43 @@ func TestPrototypesAdderSketchWithUSBCON(t *testing.T) {
658658
require.Equal(t, "#include <Arduino.h>\n#line 1\n", context[constants.CTX_INCLUDE_SECTION].(string))
659659
require.Equal(t, "void ciao();\nvoid setup();\nvoid loop();\n#line 3\n", context[constants.CTX_PROTOTYPE_SECTION].(string))
660660
}
661+
662+
func TestPrototypesAdderSketchWithTypename(t *testing.T) {
663+
DownloadCoresAndToolsAndLibraries(t)
664+
665+
context := make(map[string]interface{})
666+
667+
buildPath := SetupBuildPath(t, context)
668+
defer os.RemoveAll(buildPath)
669+
670+
context[constants.CTX_HARDWARE_FOLDERS] = []string{filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"}
671+
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
672+
context[constants.CTX_FQBN] = "arduino:avr:leonardo"
673+
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch_with_typename", "sketch.ino")
674+
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
675+
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
676+
context[constants.CTX_VERBOSE] = true
677+
678+
commands := []types.Command{
679+
&builder.SetupHumanLoggerIfMissing{},
680+
681+
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
682+
683+
&builder.ContainerMergeCopySketchFiles{},
684+
685+
&builder.ContainerFindIncludes{},
686+
687+
&builder.PrintUsedLibrariesIfVerbose{},
688+
&builder.WarnAboutArchIncompatibleLibraries{},
689+
690+
&builder.ContainerAddPrototypes{},
691+
}
692+
693+
for _, command := range commands {
694+
err := command.Run(context)
695+
NoError(t, err)
696+
}
697+
698+
require.Equal(t, "#include <Arduino.h>\n#line 1\n", context[constants.CTX_INCLUDE_SECTION].(string))
699+
require.Equal(t, "void setup();\nvoid loop();\n#line 6\n", context[constants.CTX_PROTOTYPE_SECTION].(string))
700+
}

0 commit comments

Comments
 (0)