mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 22:34:13 +00:00
30 lines
755 B
Rust
30 lines
755 B
Rust
use std::{fs::File, path::Path};
|
|
|
|
const TEST_FILE: &'static str = "test-db.db";
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
env_logger::init();
|
|
let db = db::Db::open_in_memory("db");
|
|
|
|
let file = Path::new(TEST_FILE);
|
|
|
|
let f = File::create(file)?;
|
|
drop(f);
|
|
|
|
db.write_kvp("test", "1")?;
|
|
db.write_kvp("test-2", "2")?;
|
|
|
|
db.workspace_for_roots(&["/tmp1"]);
|
|
db.workspace_for_roots(&["/tmp1", "/tmp2"]);
|
|
db.workspace_for_roots(&["/tmp1", "/tmp2", "/tmp3"]);
|
|
db.workspace_for_roots(&["/tmp2", "/tmp3"]);
|
|
db.workspace_for_roots(&["/tmp2", "/tmp3", "/tmp4"]);
|
|
db.workspace_for_roots(&["/tmp2", "/tmp4"]);
|
|
db.workspace_for_roots(&["/tmp2"]);
|
|
|
|
db.write_to(file).ok();
|
|
|
|
println!("Wrote database!");
|
|
|
|
Ok(())
|
|
}
|