Skip to content

Commit

Permalink
add test for sketch with malformed EOL
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm committed Feb 9, 2016
1 parent ae80106 commit 4d20d6d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/arduino.cc/builder/test/eol_processing/sketch.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int led = 7;void setup() { }void loop() { }
Expand Down
41 changes: 41 additions & 0 deletions src/arduino.cc/builder/test/prototypes_adder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,3 +880,44 @@ func TestPrototypesAdderSketchWithConst(t *testing.T) {
require.Equal(t, "#include <Arduino.h>\n#line 1\n", context[constants.CTX_INCLUDE_SECTION].(string))
require.Equal(t, "#line 1 \""+absoluteSketchLocation+"\"\nvoid setup();\n#line 2 \""+absoluteSketchLocation+"\"\nvoid loop();\n#line 4 \""+absoluteSketchLocation+"\"\nconst __FlashStringHelper* test();\n#line 6 \""+absoluteSketchLocation+"\"\nconst int test3();\n#line 8 \""+absoluteSketchLocation+"\"\nvolatile __FlashStringHelper* test2();\n#line 10 \""+absoluteSketchLocation+"\"\nvolatile int test4();\n#line 1\n", context[constants.CTX_PROTOTYPE_SECTION].(string))
}

func TestPrototypesAdderSketchWithDosEol(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

context := make(map[string]interface{})

buildPath := SetupBuildPath(t, context)
defer os.RemoveAll(buildPath)

sketchLocation := filepath.Join("eol_processing", "sketch.ino")

context[constants.CTX_HARDWARE_FOLDERS] = []string{filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"}
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
context[constants.CTX_FQBN] = "arduino:avr:uno"
context[constants.CTX_SKETCH_LOCATION] = sketchLocation
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
context[constants.CTX_BUILT_IN_LIBRARIES_FOLDERS] = []string{"downloaded_libraries"}
context[constants.CTX_OTHER_LIBRARIES_FOLDERS] = []string{"libraries"}
context[constants.CTX_VERBOSE] = true

commands := []types.Command{
&builder.SetupHumanLoggerIfMissing{},

&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},

&builder.ContainerMergeCopySketchFiles{},

&builder.ContainerFindIncludes{},

&builder.PrintUsedLibrariesIfVerbose{},
&builder.WarnAboutArchIncompatibleLibraries{},

&builder.ContainerAddPrototypes{},
}

for _, command := range commands {
err := command.Run(context)
NoError(t, err)
}
// only requires no error as result
}

0 comments on commit 4d20d6d

Please sign in to comment.