|
| 1 | +// This file is part of arduino-cli. |
| 2 | +// |
| 3 | +// Copyright 2022 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 core_test |
| 17 | + |
| 18 | +import ( |
| 19 | + "testing" |
| 20 | + |
| 21 | + "github.com/arduino/arduino-cli/internal/integrationtest" |
| 22 | + "github.com/arduino/go-paths-helper" |
| 23 | + "github.com/stretchr/testify/require" |
| 24 | + "go.bug.st/testsuite" |
| 25 | + "go.bug.st/testsuite/requirejson" |
| 26 | +) |
| 27 | + |
| 28 | +func TestCorrectHandlingOfPlatformVersionProperty(t *testing.T) { |
| 29 | + // See: https://github.com/arduino/arduino-cli/issues/1823 |
| 30 | + |
| 31 | + env := testsuite.NewEnvironment(t) |
| 32 | + defer env.CleanUp() |
| 33 | + |
| 34 | + cli := integrationtest.NewArduinoCliWithinEnvironment(env, &integrationtest.ArduinoCLIConfig{ |
| 35 | + ArduinoCLIPath: paths.New("..", "..", "..", "arduino-cli"), |
| 36 | + UseSharedStagingFolder: true, |
| 37 | + }) |
| 38 | + |
| 39 | + // Copy test platform |
| 40 | + testPlatform := paths.New("testdata", "issue_1823", "DxCore-dev") |
| 41 | + require.NoError(t, testPlatform.CopyDirTo(cli.SketchbookDir().Join("hardware", "DxCore-dev"))) |
| 42 | + |
| 43 | + // Trigger problematic call |
| 44 | + out, _, err := cli.Run("core", "list", "--format", "json") |
| 45 | + require.NoError(t, err) |
| 46 | + requirejson.Contains(t, out, `[{"id":"DxCore-dev:megaavr","installed":"1.4.10","name":"DxCore"}]`) |
| 47 | +} |
0 commit comments