26 lines
360 B
Go
26 lines
360 B
Go
package main
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"testing"
|
|
)
|
|
|
|
func Test_Tape_Write(t *testing.T) {
|
|
file, clean := createTempFile(t, "12345")
|
|
defer clean()
|
|
|
|
tape := Tape{File: file}
|
|
|
|
tape.Write([]byte("foo"))
|
|
|
|
file.Seek(0, 0)
|
|
contents, _ := ioutil.ReadAll(file)
|
|
|
|
got := string(contents)
|
|
want := "foo"
|
|
|
|
if got != want {
|
|
t.Errorf("got %v want %v", got, want)
|
|
}
|
|
}
|