MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / fixture

Function fixture

atomic-repository/tests/span_insert.rs:716–740  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

714}
715
716fn fixture() -> (tempfile::TempDir, Repository, Hash, Hash) {
717 let dir = tempfile::tempdir().unwrap();
718 let mut repo = Repository::init(dir.path()).unwrap();
719 repo.create_draft_view("source", "dev").unwrap();
720 repo.create_draft_view("target", "dev").unwrap();
721 let normal = Change::new(ChangeHeader::new("ordinary"), vec![], vec![], vec![]);
722 let normal = repo.save_change(&normal).unwrap();
723 {
724 let mut txn = repo.pristine().write_txn().unwrap();
725 txn.put_required_capability(SPAN_RANGE_CAPABILITY).unwrap();
726 txn.commit().unwrap();
727 }
728 let mut change = Change::new(ChangeHeader::new("span"), vec![], b"x\n".to_vec(), vec![]);
729 change.hashed.span = Some(SpanPatch::new(
730 vec![],
731 vec![SpanOp::Root {
732 path: "x".into(),
733 ordinal: 0,
734 start: 0,
735 end: 2,
736 }],
737 ));
738 let span = repo.save_change(&change).unwrap();
739 (dir, repo, normal, span)
740}
741
742#[test]
743fn direct_insert_does_not_publish_span_without_namespace_creation() {

Calls 9

create_draft_viewMethod · 0.80
write_txnMethod · 0.80
pristineMethod · 0.80
initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
save_changeMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected