Skip to content

Commit c8d1195

Browse files
ported SketchWithFastledsLibrary from legacy into integration test
1 parent f3ef21e commit c8d1195

File tree

4 files changed

+57
-54
lines changed

4 files changed

+57
-54
lines changed

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

+19
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ func TestCompileOfProblematicSketches(t *testing.T) {
6363
require.NoError(t, err)
6464
_, _, err = cli.Run("lib", "install", "[email protected]")
6565
require.NoError(t, err)
66+
_, _, err = cli.Run("lib", "install", "[email protected]")
67+
require.NoError(t, err)
6668

6769
// Install custom hardware required for tests
6870
customHwDir, err := paths.New("..", "testdata", "user_hardware").Abs()
@@ -114,6 +116,7 @@ func TestCompileOfProblematicSketches(t *testing.T) {
114116
{"SketchWithMultilineTemplate", testBuilderSketchWithMultilineTemplate},
115117
{"SketchWithFakeFunctionPointer", testBuilderSketchWithFakeFunctionPointer},
116118
{"SketchWithMinMaxDefinitions", testBuilderSketchWithMinMaxDefinitions},
119+
{"SketchWithFastledsLibrary", testBuilderSketchWithFastledsLibrary},
117120
}.Run(t, env, cli)
118121
}
119122

@@ -757,6 +760,22 @@ func testBuilderSketchWithMinMaxDefinitions(t *testing.T, env *integrationtest.E
757760
})
758761
}
759762

763+
func testBuilderSketchWithFastledsLibrary(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
764+
t.Run("Build", func(t *testing.T) {
765+
// Build
766+
_, err := tryBuild(t, env, cli, "arduino:samd:arduino_zero_native")
767+
require.NoError(t, err)
768+
})
769+
770+
t.Run("Preprocess", func(t *testing.T) {
771+
// Preprocess
772+
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:samd:arduino_zero_native")
773+
require.NoError(t, err)
774+
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
775+
})
776+
}
777+
778+
760779
type builderOutput struct {
761780
CompilerOut string `json:"compiler_out"`
762781
CompilerErr string `json:"compiler_err"`

Diff for: legacy/builder/test/sketch_fastleds/sketch_fastleds.ino renamed to internal/integrationtest/compile_4/testdata/SketchWithFastledsLibrary/SketchWithFastledsLibrary.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ SimplePatternList gPatterns = {sinelon};
2424

2525
void sinelon()
2626
{
27-
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <Arduino.h>
2+
#line 1 {{QuoteCppString .sketchMainFile}}
3+
#include "FastLED.h"
4+
5+
#define DATA_PIN 7
6+
#define CLK_PIN 6
7+
#define LED_TYPE APA102
8+
#define COLOR_ORDER GRB
9+
#define NUM_LEDS 79
10+
CRGB leds[NUM_LEDS];
11+
12+
#define BRIGHTNESS 96
13+
#define FRAMES_PER_SECOND 120
14+
#line 12 {{QuoteCppString .sketchMainFile}}
15+
void setup();
16+
#line 17 {{QuoteCppString .sketchMainFile}}
17+
void loop();
18+
#line 25 {{QuoteCppString .sketchMainFile}}
19+
void sinelon();
20+
#line 12 {{QuoteCppString .sketchMainFile}}
21+
void setup() {
22+
23+
FastLED.addLeds<LED_TYPE, DATA_PIN, CLK_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
24+
}
25+
26+
void loop() {
27+
28+
}
29+
30+
typedef void (*SimplePatternList[])();
31+
//SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm };
32+
SimplePatternList gPatterns = {sinelon};
33+
34+
void sinelon()
35+
{
36+
}
37+

Diff for: legacy/builder/test/try_build_of_problematic_sketch_test.go

-53
This file was deleted.

0 commit comments

Comments
 (0)