mirror of
https://github.com/tjboldt/Apple2-IO-RPi.git
synced 2024-11-26 13:49:16 +00:00
27 lines
516 B
Go
27 lines
516 B
Go
|
package handlers
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/a2io"
|
||
|
)
|
||
|
|
||
|
func TestLoadFileCommandReturnZeroLengthOnFileNotFound(t *testing.T) {
|
||
|
mockIoData := a2io.MockIoData{
|
||
|
BytesToRead: []byte("FILE_DOES_NOT_EXIST\x00"),
|
||
|
BytesWritten: make([]byte, 1000),
|
||
|
}
|
||
|
|
||
|
mockIo := a2io.MockIo{Data: &mockIoData}
|
||
|
|
||
|
SetCommunication(&mockIo)
|
||
|
|
||
|
LoadFileCommand()
|
||
|
|
||
|
got := mockIoData.BytesWritten
|
||
|
|
||
|
if got[0] != 0 && got[1] != 0 {
|
||
|
t.Errorf("MenuCommand() sent = %s; want 00", got)
|
||
|
}
|
||
|
}
|