diff options
| author | Kunal Mohan <kunalmohan99@gmail.com> | 2021-07-04 15:20:47 +0530 |
|---|---|---|
| committer | Kunal Mohan <kunalmohan99@gmail.com> | 2021-07-06 21:32:43 +0530 |
| commit | 82288c6a3d4a1347016fd7a5bd83fdbcbe9fcc1d (patch) | |
| tree | ee6bdf3b0894662b1816097f6fee173b4eac1af2 | |
| parent | docs(changelog): kill children properly (diff) | |
| download | sl0ppij-82288c6a3d4a1347016fd7a5bd83fdbcbe9fcc1d.tar.gz sl0ppij-82288c6a3d4a1347016fd7a5bd83fdbcbe9fcc1d.tar.xz sl0ppij-82288c6a3d4a1347016fd7a5bd83fdbcbe9fcc1d.zip | |
Remove test feature and hacks
| -rw-r--r-- | Cargo.toml | 3 | ||||
| -rw-r--r-- | zellij-client/Cargo.toml | 2 | ||||
| -rw-r--r-- | zellij-client/src/lib.rs | 12 | ||||
| -rw-r--r-- | zellij-server/Cargo.toml | 2 | ||||
| -rw-r--r-- | zellij-server/src/lib.rs | 18 | ||||
| -rw-r--r-- | zellij-server/src/panes/grid.rs | 7 | ||||
| -rw-r--r-- | zellij-server/src/panes/terminal_pane.rs | 1 | ||||
| -rw-r--r-- | zellij-server/src/pty.rs | 1 | ||||
| -rw-r--r-- | zellij-utils/Cargo.toml | 2 | ||||
| -rw-r--r-- | zellij-utils/src/setup.rs | 6 |
10 files changed, 4 insertions, 50 deletions
@@ -22,9 +22,6 @@ zellij-utils = { path = "zellij-utils/", version = "0.15.0" } insta = { version = "1.6.0", features = ["backtrace"] } ssh2 = "0.9.1" rand = "0.8.0" -zellij-utils = { path = "zellij-utils/", version = "0.15.0", features = ["test"] } -zellij-client = { path = "zellij-client/", version = "0.15.0", features = ["test"] } -zellij-server = { path = "zellij-server/", version = "0.15.0", features = ["test"] } [workspace] members = [ diff --git a/zellij-client/Cargo.toml b/zellij-client/Cargo.toml index 5eff3b81..5a2e314a 100644 --- a/zellij-client/Cargo.toml +++ b/zellij-client/Cargo.toml @@ -16,5 +16,3 @@ zellij-utils = { path = "../zellij-utils/", version = "0.15.0" } [dev-dependencies] insta = "1.6.0" -[features] -test = ["zellij-utils/test"] diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index f3e42a74..90732024 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -118,7 +118,6 @@ pub fn start_client( palette, }; - #[cfg(not(any(feature = "test", test)))] let first_msg = match info { ClientInfo::Attach(name, force, config_options) => { SESSION_NAME.set(name).unwrap(); @@ -140,16 +139,6 @@ pub fn start_client( ) } }; - #[cfg(any(feature = "test", test))] - let first_msg = { - let _ = SESSION_NAME.set("".into()); - ClientToServerMsg::NewClient( - client_attributes, - Box::new(opts), - Box::new(config_options.clone()), - layout, - ) - }; os_input.connect_to_server(&*ZELLIJ_IPC_PIPE); os_input.send_to_server(first_msg); @@ -167,7 +156,6 @@ pub fn start_client( > = channels::bounded(50); let send_client_instructions = SenderWithContext::new(send_client_instructions); - #[cfg(not(any(feature = "test", test)))] std::panic::set_hook({ use zellij_utils::errors::handle_panic; let send_client_instructions = send_client_instructions.clone(); diff --git a/zellij-server/Cargo.toml b/zellij-server/Cargo.toml index 16049c68..beefb82d 100644 --- a/zellij-server/Cargo.toml +++ b/zellij-server/Cargo.toml @@ -23,5 +23,3 @@ zellij-utils = { path = "../zellij-utils/", version = "0.15.0" } [dev-dependencies] insta = "1.6.0" -[features] -test = ["zellij-utils/test"] diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 6618c0a7..660acdc9 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -114,7 +114,6 @@ pub(crate) enum SessionState { } pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { - #[cfg(not(any(feature = "test", test)))] daemonize::Daemonize::new() .working_directory(std::env::current_dir().unwrap()) .umask(0o077) @@ -130,7 +129,6 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { let session_data: Arc<RwLock<Option<SessionMetaData>>> = Arc::new(RwLock::new(None)); let session_state = Arc::new(RwLock::new(SessionState::Uninitialized)); - #[cfg(not(any(feature = "test", test)))] std::panic::set_hook({ use zellij_utils::errors::handle_panic; let to_server = to_server.clone(); @@ -141,21 +139,6 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { let thread_handles = Arc::new(Mutex::new(Vec::new())); - #[cfg(any(feature = "test", test))] - thread_handles.lock().unwrap().push( - thread::Builder::new() - .name("server_router".to_string()) - .spawn({ - let session_data = session_data.clone(); - let os_input = os_input.clone(); - let to_server = to_server.clone(); - let session_state = session_state.clone(); - - move || route_thread_main(session_data, session_state, os_input, to_server) - }) - .unwrap(), - ); - #[cfg(not(any(feature = "test", test)))] let _ = thread::Builder::new() .name("server_listener".to_string()) .spawn({ @@ -306,7 +289,6 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { .unwrap() .drain(..) .for_each(|h| drop(h.join())); - #[cfg(not(any(feature = "test", test)))] drop(std::fs::remove_file(&socket_path)); } diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index 27eea695..df9b7a9c 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -1766,9 +1766,10 @@ impl Perform for Grid { _ => {} } } else { - let result = debug_log_to_file(format!("Unhandled csi: {}->{:?}", c, params)); - #[cfg(not(any(feature = "test", test)))] - result.unwrap(); + drop(debug_log_to_file(format!( + "Unhandled csi: {}->{:?}", + c, params + ))); } } diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs index 087817d6..0dc28aa7 100644 --- a/zellij-server/src/panes/terminal_pane.rs +++ b/zellij-server/src/panes/terminal_pane.rs @@ -387,7 +387,6 @@ impl TerminalPane { pub fn read_buffer_as_lines(&self) -> Vec<Vec<TerminalCharacter>> { self.grid.as_character_lines() } - #[cfg(any(feature = "test", test))] pub fn cursor_coordinates(&self) -> Option<(usize, usize)> { // (x, y) self.grid.cursor_coordinates() diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index cc23e77e..e7884f35 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -198,7 +198,6 @@ fn stream_terminal_bytes( } async_send_to_screen(senders.clone(), ScreenInstruction::Render).await; - #[cfg(not(any(feature = "test", test)))] // this is a little hacky, and is because the tests end the file as soon as // we read everything, rather than hanging until there is new data // a better solution would be to fix the test fakes, but this will do for now diff --git a/zellij-utils/Cargo.toml b/zellij-utils/Cargo.toml index a15be803..6b530ee9 100644 --- a/zellij-utils/Cargo.toml +++ b/zellij-utils/Cargo.toml @@ -36,5 +36,3 @@ features = ["unstable"] [dev-dependencies] tempfile = "3.2.0" -[features] -test = [] diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs index c46876ec..c25e1fb9 100644 --- a/zellij-utils/src/setup.rs +++ b/zellij-utils/src/setup.rs @@ -12,7 +12,6 @@ const CONFIG_LOCATION: &str = ".config/zellij"; const CONFIG_NAME: &str = "config.yaml"; static ARROW_SEPARATOR: &str = ""; -#[cfg(not(any(feature = "test", test)))] /// Goes through a predefined list and checks for an already /// existing config directory, returns the first match pub fn find_default_config_dir() -> Option<PathBuf> { @@ -23,11 +22,6 @@ pub fn find_default_config_dir() -> Option<PathBuf> { .flatten() } -#[cfg(any(feature = "test", test))] -pub fn find_default_config_dir() -> Option<PathBuf> { - None -} - /// Order in which config directories are checked fn default_config_dirs() -> Vec<Option<PathBuf>> { vec