mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-10-04 04:31:00 +00:00
test: migrate most tests to testify
testify makes most bog-standard test checks much easier to read and maintain, and is quite widely used. It wasn't really well known back when go-mtree was first written, but the migration is fairly straight-forward for most tests. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
parent
f2b48a0e2f
commit
3252a4ad82
55 changed files with 22620 additions and 886 deletions
|
@ -3,6 +3,9 @@ package mtree
|
|||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -14,18 +17,11 @@ var (
|
|||
// testing that the cksum function matches that of cksum(1) utility (silly POSIX crc32)
|
||||
func TestCksum(t *testing.T) {
|
||||
fh, err := os.Open(checkFile)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
defer fh.Close()
|
||||
|
||||
sum, i, err := cksum(fh)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if i != checkSize {
|
||||
t.Errorf("%q: expected size %d, got %d", checkFile, checkSize, i)
|
||||
}
|
||||
if sum != checkSum {
|
||||
t.Errorf("%q: expected sum %d, got %d", checkFile, checkSum, sum)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, checkSize, i, "checksum size mismatch")
|
||||
assert.Equal(t, checkSum, sum, "checksum mismatch")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue