Ensure a database can return an error through a read-only transactional block.
(t *testing.T)
| 1159 | |
| 1160 | // Ensure a database can return an error through a read-only transactional block. |
| 1161 | func TestDB_View_Error(t *testing.T) { |
| 1162 | db := btesting.MustCreateDB(t) |
| 1163 | |
| 1164 | if err := db.View(func(tx *bolt.Tx) error { |
| 1165 | return errors.New("xxx") |
| 1166 | }); err == nil || err.Error() != "xxx" { |
| 1167 | t.Fatalf("unexpected error: %s", err) |
| 1168 | } |
| 1169 | } |
| 1170 | |
| 1171 | // Ensure a read transaction that panics does not hold open locks. |
| 1172 | func TestDB_View_Panic(t *testing.T) { |
nothing calls this directly
no test coverage detected