()
| 562 | |
| 563 | #[test] |
| 564 | fn index_maintained_on_put() { |
| 565 | let mut e = make_engine(); |
| 566 | let n = now(); |
| 567 | |
| 568 | // Create index first (no backfill needed — empty collection). |
| 569 | e.register_index(1, "c", "status", 0, false, n); |
| 570 | |
| 571 | // Insert. |
| 572 | e.put( |
| 573 | 1, |
| 574 | "c", |
| 575 | b"k1", |
| 576 | &mp_obj(&[("status", "active")]), |
| 577 | 0, |
| 578 | n, |
| 579 | Surrogate::ZERO, |
| 580 | ); |
| 581 | assert_eq!(e.index_lookup_eq(1, "c", "status", b"active").len(), 1); |
| 582 | |
| 583 | // Update: status changes. |
| 584 | e.put( |
| 585 | 1, |
| 586 | "c", |
| 587 | b"k1", |
| 588 | &mp_obj(&[("status", "inactive")]), |
| 589 | 0, |
| 590 | n, |
| 591 | Surrogate::ZERO, |
| 592 | ); |
| 593 | assert!(e.index_lookup_eq(1, "c", "status", b"active").is_empty()); |
| 594 | assert_eq!(e.index_lookup_eq(1, "c", "status", b"inactive").len(), 1); |
| 595 | } |
| 596 | |
| 597 | #[test] |
| 598 | fn index_cleaned_on_delete() { |
nothing calls this directly
no test coverage detected