(callers: usize)
| 14 | |
| 15 | impl 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")) |
nothing calls this directly
no test coverage detected