@@ -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-
3632func 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}
0 commit comments