Skip to content

Commit 586b551

Browse files
ported SketchWithExternCMultiline from legacy into integration test
1 parent 0adee81 commit 586b551

File tree

4 files changed

+67
-4
lines changed

4 files changed

+67
-4
lines changed

internal/integrationtest/compile_4/compile_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func TestCompileOfProblematicSketches(t *testing.T) {
110110
{"SketchWithEnumClass", testBuilderSketchWithEnumClass},
111111
{"SketchWithExternC", testBuilderSketchWithExternC},
112112
{"SketchWithMultilinePrototypes", testBuilderSketchWithMultilinePrototypes},
113+
{"SketchWithExternCMultiline", testBuilderSketchWithExternCMultiline},
113114
}.Run(t, env, cli)
114115
}
115116

@@ -693,6 +694,21 @@ func testBuilderSketchWithMultilinePrototypes(t *testing.T, env *integrationtest
693694
})
694695
}
695696

697+
func testBuilderSketchWithExternCMultiline(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
698+
t.Run("Build", func(t *testing.T) {
699+
// Build
700+
_, err := tryBuild(t, env, cli, "arduino:avr:leonardo")
701+
require.NoError(t, err)
702+
})
703+
704+
t.Run("Preprocess", func(t *testing.T) {
705+
// Preprocess
706+
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:avr:leonardo")
707+
require.NoError(t, err)
708+
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
709+
})
710+
}
711+
696712
type builderOutput struct {
697713
CompilerOut string `json:"compiler_out"`
698714
CompilerErr string `json:"compiler_err"`

legacy/builder/test/sketch_with_externC_multiline/sketch_with_externC_multiline.ino renamed to internal/integrationtest/compile_4/testdata/SketchWithExternCMultiline/SketchWithExternCMultiline.ino

File renamed without changes.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include <Arduino.h>
2+
#line 1 "{{QuoteCppString .sketchMainFile}}"
3+
#line 1 "{{QuoteCppString .sketchMainFile}}"
4+
void setup();
5+
#line 5 "{{QuoteCppString .sketchMainFile}}"
6+
void loop();
7+
#line 15 "{{QuoteCppString .sketchMainFile}}"
8+
extern "C" void test2();
9+
#line 20 "{{QuoteCppString .sketchMainFile}}"
10+
extern "C" void test4();
11+
#line 26 "{{QuoteCppString .sketchMainFile}}"
12+
extern "C" void test6();
13+
#line 30 "{{QuoteCppString .sketchMainFile}}"
14+
void test7();
15+
#line 32 "{{QuoteCppString .sketchMainFile}}"
16+
extern "C" void test10();
17+
#line 1 "{{QuoteCppString .sketchMainFile}}"
18+
void setup() {
19+
// put your setup code here, to run once:
20+
}
21+
22+
void loop() {
23+
// put your main code here, to run repeatedly:
24+
test2();
25+
test4();
26+
test6();
27+
test7();
28+
test10();
29+
}
30+
31+
extern "C" {
32+
void test2() {}
33+
}
34+
35+
extern "C"
36+
{
37+
void test4() {}
38+
}
39+
40+
extern "C"
41+
42+
{
43+
void test6() {}
44+
}
45+
46+
// this function should not have C linkage
47+
void test7() {}
48+
49+
extern "C" void test10() {
50+
51+
};

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 TestTryBuild040(t *testing.T) {
33-
tryBuild(t, paths.New("sketch_with_externC_multiline", "sketch_with_externC_multiline.ino"))
34-
}
35-
3632
func TestTryBuild041(t *testing.T) {
3733
tryBuild(t, paths.New("sketch_with_multiline_template", "sketch_with_multiline_template.ino"))
3834
}

0 commit comments

Comments
 (0)