Skip to content

Commit 574ed7e

Browse files
ported SketchWithFakeFunctionPointer from legacy into integration test
1 parent d9a0828 commit 574ed7e

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed

internal/integrationtest/compile_4/compile_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ func TestCompileOfProblematicSketches(t *testing.T) {
112112
{"SketchWithMultilinePrototypes", testBuilderSketchWithMultilinePrototypes},
113113
{"SketchWithExternCMultiline", testBuilderSketchWithExternCMultiline},
114114
{"SketchWithMultilineTemplate", testBuilderSketchWithMultilineTemplate},
115+
{"SketchWithFakeFunctionPointer", testBuilderSketchWithFakeFunctionPointer},
115116
}.Run(t, env, cli)
116117
}
117118

@@ -725,6 +726,21 @@ func testBuilderSketchWithMultilineTemplate(t *testing.T, env *integrationtest.E
725726
})
726727
}
727728

729+
func testBuilderSketchWithFakeFunctionPointer(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
730+
t.Run("Build", func(t *testing.T) {
731+
// Build
732+
_, err := tryBuild(t, env, cli, "arduino:avr:leonardo")
733+
require.NoError(t, err)
734+
})
735+
736+
t.Run("Preprocess", func(t *testing.T) {
737+
// Preprocess
738+
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:avr:leonardo")
739+
require.NoError(t, err)
740+
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
741+
})
742+
}
743+
728744
type builderOutput struct {
729745
CompilerOut string `json:"compiler_out"`
730746
CompilerErr string `json:"compiler_err"`

legacy/builder/test/sketch_with_fake_function_pointer/sketch_with_fake_function_pointer.ino renamed to internal/integrationtest/compile_4/testdata/SketchWithFakeFunctionPointer/SketchWithFakeFunctionPointer.ino

File renamed without changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <Arduino.h>
2+
#line 1 "{{QuoteCppString .sketchMainFile}}"
3+
template< uint16_t nBuffSize >
4+
class Foo{
5+
public:
6+
7+
template< uint16_t N >
8+
Foo &operator +=( const Foo<N> &ref ){
9+
//...
10+
return *this;
11+
}
12+
};
13+
14+
Foo<64> a;
15+
Foo<32> b;
16+
17+
#line 15 "{{QuoteCppString .sketchMainFile}}"
18+
void setup();
19+
#line 19 "{{QuoteCppString .sketchMainFile}}"
20+
void loop();
21+
#line 15 "{{QuoteCppString .sketchMainFile}}"
22+
void setup(){
23+
a += b;
24+
}
25+
26+
void loop(){}
27+

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 TestTryBuild042(t *testing.T) {
33-
tryBuild(t, paths.New("sketch_with_fake_function_pointer", "sketch_with_fake_function_pointer.ino"))
34-
}
35-
3632
func TestTryBuild036(t *testing.T) {
3733
ctx := makeDefaultContext()
3834
tryBuildWithContext(t, ctx, "arduino:samd:arduino_zero_native", paths.New("sketch_fastleds", "sketch_fastleds.ino"))

0 commit comments

Comments
 (0)