Skip to content

Commit

Permalink
ported testBuilderSketchWithMultilinePrototypes from legacy into inte…
Browse files Browse the repository at this point in the history
…gration test
  • Loading branch information
alessio-perugini committed Sep 13, 2023
1 parent e34591b commit 36ec81d
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 4 deletions.
16 changes: 16 additions & 0 deletions internal/integrationtest/compile_4/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func TestCompileOfProblematicSketches(t *testing.T) {
{"UserHardware", testBuilderWithUserHardware},
{"SketchWithEnumClass", testBuilderSketchWithEnumClass},
{"SketchWithExternC", testBuilderSketchWithExternC},
{"SketchWithMultilinePrototypes", testBuilderSketchWithMultilinePrototypes},
}.Run(t, env, cli)
}

Expand Down Expand Up @@ -677,6 +678,21 @@ func testBuilderSketchWithExternC(t *testing.T, env *integrationtest.Environment
})
}

func testBuilderSketchWithMultilinePrototypes(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
t.Run("Build", func(t *testing.T) {
// Build
_, err := tryBuild(t, env, cli, "arduino:avr:leonardo")
require.NoError(t, err)
})

t.Run("Preprocess", func(t *testing.T) {
// Preprocess
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:avr:leonardo")
require.NoError(t, err)
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
})
}

type builderOutput struct {
CompilerOut string `json:"compiler_out"`
CompilerErr string `json:"compiler_err"`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#include <Arduino.h>
#line 1 "{{QuoteCppString .sketchMainFile}}"
#line 1 "{{QuoteCppString .sketchMainFile}}"
void setup();
#line 12 "{{QuoteCppString .sketchMainFile}}"
void myctagstestfunc(int a, int b, int c, int d);
#line 17 "{{QuoteCppString .sketchMainFile}}"
void loop();
#line 18 "{{QuoteCppString .sketchMainFile}}"
void test();
#line 21 "{{QuoteCppString .sketchMainFile}}"
void test3();
#line 25 "{{QuoteCppString .sketchMainFile}}"
void test5(int a, int b, int c);
#line 33 "{{QuoteCppString .sketchMainFile}}"
void test7();
#line 36 "{{QuoteCppString .sketchMainFile}}"
void test8();
#line 44 "{{QuoteCppString .sketchMainFile}}"
void test9(int a, int b);
#line 50 "{{QuoteCppString .sketchMainFile}}"
void test10(int a, int b, int c );
#line 1 "{{QuoteCppString .sketchMainFile}}"
void setup() {
myctagstestfunc(1,2,3,4);
test();
test3();
test5(1,2,3);
test7();
test8();
test9(42, 42);
test10(0,0,0);
}

void myctagstestfunc(int a,
int b,
int c,
int d) { }

void loop() {}

void
test() {}

void
// comment
test3() {}

void
test5(int a,
int b,
int c)
{

}

void /* comment */
test7() {}

void
/*
multi
line
comment
*/
test8() {}

void
/* comment */
test9(int a,
int b) {}

void test10(int a, // this
int b, // doesn't
int c // work
) {}
4 changes: 0 additions & 4 deletions legacy/builder/test/try_build_of_problematic_sketch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ import (

// TODO add them in the compile_4

func TestTryBuild038(t *testing.T) {
tryBuild(t, paths.New("sketch_with_multiline_prototypes", "sketch_with_multiline_prototypes.ino"))
}

func TestTryBuild040(t *testing.T) {
tryBuild(t, paths.New("sketch_with_externC_multiline", "sketch_with_externC_multiline.ino"))
}
Expand Down

0 comments on commit 36ec81d

Please sign in to comment.