|
| 1 | +// This file is part of arduino-cli. |
| 2 | +// |
| 3 | +// Copyright 2025 ARDUINO SA (http://www.arduino.cc/) |
| 4 | +// |
| 5 | +// This software is released under the GNU General Public License version 3, |
| 6 | +// which covers the main part of arduino-cli. |
| 7 | +// The terms of this license can be found at: |
| 8 | +// https://www.gnu.org/licenses/gpl-3.0.en.html |
| 9 | +// |
| 10 | +// You can be released from the requirements of the above licenses by purchasing |
| 11 | +// a commercial license. Buying such a license is mandatory if you want to |
| 12 | +// modify or otherwise use the software for commercial activities involving the |
| 13 | +// Arduino software without disclosing the source code of your own applications. |
| 14 | +// To purchase a commercial license, send an email to [email protected]. |
| 15 | + |
| 16 | +package preprocessor |
| 17 | + |
| 18 | +import ( |
| 19 | + "bytes" |
| 20 | + "fmt" |
| 21 | + "testing" |
| 22 | + |
| 23 | + "github.com/arduino/arduino-cli/internal/arduino/sketch" |
| 24 | + "github.com/arduino/go-paths-helper" |
| 25 | + "github.com/stretchr/testify/require" |
| 26 | +) |
| 27 | + |
| 28 | +func TestCtagsSketchFilter(t *testing.T) { |
| 29 | + sourcePath := paths.New("testdata", "sketch_merged.cpp") |
| 30 | + f, err := sourcePath.Open() |
| 31 | + require.NoError(t, err) |
| 32 | + t.Cleanup(func() { f.Close() }) |
| 33 | + |
| 34 | + sketch := &sketch.Sketch{ |
| 35 | + MainFile: paths.New("/home/megabug/Arduino/Test/Test.ino"), |
| 36 | + } |
| 37 | + stderr := bytes.NewBuffer(nil) |
| 38 | + res := filterSketchSource(sketch, f, false, stderr) |
| 39 | + require.Empty(t, stderr) |
| 40 | + require.NotEmpty(t, res) |
| 41 | + fmt.Println(res) |
| 42 | +} |
0 commit comments