You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: file_test.go
    path of file: ./repos/td/session/tdesktop
    
    the code of the file until where you have to start completion: package tdesktop

import (
	"bytes"
	"encoding/binary"
	"io"
	"io/fs"
	"testing"
	"testing/fstest"

	"github.com/stretchr/testify/require"
)

var (
	testBytes = bytes.Repeat([]byte("abcd"), 4)
	zeros     = make([]byte, 32)
)

func Test_open(t *testing.T) {
	b := bytes.NewBuffer(nil)
	if err := writeFile(b, testBytes, [4]byte{}); err != nil {
		t.Fatal(err)
	}

	tests := []struct {
		name     string
		fs       fs.FS
		fileName string
		wantErr  bool
	}{
		{"Empty", fstest.MapFS{}, "testfile", true},
		{"SkipInvalidLength", fstest.MapFS{
			// open should skip first file and read next
			"testfile0": &fstest.MapFile{
				Data: zeros[:4],
			},
			"testfile1": &fstest.MapFile{
				Data: b.Bytes(),
			},
		}, "testfile", false},
		{"SkipInvalidMagic", fstest.MapFS{
			// open should skip first file
    
func Test_fromFile(t *testing.T) {
	justBytes := func(data []byte, datas ...[]byte) func() io.Reader {
		return func() (r io.Reader) {
			r = bytes.NewReader(data)
			for _, d := range datas {
				r = io.MultiReader(r, bytes.NewReader(d))
			}
			return r
		}
	}

	tests := []struct {
		name    string
		data    func() io.Reader
		wantErr bool
	}{
		{"Empty", justBytes(nil), true},
		{"InvalidMagic", justBytes(zeros), true},
		{"InvalidLength", justBytes(tdesktopFileMagic[:], zeros[:8]), true},
		{"InvalidHash", justBytes(tdesktopFileMagic[:], zeros), true},
		{"WriteFile", func() io.Reader {
			b := bytes.NewBuffer(nil)
			if err := writeFile(b, testBytes, [4]byte{}); err != nil {
				t.Fatal(err)
			}
			return b
		}, false},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			a := require.New(t)
			if r, err := fromFile(tt.data()); tt.wantErr {
				a.Error(err)
			} else {
				a.NoError(err)
				a.Equal(testBytes, r.data)
			}
		})
	}
}