Skip to content

Commit d9a0828

Browse files
ported SketchWithMultilineTemplate from legacy into integration test
1 parent 586b551 commit d9a0828

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

internal/integrationtest/compile_4/compile_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ func TestCompileOfProblematicSketches(t *testing.T) {
111111
{"SketchWithExternC", testBuilderSketchWithExternC},
112112
{"SketchWithMultilinePrototypes", testBuilderSketchWithMultilinePrototypes},
113113
{"SketchWithExternCMultiline", testBuilderSketchWithExternCMultiline},
114+
{"SketchWithMultilineTemplate", testBuilderSketchWithMultilineTemplate},
114115
}.Run(t, env, cli)
115116
}
116117

@@ -709,6 +710,21 @@ func testBuilderSketchWithExternCMultiline(t *testing.T, env *integrationtest.En
709710
})
710711
}
711712

713+
func testBuilderSketchWithMultilineTemplate(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
714+
t.Run("Build", func(t *testing.T) {
715+
// Build
716+
_, err := tryBuild(t, env, cli, "arduino:avr:leonardo")
717+
require.NoError(t, err)
718+
})
719+
720+
t.Run("Preprocess", func(t *testing.T) {
721+
// Preprocess
722+
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:avr:leonardo")
723+
require.NoError(t, err)
724+
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
725+
})
726+
}
727+
712728
type builderOutput struct {
713729
CompilerOut string `json:"compiler_out"`
714730
CompilerErr string `json:"compiler_err"`

legacy/builder/test/sketch_with_multiline_template/sketch_with_multiline_template.ino renamed to internal/integrationtest/compile_4/testdata/SketchWithMultilineTemplate/SketchWithMultilineTemplate.ino

File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <Arduino.h>
2+
#line 0 "{{QuoteCppString .sketchMainFile}}"
3+
template< typename T > T func(T t);
4+
#line 6 "{{QuoteCppString .sketchMainFile}}"
5+
void setup();
6+
#line 10 "{{QuoteCppString .sketchMainFile}}"
7+
void loop();
8+
#line 0 "{{QuoteCppString .sketchMainFile}}"
9+
#line 1 "{{QuoteCppString .sketchMainFile}}"
10+
template< typename T >
11+
T func(T t){
12+
return t * t;
13+
}
14+
15+
void setup() {
16+
func( 12.34f );
17+
}
18+
19+
void loop() {}
20+

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

0 commit comments

Comments
 (0)