mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-12 17:32:21 -04:00
process: Fix testing setup
This commit is contained in:
parent
cf962b26c5
commit
7e16f2978f
2 changed files with 49 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
use anyhow::{anyhow, Result};
|
||||
use std::cell::RefCell;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
use std::rc::Rc;
|
||||
|
@ -14,7 +14,7 @@ pub fn start() -> TestHandle {
|
|||
assert!(lock.borrow().as_ref().is_none());
|
||||
let test: Rc<Test> = Rc::new(Test {
|
||||
base: tempdir().expect("Couldn't create test directory"),
|
||||
process_cb: |_, _| Err(anyhow!("No current process_cb")),
|
||||
process_cb: Cell::new(|_, _| Err(anyhow!("No current process_cb"))),
|
||||
});
|
||||
*lock.borrow_mut() = Some(test.clone());
|
||||
TestHandle { test }
|
||||
|
@ -31,7 +31,7 @@ pub fn current() -> Rc<Test> {
|
|||
|
||||
pub struct Test {
|
||||
base: TempDir,
|
||||
pub process_cb: fn(&str, &[&OsStr]) -> Result<(i32, String)>,
|
||||
pub process_cb: Cell<fn(&str, &[&OsStr]) -> Result<(i32, String)>>,
|
||||
}
|
||||
|
||||
pub struct TestHandle {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue