Skip to content

Commit 0adee81

Browse files
ported testBuilderSketchWithMultilinePrototypes from legacy into integration test
1 parent fd60036 commit 0adee81

File tree

4 files changed

+92
-4
lines changed

4 files changed

+92
-4
lines changed

internal/integrationtest/compile_4/compile_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func TestCompileOfProblematicSketches(t *testing.T) {
109109
{"SketchWithStaticAsserts", testBuilderSketchWithStaticAsserts},
110110
{"SketchWithEnumClass", testBuilderSketchWithEnumClass},
111111
{"SketchWithExternC", testBuilderSketchWithExternC},
112+
{"SketchWithMultilinePrototypes", testBuilderSketchWithMultilinePrototypes},
112113
}.Run(t, env, cli)
113114
}
114115

@@ -677,6 +678,21 @@ func testBuilderSketchWithExternC(t *testing.T, env *integrationtest.Environment
677678
})
678679
}
679680

681+
func testBuilderSketchWithMultilinePrototypes(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
682+
t.Run("Build", func(t *testing.T) {
683+
// Build
684+
_, err := tryBuild(t, env, cli, "arduino:avr:leonardo")
685+
require.NoError(t, err)
686+
})
687+
688+
t.Run("Preprocess", func(t *testing.T) {
689+
// Preprocess
690+
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:avr:leonardo")
691+
require.NoError(t, err)
692+
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
693+
})
694+
}
695+
680696
type builderOutput struct {
681697
CompilerOut string `json:"compiler_out"`
682698
CompilerErr string `json:"compiler_err"`

legacy/builder/test/sketch_with_multiline_prototypes/sketch_with_multiline_prototypes.ino renamed to internal/integrationtest/compile_4/testdata/SketchWithMultilinePrototypes/SketchWithMultilinePrototypes.ino

File renamed without changes.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#include <Arduino.h>
2+
#line 1 "{{QuoteCppString .sketchMainFile}}"
3+
#line 1 "{{QuoteCppString .sketchMainFile}}"
4+
void setup();
5+
#line 12 "{{QuoteCppString .sketchMainFile}}"
6+
void myctagstestfunc(int a, int b, int c, int d);
7+
#line 17 "{{QuoteCppString .sketchMainFile}}"
8+
void loop();
9+
#line 18 "{{QuoteCppString .sketchMainFile}}"
10+
void test();
11+
#line 21 "{{QuoteCppString .sketchMainFile}}"
12+
void test3();
13+
#line 25 "{{QuoteCppString .sketchMainFile}}"
14+
void test5(int a, int b, int c);
15+
#line 33 "{{QuoteCppString .sketchMainFile}}"
16+
void test7();
17+
#line 36 "{{QuoteCppString .sketchMainFile}}"
18+
void test8();
19+
#line 44 "{{QuoteCppString .sketchMainFile}}"
20+
void test9(int a, int b);
21+
#line 50 "{{QuoteCppString .sketchMainFile}}"
22+
void test10(int a, int b, int c );
23+
#line 1 "{{QuoteCppString .sketchMainFile}}"
24+
void setup() {
25+
myctagstestfunc(1,2,3,4);
26+
test();
27+
test3();
28+
test5(1,2,3);
29+
test7();
30+
test8();
31+
test9(42, 42);
32+
test10(0,0,0);
33+
}
34+
35+
void myctagstestfunc(int a,
36+
int b,
37+
int c,
38+
int d) { }
39+
40+
void loop() {}
41+
42+
void
43+
test() {}
44+
45+
void
46+
// comment
47+
test3() {}
48+
49+
void
50+
test5(int a,
51+
int b,
52+
int c)
53+
{
54+
55+
}
56+
57+
void /* comment */
58+
test7() {}
59+
60+
void
61+
/*
62+
multi
63+
line
64+
comment
65+
*/
66+
test8() {}
67+
68+
void
69+
/* comment */
70+
test9(int a,
71+
int b) {}
72+
73+
void test10(int a, // this
74+
int b, // doesn't
75+
int c // work
76+
) {}

legacy/builder/test/try_build_of_problematic_sketch_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ import (
2929

3030
// TODO add them in the compile_4
3131

32-
func TestTryBuild038(t *testing.T) {
33-
tryBuild(t, paths.New("sketch_with_multiline_prototypes", "sketch_with_multiline_prototypes.ino"))
34-
}
35-
3632
func TestTryBuild040(t *testing.T) {
3733
tryBuild(t, paths.New("sketch_with_externC_multiline", "sketch_with_externC_multiline.ino"))
3834
}

0 commit comments

Comments
 (0)