Resurrect commented-out worktree test
This commit is contained in:
parent
cded00cf29
commit
fabc19402a
1 changed files with 52 additions and 48 deletions
|
@ -608,51 +608,55 @@ pub fn match_paths(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[cfg(test)]
|
#[cfg(test)]
|
||||||
// mod test {
|
mod test {
|
||||||
// use super::*;
|
use super::*;
|
||||||
// use crate::test_utils::*;
|
use crate::test::*;
|
||||||
// use anyhow::Result;
|
use anyhow::Result;
|
||||||
// use std::os::unix;
|
use gpui::App;
|
||||||
//
|
use serde_json::json;
|
||||||
// // #[test]
|
use std::os::unix;
|
||||||
// // fn test_populate_and_search() -> Result<()> {
|
|
||||||
// // let dir = build_tempdir(json!({
|
#[test]
|
||||||
// // "root": {
|
fn test_populate_and_search() -> Result<()> {
|
||||||
// // "apple": "",
|
App::test((), |mut app| async move {
|
||||||
// // "banana": {
|
let dir = temp_tree(json!({
|
||||||
// // "carrot": {
|
"root": {
|
||||||
// // "date": "",
|
"apple": "",
|
||||||
// // "endive": "",
|
"banana": {
|
||||||
// // }
|
"carrot": {
|
||||||
// // },
|
"date": "",
|
||||||
// // "fennel": {
|
"endive": "",
|
||||||
// // "grape": "",
|
}
|
||||||
// // }
|
},
|
||||||
// // }
|
"fennel": {
|
||||||
// // }));
|
"grape": "",
|
||||||
// //
|
}
|
||||||
// // let root_link_path = dir.path().join("root_link");
|
}
|
||||||
// // unix::fs::symlink(&dir.path().join("root"), &root_link_path)?;
|
}));
|
||||||
// //
|
|
||||||
// // let tree = Worktree::new(1, root_link_path, None);
|
let root_link_path = dir.path().join("root_link");
|
||||||
// // let (tx, _) = channel::unbounded();
|
unix::fs::symlink(&dir.path().join("root"), &root_link_path)?;
|
||||||
// // tree.populate(&tx)?;
|
|
||||||
// // assert_eq!(tree.file_count(), 4);
|
let tree = app.add_model(|ctx| Worktree::new(1, root_link_path, Some(ctx)));
|
||||||
// //
|
app.finish_pending_tasks().await;
|
||||||
// // let results = match_paths(&[tree.clone()], "bna", false, false, 10)
|
|
||||||
// // .iter()
|
tree.read(&app, |tree, _| {
|
||||||
// // .map(|result| tree.entry_path(result.entry_id))
|
assert_eq!(tree.file_count(), 4);
|
||||||
// // .collect::<Result<Vec<PathBuf>, _>>()?;
|
let results = match_paths(&[tree.clone()], "bna", false, false, 10)
|
||||||
// //
|
.iter()
|
||||||
// // assert_eq!(
|
.map(|result| tree.entry_path(result.entry_id))
|
||||||
// // results,
|
.collect::<Result<Vec<PathBuf>, _>>()
|
||||||
// // vec![
|
.unwrap();
|
||||||
// // PathBuf::from("root_link/banana/carrot/date"),
|
assert_eq!(
|
||||||
// // PathBuf::from("root_link/banana/carrot/endive"),
|
results,
|
||||||
// // ]
|
vec![
|
||||||
// // );
|
PathBuf::from("root_link/banana/carrot/date"),
|
||||||
// //
|
PathBuf::from("root_link/banana/carrot/endive"),
|
||||||
// // Ok(())
|
]
|
||||||
// // }
|
);
|
||||||
// }
|
});
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue