Skip to content

Commit e22ff66

Browse files
committed
Slightly refactored integration test
1 parent f08b2d3 commit e22ff66

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

internal/integrationtest/compile_3/compile_test.go

+19-16
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func TestCompilerErrOutput(t *testing.T) {
107107
_, _, err := cli.Run("core", "install", "arduino:[email protected]")
108108
require.NoError(t, err)
109109

110-
{
110+
t.Run("Diagnostics", func(t *testing.T) {
111111
// prepare sketch
112112
sketch, err := paths.New("testdata", "blink_with_wrong_cpp").Abs()
113113
require.NoError(t, err)
@@ -126,10 +126,11 @@ func TestCompilerErrOutput(t *testing.T) {
126126
"context": [ { "message": "In function 'void wrong()':" } ]
127127
}
128128
]`)
129-
}
129+
})
130+
131+
t.Run("PreprocessorDiagnostics", func(t *testing.T) {
132+
// Test the preprocessor errors are present in the diagnostics
130133

131-
// Test the preprocessor errors are present in the diagnostics
132-
{
133134
// prepare sketch
134135
sketch, err := paths.New("testdata", "blink_with_wrong_include").Abs()
135136
require.NoError(t, err)
@@ -148,14 +149,15 @@ func TestCompilerErrOutput(t *testing.T) {
148149
"message": "invalid preprocessing directive #wrong\n #wrong\n ^~~~~",
149150
}
150151
]`)
151-
}
152+
})
153+
154+
t.Run("PreprocessorDiagnosticsWithLibErrors", func(t *testing.T) {
155+
// Test the preprocessor errors are present in the diagnostics.
156+
// In case we have 2 libraries:
157+
// 1. one is missing
158+
// 2. the other one is missing only from the first GCC run
159+
// The diagnostics should report only 1 missing library.
152160

153-
// Test the preprocessor errors are present in the diagnostics.
154-
// In case we have 2 libraries:
155-
// 1. one is missing
156-
// 2. the other one is missing only from the first GCC run
157-
// The diagnostics should report only 1 missing library.
158-
{
159161
// prepare sketch
160162
sketch, err := paths.New("testdata", "using_Wire_with_missing_lib").Abs()
161163
require.NoError(t, err)
@@ -175,11 +177,12 @@ func TestCompilerErrOutput(t *testing.T) {
175177
"column": 10,
176178
}
177179
]`)
178-
}
180+
})
181+
182+
t.Run("LibraryDiscoverFalseErrors", func(t *testing.T) {
183+
// Check that library discover do not generate false errors
184+
// https://github.com/arduino/arduino-cli/issues/2263
179185

180-
// Check that library discover do not generate false errors
181-
// https://github.com/arduino/arduino-cli/issues/2263
182-
{
183186
// prepare sketch
184187
sketch, err := paths.New("testdata", "using_Wire").Abs()
185188
require.NoError(t, err)
@@ -191,7 +194,7 @@ func TestCompilerErrOutput(t *testing.T) {
191194
jsonOut.Query(".compiler_out").MustNotContain(`"fatal error"`)
192195
jsonOut.Query(".compiler_err").MustNotContain(`"fatal error"`)
193196
jsonOut.MustNotContain(`{ "diagnostics" : [] }`)
194-
}
197+
})
195198
}
196199

197200
func TestCompileRelativeLibraryPath(t *testing.T) {

0 commit comments

Comments
 (0)