[audio] Add yet additional test coverage for audio adaptor

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2016-05-24 18:49:58 -07:00
parent 7314d73fd6
commit c111636c32
2 changed files with 15 additions and 1 deletions

View File

@ -33,7 +33,7 @@ func (a *AudioAdaptor) Sound(fileName string) []error {
var errorsList []error
if fileName == "" {
log.Println("Require filename for audio file.")
log.Println("Requires filename for audio file.")
errorsList = append(errorsList, errors.New("Requires filename for audio file."))
return errorsList
}

View File

@ -32,3 +32,17 @@ func TestAudioAdaptorCommandsUnknown(t *testing.T) {
gobottest.Refute(t, cmd, "mpg123")
gobottest.Assert(t, err.Error(), "Unknown filetype for audio file.")
}
func TestAudioAdaptorSoundWithNoFilename(t *testing.T) {
a := NewAudioAdaptor("tester")
errors := a.Sound("")
gobottest.Assert(t, errors[0].Error(), "Requires filename for audio file.")
}
func TestAudioAdaptorSoundWithNonexistingFilename(t *testing.T) {
a := NewAudioAdaptor("tester")
errors := a.Sound("doesnotexist.mp3")
gobottest.Assert(t, errors[0].Error(), "stat doesnotexist.mp3: no such file or directory")
}