Skip to content

Commit c531892

Browse files
matthijskooijmanFederico Fissore
authored and
Federico Fissore
committed
Merge some prototype generation testcases
All of these contain complex functions that should not get any prototypes, so merging them into a single testcase seems useful. Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
1 parent 8bb7912 commit c531892

File tree

3 files changed

+8
-53
lines changed

3 files changed

+8
-53
lines changed

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

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
495495
require.Nil(t, context[constants.CTX_PROTOTYPE_SECTION])
496496
}
497497

498-
func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
498+
func TestPrototypesAdderSketchComplexFunctions(t *testing.T) {
499499
DownloadCoresAndToolsAndLibraries(t)
500500

501501
context := make(map[string]interface{})
@@ -506,7 +506,7 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
506506
context[constants.CTX_HARDWARE_FOLDERS] = []string{filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"}
507507
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
508508
context[constants.CTX_FQBN] = "arduino:avr:leonardo"
509-
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch_with_default_args", "sketch.ino")
509+
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch_with_complex_prototypes", "sketch.ino")
510510
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
511511
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
512512
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
@@ -533,48 +533,7 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
533533
}
534534

535535
require.Equal(t, "#include <Arduino.h>\n#line 1\n", context[constants.CTX_INCLUDE_SECTION].(string))
536-
require.Equal(t, "void setup();\nvoid loop();\n#line 1\n", context[constants.CTX_PROTOTYPE_SECTION].(string))
537-
}
538-
539-
func TestPrototypesAdderSketchWithInlineFunction(t *testing.T) {
540-
DownloadCoresAndToolsAndLibraries(t)
541-
542-
context := make(map[string]interface{})
543-
544-
buildPath := SetupBuildPath(t, context)
545-
defer os.RemoveAll(buildPath)
546-
547-
context[constants.CTX_HARDWARE_FOLDERS] = []string{filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"}
548-
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
549-
context[constants.CTX_FQBN] = "arduino:avr:leonardo"
550-
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch_with_inline_function", "sketch.ino")
551-
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
552-
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
553-
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
554-
context[constants.CTX_VERBOSE] = false
555-
556-
commands := []types.Command{
557-
&builder.SetupHumanLoggerIfMissing{},
558-
559-
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
560-
561-
&builder.ContainerMergeCopySketchFiles{},
562-
563-
&builder.ContainerFindIncludes{},
564-
565-
&builder.PrintUsedLibrariesIfVerbose{},
566-
&builder.WarnAboutArchIncompatibleLibraries{},
567-
568-
&builder.ContainerAddPrototypes{},
569-
}
570-
571-
for _, command := range commands {
572-
err := command.Run(context)
573-
NoError(t, err)
574-
}
575-
576-
require.Equal(t, "#include <Arduino.h>\n#line 1\n", context[constants.CTX_INCLUDE_SECTION].(string))
577-
require.Equal(t, "void setup();\nvoid loop();\nshort unsigned int testInt();\n#line 1\n", context[constants.CTX_PROTOTYPE_SECTION].(string))
536+
require.Equal(t, "void setup();\nvoid loop();\nshort unsigned int testSimple();\n#line 1\n", context[constants.CTX_PROTOTYPE_SECTION].(string))
578537
}
579538

580539
func TestPrototypesAdderSketchWithFunctionSignatureInsideIFDEF(t *testing.T) {

src/arduino.cc/builder/test/sketch_with_inline_function/sketch.ino renamed to src/arduino.cc/builder/test/sketch_with_complex_prototypes/sketch.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
void setup() {}
22
void loop() {}
33

4-
short unsigned int testInt(){
4+
short unsigned int testSimple(){
55

66
}
77

@@ -12,3 +12,7 @@ static inline int8_t testInline(){
1212
__attribute__((always_inline)) uint8_t testAttribute() {
1313

1414
}
15+
16+
void testDefault(int x = 1) {
17+
18+
}

src/arduino.cc/builder/test/sketch_with_default_args/sketch.ino

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)