mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Restored context test (not for github actions); Context destructor: just call leave_alternate_screen
This commit is contained in:
@@ -142,11 +142,7 @@ impl Context {
|
|||||||
impl Drop for Context {
|
impl Drop for Context {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
// Re-enable terminal stuff
|
// Re-enable terminal stuff
|
||||||
let _ = execute!(
|
self.leave_alternate_screen();
|
||||||
self.terminal.backend_mut(),
|
|
||||||
LeaveAlternateScreen,
|
|
||||||
DisableMouseCapture
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +163,7 @@ impl Default for FileTransferParams {
|
|||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ui_context_ft_params() {
|
fn test_ui_context_ft_params() {
|
||||||
@@ -178,31 +175,24 @@ mod tests {
|
|||||||
assert!(params.password.is_none());
|
assert!(params.password.is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
//use crate::filetransfer::sftp_transfer::SftpFileTransfer;
|
|
||||||
//use std::path::PathBuf;
|
|
||||||
|
|
||||||
/*
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ui_context_new() {
|
#[cfg(not(feature = "githubActions"))]
|
||||||
|
fn test_ui_context() {
|
||||||
// Prepare stuff
|
// Prepare stuff
|
||||||
Context::new(
|
let wrkdir: PathBuf = std::env::current_dir().unwrap_or(PathBuf::from("/"));
|
||||||
build_sftp_client(),
|
let mut ctx: Context = Context::new(
|
||||||
Localhost::new(PathBuf::from("/")).ok().unwrap(),
|
Localhost::new(wrkdir).ok().unwrap(),
|
||||||
|
None,
|
||||||
|
Some(String::from("alles kaput")),
|
||||||
);
|
);
|
||||||
|
assert!(ctx.error.is_some());
|
||||||
|
assert_eq!(ctx.get_error().unwrap().as_str(), "alles kaput");
|
||||||
|
assert!(ctx.error.is_none());
|
||||||
|
assert!(ctx.get_error().is_none());
|
||||||
|
// Try other methods
|
||||||
|
ctx.enter_alternate_screen();
|
||||||
|
ctx.clear_screen();
|
||||||
|
ctx.leave_alternate_screen();
|
||||||
|
drop(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_sftp_client() -> Box<dyn FileTransfer> {
|
|
||||||
let mut sftp_client: SftpFileTransfer = SftpFileTransfer::new();
|
|
||||||
// Connect to remote
|
|
||||||
assert!(sftp_client
|
|
||||||
.connect(
|
|
||||||
String::from("test.rebex.net"),
|
|
||||||
22,
|
|
||||||
Some(String::from("demo")),
|
|
||||||
Some(String::from("password"))
|
|
||||||
)
|
|
||||||
.is_ok());
|
|
||||||
Box::new(sftp_client)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user