| 1967 | #[test] |
| 1968 | fn independent_span_edits_render_in_both_insert_orders() -> Result<()> { |
| 1969 | fn projection_ids( |
| 1970 | repo: &Pristine, |
| 1971 | store: &MemoryChangeStore, |
| 1972 | view_name: &str, |
| 1973 | inode: Inode, |
| 1974 | ) -> Result<( |
| 1975 | SpanProjectionId, |
| 1976 | Vec<(SpanProjectionId, Vec<SpanProjectionId>)>, |
| 1977 | )> { |
| 1978 | let txn = repo.read_txn()?; |
| 1979 | let view = txn.get_view(view_name)?.context("view missing")?; |
| 1980 | let visible = EffectiveProjectionClosure::try_from_membership( |
| 1981 | &txn, |
| 1982 | &txn.view_membership_set(&view)?, |
| 1983 | )?; |
| 1984 | let state = SpanRenderContext::new(&txn, store, &visible)? |
| 1985 | .record_state(inode)? |
| 1986 | .context("span state missing")?; |
| 1987 | let snapshot = state.semantic_snapshot()?; |
| 1988 | Ok(( |
| 1989 | snapshot.id, |
| 1990 | snapshot |
| 1991 | .lines |
| 1992 | .into_iter() |
| 1993 | .map(|line| { |
| 1994 | ( |
| 1995 | line.id, |
| 1996 | line.tokens.into_iter().map(|token| token.id).collect(), |
| 1997 | ) |
| 1998 | }) |
| 1999 | .collect(), |
| 2000 | )) |
| 2001 | } |
| 2002 | let dir = tempfile::tempdir()?; |
| 2003 | let path = dir.path().join("pristine.redb"); |
| 2004 | let repo = Pristine::open(&path)?; |