aboutsummaryrefslogtreecommitdiff
path: root/page_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'page_test.go')
-rw-r--r--page_test.go21
1 files changed, 15 insertions, 6 deletions
diff --git a/page_test.go b/page_test.go
index be90096..7a4d327 100644
--- a/page_test.go
+++ b/page_test.go
@@ -1,17 +1,26 @@
package bolt
import (
- "github.com/stretchr/testify/assert"
"testing"
)
// Ensure that the page type can be returned in human readable format.
func TestPage_typ(t *testing.T) {
- assert.Equal(t, (&page{flags: branchPageFlag}).typ(), "branch")
- assert.Equal(t, (&page{flags: leafPageFlag}).typ(), "leaf")
- assert.Equal(t, (&page{flags: metaPageFlag}).typ(), "meta")
- assert.Equal(t, (&page{flags: freelistPageFlag}).typ(), "freelist")
- assert.Equal(t, (&page{flags: 20000}).typ(), "unknown<4e20>")
+ if typ := (&page{flags: branchPageFlag}).typ(); typ != "branch" {
+ t.Fatalf("exp=branch; got=%v", typ)
+ }
+ if typ := (&page{flags: leafPageFlag}).typ(); typ != "leaf" {
+ t.Fatalf("exp=leaf; got=%v", typ)
+ }
+ if typ := (&page{flags: metaPageFlag}).typ(); typ != "meta" {
+ t.Fatalf("exp=meta; got=%v", typ)
+ }
+ if typ := (&page{flags: freelistPageFlag}).typ(); typ != "freelist" {
+ t.Fatalf("exp=freelist; got=%v", typ)
+ }
+ if typ := (&page{flags: 20000}).typ(); typ != "unknown<4e20>" {
+ t.Fatalf("exp=unknown<4e20>; got=%v", typ)
+ }
}
// Ensure that the hexdump debugging function doesn't blow up.