Skip to content

Commit 7d77230

Browse files
ported SketchWithStaticAsserts from legacy into integration test
1 parent 9a80cb0 commit 7d77230

File tree

4 files changed

+43
-5
lines changed

4 files changed

+43
-5
lines changed

internal/integrationtest/compile_4/compile_test.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,12 @@ func TestCompileOfProblematicSketches(t *testing.T) {
101101
{"SketchThatChecksIfSPIHasTransactions", tryBuildAvrLeonardo},
102102
{"SketchWithDependendLibraries", tryBuildAvrLeonardo},
103103
{"SketchWithFunctionPointer", tryBuildAvrLeonardo},
104-
{"SketchThatIncludesArduinoH", testBuilderSketchThatIncludesArduinoH},
105104
{"USBHostExample", testBuilderUSBHostExample},
106105
{"SketchWithConflictingLibraries", testBuilderSketchWithConflictingLibraries},
107106
{"SketchLibraryProvidesAllIncludes", testBuilderSketchLibraryProvidesAllIncludes},
108107
{"UserHardware", testBuilderWithUserHardware},
108+
{"SketchThatIncludesArduinoH", testBuilderSketchThatIncludesArduinoH},
109+
{"SketchWithStaticAsserts", testBuilderSketchWithStaticAsserts},
109110
}.Run(t, env, cli)
110111
}
111112

@@ -629,6 +630,21 @@ func testBuilderSketchThatIncludesArduinoH(t *testing.T, env *integrationtest.En
629630
})
630631
}
631632

633+
func testBuilderSketchWithStaticAsserts(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
634+
t.Run("Build", func(t *testing.T) {
635+
// Build
636+
_, err := tryBuild(t, env, cli, "arduino:avr:leonardo")
637+
require.NoError(t, err)
638+
})
639+
640+
t.Run("Preprocess", func(t *testing.T) {
641+
// Preprocess
642+
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:avr:leonardo")
643+
require.NoError(t, err)
644+
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
645+
})
646+
}
647+
632648
type builderOutput struct {
633649
CompilerOut string `json:"compiler_out"`
634650
CompilerErr string `json:"compiler_err"`

legacy/builder/test/sketch_with_static_asserts/sketch_with_static_asserts.ino renamed to internal/integrationtest/compile_4/testdata/SketchWithStaticAsserts/SketchWithStaticAsserts.ino

File renamed without changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <Arduino.h>
2+
#line 1 {{QuoteCppString .sketchMainFile}}
3+
// https://github.com/arduino/arduino-builder/issues/68
4+
5+
const int a = 10;
6+
const int b = 20;
7+
8+
static_assert(a < b, "bar");
9+
10+
#line 8 {{QuoteCppString .sketchMainFile}}
11+
void setup();
12+
#line 12 {{QuoteCppString .sketchMainFile}}
13+
void loop();
14+
#line 15 {{QuoteCppString .sketchMainFile}}
15+
void test();
16+
#line 8 {{QuoteCppString .sketchMainFile}}
17+
void setup() {
18+
test();
19+
}
20+
21+
void loop() {
22+
}
23+
24+
void test() {
25+
}
26+

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 TestTryBuild034(t *testing.T) {
33-
tryBuild(t, paths.New("sketch_with_static_asserts", "sketch_with_static_asserts.ino"))
34-
}
35-
3632
func TestTryBuild035(t *testing.T) {
3733
tryBuild(t, paths.New("sketch_with_enum_class", "sketch_with_enum_class.ino"))
3834
}

0 commit comments

Comments
 (0)