1use std::{fs::File, path::Path};
2
3use db::pane::{DockAnchor, SerializedDockPane};
4
5const TEST_FILE: &'static str = "test-db.db";
6
7fn main() -> anyhow::Result<()> {
8 env_logger::init();
9
10 let db = db::Db::open_in_memory();
11 if db.real().is_none() {
12 return Err(anyhow::anyhow!("Migrations failed"));
13 }
14 let file = Path::new(TEST_FILE);
15
16 let f = File::create(file)?;
17 drop(f);
18
19 let workspace_1 = db.workspace_for_roots(&["/tmp"]);
20 let workspace_2 = db.workspace_for_roots(&["/tmp", "/tmp2"]);
21 let workspace_3 = db.workspace_for_roots(&["/tmp3", "/tmp2"]);
22
23 db.save_dock_pane(
24 workspace_1.workspace_id,
25 &SerializedDockPane {
26 anchor_position: DockAnchor::Expanded,
27 visible: true,
28 },
29 );
30 db.save_dock_pane(
31 workspace_2.workspace_id,
32 &SerializedDockPane {
33 anchor_position: DockAnchor::Bottom,
34 visible: true,
35 },
36 );
37 db.save_dock_pane(
38 workspace_3.workspace_id,
39 &SerializedDockPane {
40 anchor_position: DockAnchor::Right,
41 visible: false,
42 },
43 );
44
45 db.write_to(file).ok();
46
47 println!("Wrote database!");
48
49 Ok(())
50}