diff options
Diffstat (limited to 'file/file_test.go')
-rw-r--r-- | file/file_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/file/file_test.go b/file/file_test.go new file mode 100644 index 0000000..143b072 --- /dev/null +++ b/file/file_test.go @@ -0,0 +1,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 + } +} |