summaryrefslogtreecommitdiffstats
path: root/zellij-client/src/old_config_converter/unit
diff options
context:
space:
mode:
Diffstat (limited to 'zellij-client/src/old_config_converter/unit')
-rw-r--r--zellij-client/src/old_config_converter/unit/convert_config_tests.rs126
-rw-r--r--zellij-client/src/old_config_converter/unit/convert_layout_tests.rs142
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout.yaml90
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout_htop_command.yaml93
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_default_yaml_config.yaml639
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_default_yaml_layout.yaml22
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_custom_options.yaml639
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_env_variables.yaml644
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_global_keybind_unbinds.yaml639
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_themes.yaml677
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_ui.yaml643
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbind_all_keys_per_mode.yaml639
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbinds_in_mode.yaml640
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config.yaml34
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config_and_session_name.yaml36
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name.yaml24
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name_and_attach_false.yaml25
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/run_htop_layout.yaml21
-rw-r--r--zellij-client/src/old_config_converter/unit/fixtures/run_htop_layout_with_plugins.yaml35
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_custom_options.snap411
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_env_variables.snap415
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_global_keybind_unbinds.snap411
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_keybind_unbinds_in_mode.snap411
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_themes_config.snap451
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_ui_config.snap416
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_unbind_all_keys_per_mode.snap410
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__properly_convert_default_config.snap410
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_default_layout.snap14
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_1.snap61
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_2.snap60
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_3.snap19
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_4.snap27
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_config.snap24
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_config_and_session_name.snap26
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_session_name.snap16
-rw-r--r--zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_session_name_and_attach_false.snap16
36 files changed, 9406 insertions, 0 deletions
diff --git a/zellij-client/src/old_config_converter/unit/convert_config_tests.rs b/zellij-client/src/old_config_converter/unit/convert_config_tests.rs
new file mode 100644
index 000000000..444d8775d
--- /dev/null
+++ b/zellij-client/src/old_config_converter/unit/convert_config_tests.rs
@@ -0,0 +1,126 @@
+use crate::old_config_converter::config_yaml_to_config_kdl;
+use insta::assert_snapshot;
+use std::path::PathBuf;
+use std::{fs::File, io::prelude::*};
+
+#[test]
+fn properly_convert_default_config() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/old_default_yaml_config.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn convert_config_with_custom_options() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_custom_options.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn convert_config_with_keybind_unbinds_in_mode() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbinds_in_mode.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn convert_config_with_global_keybind_unbinds() -> Result<(), String> {
+ let fixture = PathBuf::from(format!("{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_global_keybind_unbinds.yaml", env!("CARGO_MANIFEST_DIR")));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn convert_config_with_unbind_all_keys_per_mode() -> Result<(), String> {
+ let fixture = PathBuf::from(format!("{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbind_all_keys_per_mode.yaml", env!("CARGO_MANIFEST_DIR")));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn convert_config_with_env_variables() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_env_variables.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn convert_config_with_ui_config() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_ui.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn convert_config_with_themes_config() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_themes.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
diff --git a/zellij-client/src/old_config_converter/unit/convert_layout_tests.rs b/zellij-client/src/old_config_converter/unit/convert_layout_tests.rs
new file mode 100644
index 000000000..30e689bb1
--- /dev/null
+++ b/zellij-client/src/old_config_converter/unit/convert_layout_tests.rs
@@ -0,0 +1,142 @@
+use crate::old_config_converter::layout_yaml_to_layout_kdl;
+use insta::assert_snapshot;
+use std::path::PathBuf;
+use std::{fs::File, io::prelude::*};
+
+#[test]
+fn properly_convert_default_layout() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/old_default_yaml_layout.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn properly_convert_layout_with_session_name() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn properly_convert_layout_with_session_name_and_attach_false() -> Result<(), String> {
+ let fixture = PathBuf::from(format!("{}/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name_and_attach_false.yaml", env!("CARGO_MANIFEST_DIR")));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn properly_convert_layout_with_config() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn properly_convert_layout_with_config_and_session_name() -> Result<(), String> {
+ let fixture = PathBuf::from(format!("{}/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config_and_session_name.yaml", env!("CARGO_MANIFEST_DIR")));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn properly_convert_layout_example_1() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/multiple_tabs_layout.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn properly_convert_layout_example_2() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/multiple_tabs_layout_htop_command.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn properly_convert_layout_example_3() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/run_htop_layout.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
+
+#[test]
+fn properly_convert_layout_example_4() -> Result<(), String> {
+ let fixture = PathBuf::from(format!(
+ "{}/src/old_config_converter/unit/fixtures/run_htop_layout_with_plugins.yaml",
+ env!("CARGO_MANIFEST_DIR")
+ ));
+ let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?;
+ let mut raw_config_file = String::new();
+ handle
+ .read_to_string(&mut raw_config_file)
+ .map_err(|e| format!("{}", e))?;
+ let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?;
+ assert_snapshot!(format!("{}", kdl_config));
+ Ok(())
+}
diff --git a/zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout.yaml b/zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout.yaml
new file mode 100644
index 000000000..04fca4a51
--- /dev/null
+++ b/zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout.yaml
@@ -0,0 +1,90 @@
+---
+template:
+ direction: Horizontal
+ parts:
+ - direction: Vertical
+ split_size:
+ Fixed: 1
+ run:
+ plugin:
+ location: "zellij:tab-bar"
+ borderless: true
+ - direction: Vertical
+ body: true
+ - direction: Vertical
+ split_size:
+ Fixed: 2
+ run:
+ plugin:
+ location: "zellij:status-bar"
+ borderless: true
+
+tabs:
+- direction: Vertical
+ parts:
+ - direction: Vertical
+ split_size:
+ Percent: 50
+ - direction: Vertical
+ split_size:
+ Percent: 50
+- direction: Vertical
+- direction: Vertical
+ parts:
+ - direction: Vertical
+ split_size:
+ Percent: 50
+ - direction: Vertical
+ split_size:
+ Percent: 50
+- direction: Vertical
+ parts:
+ - direction: Vertical
+ split_size:
+ Percent: 50
+ - direction: Horizontal
+ split_size:
+ Percent: 50
+ parts:
+ - direction: Vertical
+ split_size:
+ Percent: 50
+ - direction: Vertical
+ split_size:
+ Percent: 50
+- direction: Vertical
+- direction: Vertical
+- direction: Vertical
+- direction: Vertical
+ parts:
+ - direction: Vertical
+ split_size:
+ Percent: 20
+ run:
+ plugin:
+ location: "zellij:strider"
+ - direction: Horizontal
+ split_size:
+ Percent: 80
+ parts:
+ - direction: Vertical
+ split_size:
+ Percent: 50
+ - direction: Vertical
+ split_size:
+ Percent: 50
+- direction: Vertical
+ parts:
+ - direction: Vertical
+ split_size:
+ Percent: 40
+ - direction: Horizontal
+ split_size:
+ Percent: 60
+ parts:
+ - direction: Vertical
+ split_size:
+ Percent: 50
+ - direction: