return fmt.Errorf("opus stream is uninitialized or already closed")
}
C.op_free(s.oggfile)
+ if closer, ok := s.read.(io.Closer); ok {
+ return closer.Close()
+ }
return nil
}
package opus
import (
+ "io"
"strings"
"testing"
)
-func Test(t *testing.T) {
+func TestStream(t *testing.T) {
// Simple testing, no actual decoding
reader := strings.NewReader("hello")
_, err := NewStream(reader)
t.Fatalf("Expected error while initializing illegal opus stream")
}
}
+
+func TestCloser(t *testing.T) {
+ /* TODO: test if stream.Close() also closes the underlying reader */
+}