Skip to content

Commit

Permalink
ported SketchWithMultilineTemplate from legacy into integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-perugini committed Sep 13, 2023
1 parent 1e04c85 commit e27e313
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/integrationtest/compile_4/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func TestCompileOfProblematicSketches(t *testing.T) {
{"SketchWithExternC", testBuilderSketchWithExternC},
{"SketchWithMultilinePrototypes", testBuilderSketchWithMultilinePrototypes},
{"SketchWithExternCMultiline", testBuilderSketchWithExternCMultiline},
{"SketchWithMultilineTemplate", testBuilderSketchWithMultilineTemplate},
}.Run(t, env, cli)
}

Expand Down Expand Up @@ -709,6 +710,21 @@ func testBuilderSketchWithExternCMultiline(t *testing.T, env *integrationtest.En
})
}

func testBuilderSketchWithMultilineTemplate(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
t.Run("Build", func(t *testing.T) {
// Build
_, err := tryBuild(t, env, cli, "arduino:avr:leonardo")
require.NoError(t, err)
})

t.Run("Preprocess", func(t *testing.T) {
// Preprocess
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:avr:leonardo")
require.NoError(t, err)
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
})
}

type builderOutput struct {
CompilerOut string `json:"compiler_out"`
CompilerErr string `json:"compiler_err"`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <Arduino.h>
#line 0 "{{QuoteCppString .sketchMainFile}}"
template< typename T > T func(T t);
#line 6 "{{QuoteCppString .sketchMainFile}}"
void setup();
#line 10 "{{QuoteCppString .sketchMainFile}}"
void loop();
#line 0 "{{QuoteCppString .sketchMainFile}}"
#line 1 "{{QuoteCppString .sketchMainFile}}"
template< typename T >
T func(T t){
return t * t;
}

void setup() {
func( 12.34f );
}

void loop() {}

0 comments on commit e27e313

Please sign in to comment.