Skip to content

Commit fde5d3c

Browse files
ported SketchClassFunction from legacy into integration test
1 parent fe86e78 commit fde5d3c

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

Diff for: internal/integrationtest/compile_4/compile_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ func TestCompileOfProblematicSketches(t *testing.T) {
118118
{"SketchWithFakeFunctionPointer", testBuilderSketchWithFakeFunctionPointer},
119119
{"SketchWithMinMaxDefinitions", testBuilderSketchWithMinMaxDefinitions},
120120
{"SketchWithFastledsLibrary", testBuilderSketchWithFastledsLibrary},
121+
{"SketchClassFunction", testBuilderSketchClassFunction},
121122
}.Run(t, env, cli)
122123
}
123124

@@ -776,6 +777,21 @@ func testBuilderSketchWithFastledsLibrary(t *testing.T, env *integrationtest.Env
776777
})
777778
}
778779

780+
func testBuilderSketchClassFunction(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
781+
t.Run("Build", func(t *testing.T) {
782+
// Build
783+
_, err := tryBuild(t, env, cli, "arduino:avr:leonardo")
784+
require.NoError(t, err)
785+
})
786+
787+
t.Run("Preprocess", func(t *testing.T) {
788+
// Preprocess
789+
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:avr:leonardo")
790+
require.NoError(t, err)
791+
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
792+
})
793+
}
794+
779795
type builderOutput struct {
780796
CompilerOut string `json:"compiler_out"`
781797
CompilerErr string `json:"compiler_err"`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <Arduino.h>
2+
#line 1 {{QuoteCppString .sketchMainFile}}
3+
class test {
4+
void asdf() {}
5+
};
6+
#line 4 {{QuoteCppString .sketchMainFile}}
7+
void setup();
8+
#line 7 {{QuoteCppString .sketchMainFile}}
9+
void loop();
10+
#line 8 {{QuoteCppString .sketchMainFile}}
11+
void asdf();
12+
#line 4 {{QuoteCppString .sketchMainFile}}
13+
void setup() {
14+
asdf();
15+
}
16+
void loop() {}
17+
void asdf() {}

0 commit comments

Comments
 (0)