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

Method new

atomic-cli/tests/review_publish_native.rs:16–48  ·  view source on GitHub ↗
(callers: usize)

Source from the content-addressed store, hash-verified

14
15impl Fixture {
16 fn new(callers: usize) -> Self {
17 let root = tempfile::tempdir().unwrap();
18 let global = tempfile::tempdir().unwrap();
19 let mut repo = Repository::init(root.path()).unwrap();
20 repo.init_vault().unwrap();
21 let base = repo.current_view().to_owned();
22 let wc = repo.require_working_copy_id().unwrap();
23 std::fs::create_dir_all(root.path().join("src")).unwrap();
24 std::fs::write(
25 root.path().join("src/lib.rs"),
26 "mod consumers;\npub fn work(a:i32) {}\n",
27 )
28 .unwrap();
29 std::fs::write(
30 root.path().join("src/consumers.rs"),
31 (0..callers)
32 .map(|index| format!("pub fn consumer_{index}() {{ crate::work(1); }}\n"))
33 .collect::<String>(),
34 )
35 .unwrap();
36 repo.add(wc, "src", TrackingOptions::default()).unwrap();
37 repo.add(wc, ".vault", TrackingOptions::default()).unwrap();
38 record(&repo);
39 repo.create_draft_view("draft", &base).unwrap();
40 repo.switch_view(wc, "draft").unwrap();
41 std::fs::write(
42 root.path().join("src/lib.rs"),
43 "mod consumers;\npub fn work(a:i32,b:i32) { todo!(); }\n",
44 )
45 .unwrap();
46 record(&repo);
47 Self { root, global, base }
48 }
49
50 fn run(&self, args: &[&str]) -> Output {
51 Command::new(env!("CARGO_BIN_EXE_atomic"))

Callers

nothing calls this directly

Calls 11

create_draft_viewMethod · 0.80
writeFunction · 0.70
recordFunction · 0.70
initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
init_vaultMethod · 0.45
current_viewMethod · 0.45
addMethod · 0.45
switch_viewMethod · 0.45

Tested by

no test coverage detected