Skip to content

Commit 1755033

Browse files
committed
fix TestGetCommandLine
1 parent 8c02052 commit 1755033

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Diff for: commands/debug/debug_test.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ import (
2626
dbg "github.com/arduino/arduino-cli/rpc/debug"
2727
"github.com/arduino/go-paths-helper"
2828
"github.com/stretchr/testify/assert"
29+
"github.com/stretchr/testify/require"
2930
)
3031

31-
var customHardware = paths.New("testdata", "custom_hardware")
32-
var dataDir = paths.New("testdata", "data_dir", "packages")
33-
var sketch = "hello"
34-
var sketchPath = paths.New("testdata", sketch)
35-
3632
func TestGetCommandLine(t *testing.T) {
33+
customHardware := paths.New("testdata", "custom_hardware")
34+
dataDir := paths.New("testdata", "data_dir", "packages")
35+
sketch := "hello"
36+
sketchPath := paths.New("testdata", sketch)
37+
require.NoError(t, sketchPath.ToAbs())
38+
3739
pm := packagemanager.NewPackageManager(nil, nil, nil, nil)
3840
pm.LoadHardwareFromDirectory(customHardware)
3941
pm.LoadHardwareFromDirectory(dataDir)
@@ -59,9 +61,9 @@ func TestGetCommandLine(t *testing.T) {
5961
fmt.Sprintf(" -c \"gdb_port pipe\" -c \"telnet_port 0\" -c init -c halt %s/build/arduino-test.samd.arduino_zero_edbg/hello.ino.elf", sketchPath)
6062

6163
command, err := getCommandLine(req, pm)
62-
assert.Nil(t, err)
64+
require.Nil(t, err)
6365
commandToTest := strings.Join(command[:], " ")
64-
assert.Equal(t, filepath.FromSlash(goldCommand), filepath.FromSlash(commandToTest))
66+
require.Equal(t, filepath.FromSlash(goldCommand), filepath.FromSlash(commandToTest))
6567

6668
// Other samd boards such as mkr1000 can be debugged using an external tool such as Atmel ICE connected to
6769
// the board debug port
@@ -83,5 +85,4 @@ func TestGetCommandLine(t *testing.T) {
8385
assert.Nil(t, err)
8486
commandToTest2 := strings.Join(command2[:], " ")
8587
assert.Equal(t, filepath.FromSlash(goldCommand2), filepath.FromSlash(commandToTest2))
86-
8788
}

Diff for: commands/debug/testdata/hello/hello.ino

Whitespace-only changes.

0 commit comments

Comments
 (0)