From 58b0b68064fcec33dbb53a5f49567f5755f8cfcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20Crespo?= Date: Sat, 13 Jul 2024 06:04:35 +0000 Subject: [PATCH] T --- bagit_test.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/bagit_test.go b/bagit_test.go index d4de325..9890455 100644 --- a/bagit_test.go +++ b/bagit_test.go @@ -11,19 +11,27 @@ import ( "gotest.tools/v3/fs" ) -func setUp(t *testing.T) *bagit.BagIt { - t.Helper() +func setUp(tb testing.TB) *bagit.BagIt { + tb.Helper() b, err := bagit.NewBagIt() - assert.NilError(t, err) + assert.NilError(tb, err) - t.Cleanup(func() { - assert.NilError(t, b.Cleanup()) + tb.Cleanup(func() { + assert.NilError(tb, b.Cleanup()) }) return b } +func BenchmarkValidate(b *testing.B) { + bagit := setUp(b) + b.ResetTimer() + for i := 0; i < b.N; i++ { + _ = bagit.Validate("internal/testdata/valid-bag") + } +} + func TestValidateBag(t *testing.T) { t.Parallel()