Skip to content

Commit

Permalink
Fixed incorrect tests
Browse files Browse the repository at this point in the history
The previous fixes now let the CLI to produce the correct output.
  • Loading branch information
cmaglie committed Oct 7, 2024
1 parent 2194a37 commit e13d66e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
27 changes: 11 additions & 16 deletions internal/integrationtest/monitor/monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,30 +287,25 @@ yun.serial.disableDTR=true
stdout, _, err := cli.RunWithCustomInput(quitMonitor(), "monitor", "-b", "arduino:avr:uno", "--raw", "--profile", "profile1", sketchWithPortAndFQBN)
require.NoError(t, err)
require.Contains(t, string(stdout), "Opened port: /dev/ttyDEF")
require.Contains(t, string(stdout), "Configuration rts = off")
require.Contains(t, string(stdout), "Configuration rts = on") // This is taken from profile-downloaded platform that is not patched for test
require.Contains(t, string(stdout), "Configuration dtr = on")
})

t.Run("WithDefaultPortAndConfig", func(t *testing.T) {
stdout, _, err := cli.RunWithCustomInput(quitMonitor(), "monitor", "-b", "arduino:avr:uno", "--raw", "--profile", "profile1", sketchWithPortAndConfig)
require.NoError(t, err)
require.Contains(t, string(stdout), "Opened port: /dev/ttyDEF")
require.Contains(t, string(stdout), "Configuration rts = off")
require.Contains(t, string(stdout), "Configuration dtr = on")
require.Contains(t, string(stdout), "Configuration baudrate = 57600")
require.Contains(t, string(stdout), "Configuration bits = 9")
require.Contains(t, string(stdout), "Configuration parity = none")
require.Contains(t, string(stdout), "Configuration stop_bits = 1")
_, stderr, err := cli.RunWithCustomInput(quitMonitor(), "monitor", "-b", "arduino:avr:uno", "--raw", "--profile", "profile1", sketchWithPortAndConfig)
require.Error(t, err)
require.Contains(t, string(stderr), "Profile 'profile1' not found")
require.Contains(t, string(stderr), "Unknown FQBN: unknown package arduino")
})

t.Run("WithDefaultPortAndConfigAndProfile", func(t *testing.T) {
stdout, _, err := cli.RunWithCustomInput(quitMonitor(), "monitor", "-b", "arduino:avr:uno", "--raw", "--profile", "profile1", sketchWithPortAndConfigAndProfile)
stdout, _, err := cli.RunWithCustomInput(quitMonitor(), "monitor", "-b", "arduino:avr:uno", "--raw", "--profile", "uno", sketchWithPortAndConfigAndProfile)
require.NoError(t, err)
require.Contains(t, string(stdout), "Opened port: /dev/ttyDEF")
require.Contains(t, string(stdout), "Configuration rts = off")
require.Contains(t, string(stdout), "Opened port: /dev/ttyPROF")
require.Contains(t, string(stdout), "Configuration rts = on") // This is taken from profile-downloaded platform that is not patched for test
require.Contains(t, string(stdout), "Configuration dtr = on")
require.Contains(t, string(stdout), "Configuration baudrate = 57600")
require.Contains(t, string(stdout), "Configuration bits = 9")
require.Contains(t, string(stdout), "Configuration baudrate = 19200")
require.Contains(t, string(stdout), "Configuration bits = 8")
require.Contains(t, string(stdout), "Configuration parity = none")
require.Contains(t, string(stdout), "Configuration stop_bits = 1")
})
Expand Down Expand Up @@ -377,7 +372,7 @@ yun.serial.disableDTR=true
stdout, _, err := cli.RunWithCustomInput(quitMonitor(), "monitor", "-p", "/dev/ttyARGS", "-b", "arduino:avr:uno", "--raw", "--profile", "profile1", sketchWithPortAndFQBN)
require.NoError(t, err)
require.Contains(t, string(stdout), "Opened port: /dev/ttyARGS")
require.Contains(t, string(stdout), "Configuration rts = off")
require.Contains(t, string(stdout), "Configuration rts = on") // This is taken from profile-downloaded platform that is not patched for test
require.Contains(t, string(stdout), "Configuration dtr = on")
})
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
default_port: /dev/ttyDEF
default_fqbn: arduino:avr:yun
profiles:
profile1:
fqbn: "broken_fqbn"
platforms:
- platform: arduino:avr (1.8.6)

default_port: /dev/ttyDEF
default_fqbn: arduino:avr:yun

0 comments on commit e13d66e

Please sign in to comment.