diff options
Diffstat (limited to 'zellij-utils/src/input/unit/layout_test.rs')
-rw-r--r-- | zellij-utils/src/input/unit/layout_test.rs | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/zellij-utils/src/input/unit/layout_test.rs b/zellij-utils/src/input/unit/layout_test.rs index 1addb9382..9614eef46 100644 --- a/zellij-utils/src/input/unit/layout_test.rs +++ b/zellij-utils/src/input/unit/layout_test.rs @@ -269,6 +269,19 @@ fn layout_with_command_panes_and_cwd_and_args() { } #[test] +fn layout_with_command_panes_and_close_on_exit() { + let kdl_layout = r#" + layout { + pane command="htop" { + close_on_exit true + } + } + "#; + let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None).unwrap(); + assert_snapshot!(format!("{:#?}", layout)); +} + +#[test] fn layout_with_plugin_panes() { let kdl_layout = r#" layout { @@ -1034,6 +1047,24 @@ fn args_override_args_in_template() { } #[test] +fn close_on_exit_overrides_close_on_exit_in_template() { + let kdl_layout = r#" + layout { + pane_template name="tail" { + command "tail" + close_on_exit false + } + tail + tail { + close_on_exit true + } + } + "#; + let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None).unwrap(); + assert_snapshot!(format!("{:#?}", layout)); +} + +#[test] fn args_added_to_args_in_template() { let kdl_layout = r#" layout { @@ -1051,6 +1082,23 @@ fn args_added_to_args_in_template() { } #[test] +fn close_on_exit_added_to_close_on_exit_in_template() { + let kdl_layout = r#" + layout { + pane_template name="tail" { + command "tail" + } + tail + tail { + close_on_exit true + } + } + "#; + let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None).unwrap(); + assert_snapshot!(format!("{:#?}", layout)); +} + +#[test] fn cwd_override_cwd_in_template() { let kdl_layout = r#" layout { @@ -1126,6 +1174,19 @@ fn error_on_bare_args_without_command() { } #[test] +fn error_on_bare_close_on_exit_without_command() { + let kdl_layout = r#" + layout { + pane { + close_on_exit true + } + } + "#; + let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None); + assert!(layout.is_err(), "error provided"); +} + +#[test] fn error_on_bare_args_in_template_without_command() { let kdl_layout = r#" layout { @@ -1140,6 +1201,20 @@ fn error_on_bare_args_in_template_without_command() { } #[test] +fn error_on_bare_close_on_exit_in_template_without_command() { + let kdl_layout = r#" + layout { + pane_template name="my_template" + my_template { + close_on_exit true + } + } + "#; + let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None); + assert!(layout.is_err(), "error provided"); +} + +#[test] fn pane_template_command_with_cwd_overriden_by_its_consumers_command_cwd() { let kdl_layout = r#" layout { |