func cmdAndAssert(key string, selectedPlaylist string, selectedTrack string, playlistPosition int) { cmd(key) if !ui.CuiAssertSelectedPlaylist(selectedPlaylist) { output.WriteString("Playlist '" + selectedPlaylist + "' not found on position " + strconv.Itoa(playlistPosition)) cmd("q") } sleep() }
func assert(expectedPlaylist string, expectedTrack string) { if valid, actualPlaylist := ui.CuiAssertSelectedPlaylist(expectedPlaylist); !valid { output.WriteString(fmt.Sprintf("Playlist '%v' not found on position but '%v'", expectedPlaylist, actualPlaylist)) cmd("q") panic("Boom!") } if expectedTrack != "" { if valid, actualTrack := ui.CuiAssertSelectedTrack(expectedTrack); !valid { output.WriteString(fmt.Sprintf("Track '%v' not found but '%v'", expectedTrack, actualTrack)) cmd("q") panic("Boom!") } } }