summaryrefslogtreecommitdiffstats
path: root/file/file_test.go
blob: 143b0726851a2e6e52b183888eec98229967d281 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// SPDX-License-Identifier: ISC
// Copyright © 2022 siddharth <s@ricketyspace.net>

package file

import (
	"bytes"
	"testing"
)

func TestReadFile(t *testing.T) {
	expectedBS := []byte("42 is the answer.\n")
	bs, err := ReadFile("testdata/life.txt")
	if err != nil {
		t.Errorf("read file: %v", err)
		return
	}
	if !bytes.Equal(bs, expectedBS) {
		t.Errorf("read content: '%s' != '%s'", bs, expectedBS)
		return
	}
}