Ensure that a setting a value while the transaction is closed returns an error.
(t *testing.T)
| 258 | |
| 259 | // Ensure that a setting a value while the transaction is closed returns an error. |
| 260 | func TestBucket_Put_Closed(t *testing.T) { |
| 261 | db := btesting.MustCreateDB(t) |
| 262 | tx, err := db.Begin(true) |
| 263 | if err != nil { |
| 264 | t.Fatal(err) |
| 265 | } |
| 266 | |
| 267 | b, err := tx.CreateBucket([]byte("widgets")) |
| 268 | if err != nil { |
| 269 | t.Fatal(err) |
| 270 | } |
| 271 | |
| 272 | if err := tx.Rollback(); err != nil { |
| 273 | t.Fatal(err) |
| 274 | } |
| 275 | |
| 276 | if err := b.Put([]byte("foo"), []byte("bar")); err != berrors.ErrTxClosed { |
| 277 | t.Fatalf("unexpected error: %s", err) |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | // Ensure that setting a value on a read-only bucket returns an error. |
| 282 | func TestBucket_Put_ReadOnly(t *testing.T) { |
nothing calls this directly
no test coverage detected