diff options
author | siddharth ravikumar <s@ricketyspace.net> | 2022-11-25 20:18:44 -0500 |
---|---|---|
committer | siddharth ravikumar <s@ricketyspace.net> | 2022-11-25 20:20:37 -0500 |
commit | 43ea9acb421baa6f3379af9ae4508dfb4bf339ab (patch) | |
tree | e75f28f4fb226b427078c7d880aebb7726ee2f02 /file/file_test.go | |
parent | c4b7b46835ae6118ffaa7aa0b234211b3fdc28cc (diff) |
file: add `ReadFile`
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 + } +} |