1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-11 14:25:57 +03:00

deps: remove smol-potat, update futures-lite

smol-potat hasn't had updates in 4 years and was bifurcating some
big deps.  It wasn't necessary; it was trivially easy to replace
with smol::block_on with no meaningful increase in boilerplate,
and the result is much more understandable in purpose and effect.
This commit is contained in:
Wez Furlong 2024-05-13 11:43:10 -07:00
parent 944e0b29b6
commit 6ad0da98d8
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
6 changed files with 984 additions and 1063 deletions

183
Cargo.lock generated
View File

@ -225,8 +225,8 @@ checksum = "b10202063978b3351199d68f8b22c4e47e4b1b822f8d43fd862d5ea8c006b29a"
dependencies = [
"async-task",
"concurrent-queue",
"fastrand 2.1.0",
"futures-lite 2.3.0",
"fastrand",
"futures-lite",
"slab",
]
@ -236,29 +236,9 @@ version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a"
dependencies = [
"async-lock 3.3.0",
"async-lock",
"blocking",
"futures-lite 2.3.0",
]
[[package]]
name = "async-io"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
dependencies = [
"async-lock 2.8.0",
"autocfg",
"cfg-if",
"concurrent-queue",
"futures-lite 1.13.0",
"log",
"parking",
"polling 2.8.0",
"rustix 0.37.27",
"slab",
"socket2 0.4.10",
"waker-fn",
"futures-lite",
]
[[package]]
@ -267,28 +247,19 @@ version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884"
dependencies = [
"async-lock 3.3.0",
"async-lock",
"cfg-if",
"concurrent-queue",
"futures-io",
"futures-lite 2.3.0",
"futures-lite",
"parking",
"polling 3.7.0",
"polling",
"rustix 0.38.34",
"slab",
"tracing",
"windows-sys 0.52.0",
]
[[package]]
name = "async-lock"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b"
dependencies = [
"event-listener 2.5.3",
]
[[package]]
name = "async-lock"
version = "3.3.0"
@ -306,9 +277,9 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7"
dependencies = [
"async-io 2.3.2",
"async-io",
"blocking",
"futures-lite 2.3.0",
"futures-lite",
]
[[package]]
@ -318,14 +289,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a53fc6301894e04a92cb2584fedde80cb25ba8e02d9dc39d4a87d036e22f397d"
dependencies = [
"async-channel",
"async-io 2.3.2",
"async-lock 3.3.0",
"async-io",
"async-lock",
"async-signal",
"async-task",
"blocking",
"cfg-if",
"event-listener 5.3.0",
"futures-lite 2.3.0",
"futures-lite",
"rustix 0.38.34",
"tracing",
"windows-sys 0.52.0",
@ -348,8 +319,8 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afe66191c335039c7bb78f99dc7520b0cbb166b3a1cb33a03f53d8a1c6f2afda"
dependencies = [
"async-io 2.3.2",
"async-lock 3.3.0",
"async-io",
"async-lock",
"atomic-waker",
"cfg-if",
"futures-core",
@ -381,7 +352,7 @@ dependencies = [
name = "async_ossl"
version = "0.1.0"
dependencies = [
"async-io 2.3.2",
"async-io",
"openssl",
]
@ -554,10 +525,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "495f7104e962b7356f0aeb34247aca1fe7d2e783b346582db7f2904cb5717e88"
dependencies = [
"async-channel",
"async-lock 3.3.0",
"async-lock",
"async-task",
"futures-io",
"futures-lite 2.3.0",
"futures-lite",
"piper",
]
@ -1583,12 +1554,6 @@ dependencies = [
"num-traits",
]
[[package]]
name = "event-listener"
version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "event-listener"
version = "4.0.3"
@ -1669,15 +1634,6 @@ dependencies = [
"regex",
]
[[package]]
name = "fastrand"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
"instant",
]
[[package]]
name = "fastrand"
version = "2.1.0"
@ -1932,28 +1888,13 @@ version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
[[package]]
name = "futures-lite"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
dependencies = [
"fastrand 1.9.0",
"futures-core",
"futures-io",
"memchr",
"parking",
"pin-project-lite",
"waker-fn",
]
[[package]]
name = "futures-lite"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5"
dependencies = [
"fastrand 2.1.0",
"fastrand",
"futures-core",
"futures-io",
"parking",
@ -2491,7 +2432,7 @@ dependencies = [
"http-body",
"hyper",
"pin-project-lite",
"socket2 0.5.7",
"socket2",
"tokio",
"tower",
"tower-service",
@ -4006,7 +3947,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "464db0c665917b13ebb5d453ccdec4add5658ee1adc7affc7677615356a8afaf"
dependencies = [
"atomic-waker",
"fastrand 2.1.0",
"fastrand",
"futures-io",
]
@ -4084,22 +4025,6 @@ dependencies = [
"miniz_oxide 0.7.2",
]
[[package]]
name = "polling"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
dependencies = [
"autocfg",
"bitflags 1.3.2",
"cfg-if",
"concurrent-queue",
"libc",
"log",
"pin-project-lite",
"windows-sys 0.48.0",
]
[[package]]
name = "polling"
version = "3.7.0"
@ -4259,7 +4184,7 @@ version = "0.2.0"
dependencies = [
"anyhow",
"async-executor",
"async-io 2.3.2",
"async-io",
"async-task",
"flume",
"lazy_static",
@ -5123,43 +5048,12 @@ dependencies = [
"async-channel",
"async-executor",
"async-fs",
"async-io 2.3.2",
"async-lock 3.3.0",
"async-io",
"async-lock",
"async-net",
"async-process",
"blocking",
"futures-lite 2.3.0",
]
[[package]]
name = "smol-potat"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "894ffa61af5c0fab697c8c29b1ab10cb6ec4978a1ccac4a81b5b312df1ffd88e"
dependencies = [
"async-io 1.13.0",
"smol-potat-macro",
]
[[package]]
name = "smol-potat-macro"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b7cd8129a18069385b4eadaa81182b1451fab312ad6f58d1d99253082bf3932"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "socket2"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
dependencies = [
"libc",
"winapi",
"futures-lite",
]
[[package]]
@ -5427,7 +5321,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
"cfg-if",
"fastrand 2.1.0",
"fastrand",
"rustix 0.38.34",
"windows-sys 0.52.0",
]
@ -5730,7 +5624,7 @@ dependencies = [
"mio",
"num_cpus",
"pin-project-lite",
"socket2 0.5.7",
"socket2",
"tokio-macros",
"windows-sys 0.48.0",
]
@ -6104,12 +5998,6 @@ dependencies = [
"utf8parse",
]
[[package]]
name = "waker-fn"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7"
[[package]]
name = "walkdir"
version = "2.5.0"
@ -6398,7 +6286,7 @@ name = "wezterm-client"
version = "0.1.0"
dependencies = [
"anyhow",
"async-io 2.3.2",
"async-io",
"async-trait",
"async_ossl",
"codec",
@ -6533,7 +6421,7 @@ dependencies = [
"env-bootstrap",
"env_logger 0.11.3",
"euclid",
"fastrand 2.1.0",
"fastrand",
"filedescriptor",
"finl_unicode",
"frecency",
@ -6651,7 +6539,7 @@ name = "wezterm-mux-server-impl"
version = "0.1.0"
dependencies = [
"anyhow",
"async-io 2.3.2",
"async-io",
"async_ossl",
"codec",
"config",
@ -6707,8 +6595,7 @@ dependencies = [
"rstest",
"shell-words",
"smol",
"smol-potat",
"socket2 0.5.7",
"socket2",
"ssh2",
"termwiz",
"thiserror",
@ -6749,7 +6636,7 @@ dependencies = [
name = "wezterm-toast-notification"
version = "0.1.0"
dependencies = [
"async-io 2.3.2",
"async-io",
"cocoa 0.20.2",
"core-foundation 0.7.0",
"futures-util",
@ -6938,7 +6825,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"async-channel",
"async-io 2.3.2",
"async-io",
"async-task",
"async-trait",
"bitflags 1.3.2",
@ -6953,7 +6840,7 @@ dependencies = [
"downcast-rs",
"euclid",
"filedescriptor",
"futures-lite 1.13.0",
"futures-lite",
"futures-util",
"gl_generator",
"glium",
@ -7449,8 +7336,8 @@ dependencies = [
"async-broadcast",
"async-executor",
"async-fs",
"async-io 2.3.2",
"async-lock 3.3.0",
"async-io",
"async-lock",
"async-process",
"async-recursion",
"async-task",

View File

@ -49,6 +49,5 @@ predicates = "3.0"
env_logger = "0.11"
rstest = "0.19"
shell-words = "1.1"
smol-potat = "1.1.2"
termwiz = { version = "0.22", path = "../termwiz" }
whoami = "1.5"

View File

@ -14,12 +14,12 @@ async fn session_with_agent_forward(
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
#[cfg_attr(not(feature = "libssh-rs"), ignore)]
async fn ssh_add_should_be_able_to_list_identities_with_agent_forward(
fn ssh_add_should_be_able_to_list_identities_with_agent_forward(
#[future] session_with_agent_forward: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session_with_agent_forward.await;
let (pty, _child_process) = session
@ -30,13 +30,14 @@ async fn ssh_add_should_be_able_to_list_identities_with_agent_forward(
let mut output: String = String::new();
reader.read_to_string(&mut output).unwrap();
assert_eq!(output, "The agent has no identities.\r\n");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
#[cfg_attr(not(feature = "libssh-rs"), ignore)]
async fn no_agent_forward_should_happen_when_disabled(#[future] session: SessionWithSshd) {
fn no_agent_forward_should_happen_when_disabled(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let (pty, _child_process) = session
@ -50,4 +51,5 @@ async fn no_agent_forward_should_happen_when_disabled(#[future] session: Session
output,
"Could not open a connection to your authentication agent.\r\n"
);
})
}

View File

@ -21,11 +21,11 @@ fn file_type_to_str(file_type: FileType) -> &'static str {
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn read_dir_should_return_list_of_directories_files_and_symlinks(
fn read_dir_should_return_list_of_directories_files_and_symlinks(
#[future] session: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
// $TEMP/dir1/
@ -72,14 +72,15 @@ async fn read_dir_should_return_list_of_directories_files_and_symlinks(
),
]
);
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn create_dir_should_create_a_directory_on_the_remote_filesystem(
fn create_dir_should_create_a_directory_on_the_remote_filesystem(
#[future] session: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -92,14 +93,15 @@ async fn create_dir_should_create_a_directory_on_the_remote_filesystem(
// Verify the path exists and is to a directory
temp.child("dir").assert(predicate::path::is_dir());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn create_dir_should_return_error_if_unable_to_create_directory(
fn create_dir_should_return_error_if_unable_to_create_directory(
#[future] session: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -120,12 +122,13 @@ async fn create_dir_should_return_error_if_unable_to_create_directory(
.child("dir")
.assert(predicate::path::is_dir().not());
temp.child("dir").assert(predicate::path::is_dir().not());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn remove_dir_should_remove_a_remote_directory(#[future] session: SessionWithSshd) {
fn remove_dir_should_remove_a_remote_directory(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -141,14 +144,15 @@ async fn remove_dir_should_remove_a_remote_directory(#[future] session: SessionW
// Verify the directory no longer exists
dir.assert(predicate::path::is_dir().not());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn remove_dir_should_return_an_error_if_failed_to_remove_directory(
fn remove_dir_should_return_an_error_if_failed_to_remove_directory(
#[future] session: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -191,12 +195,13 @@ async fn remove_dir_should_return_an_error_if_failed_to_remove_directory(
// Verify the file still exists
file.assert(predicate::path::is_file());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn metadata_should_return_metadata_about_a_file(#[future] session: SessionWithSshd) {
fn metadata_should_return_metadata_about_a_file(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -211,12 +216,13 @@ async fn metadata_should_return_metadata_about_a_file(#[future] session: Session
// Verify that file metadata makes sense
assert!(metadata.is_file(), "Invalid file metadata returned");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn metadata_should_return_metadata_about_a_directory(#[future] session: SessionWithSshd) {
fn metadata_should_return_metadata_about_a_directory(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -231,14 +237,15 @@ async fn metadata_should_return_metadata_about_a_directory(#[future] session: Se
// Verify that file metadata makes sense
assert!(metadata.is_dir(), "Invalid file metadata returned");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn metadata_should_return_metadata_about_the_file_pointed_to_by_a_symlink(
fn metadata_should_return_metadata_about_the_file_pointed_to_by_a_symlink(
#[future] session: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -258,14 +265,15 @@ async fn metadata_should_return_metadata_about_the_file_pointed_to_by_a_symlink(
assert!(metadata.is_file(), "Invalid file metadata returned");
assert!(metadata.ty.is_file(), "Invalid file metadata returned");
assert!(!metadata.ty.is_symlink(), "Invalid file metadata returned");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn metadata_should_return_metadata_about_the_dir_pointed_to_by_a_symlink(
fn metadata_should_return_metadata_about_the_dir_pointed_to_by_a_symlink(
#[future] session: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -285,12 +293,13 @@ async fn metadata_should_return_metadata_about_the_dir_pointed_to_by_a_symlink(
assert!(metadata.is_dir(), "Invalid file metadata returned");
assert!(metadata.ty.is_dir(), "Invalid file metadata returned");
assert!(!metadata.ty.is_symlink(), "Invalid file metadata returned");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn metadata_should_fail_if_path_missing(#[future] session: SessionWithSshd) {
fn metadata_should_fail_if_path_missing(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -304,12 +313,13 @@ async fn metadata_should_fail_if_path_missing(#[future] session: SessionWithSshd
"Metadata unexpectedly succeeded: {:?}",
result
);
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn symlink_metadata_should_return_metadata_about_a_file(#[future] session: SessionWithSshd) {
fn symlink_metadata_should_return_metadata_about_a_file(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -324,14 +334,13 @@ async fn symlink_metadata_should_return_metadata_about_a_file(#[future] session:
// Verify that file metadata makes sense
assert!(symlink_metadata.is_file(), "Invalid file metadata returned");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn symlink_metadata_should_return_metadata_about_a_directory(
#[future] session: SessionWithSshd,
) {
fn symlink_metadata_should_return_metadata_about_a_directory(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -346,14 +355,15 @@ async fn symlink_metadata_should_return_metadata_about_a_directory(
// Verify that file metadata makes sense
assert!(symlink_metadata.is_dir(), "Invalid file metadata returned");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn symlink_metadata_should_return_metadata_about_symlink_pointing_to_a_file(
fn symlink_metadata_should_return_metadata_about_symlink_pointing_to_a_file(
#[future] session: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -373,14 +383,15 @@ async fn symlink_metadata_should_return_metadata_about_symlink_pointing_to_a_fil
assert!(!metadata.is_file(), "Invalid file metadata returned");
assert!(!metadata.ty.is_file(), "Invalid file metadata returned");
assert!(metadata.ty.is_symlink(), "Invalid file metadata returned");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn symlink_metadata_should_return_metadata_about_symlink_pointing_to_a_directory(
fn symlink_metadata_should_return_metadata_about_symlink_pointing_to_a_directory(
#[future] session: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -400,12 +411,13 @@ async fn symlink_metadata_should_return_metadata_about_symlink_pointing_to_a_dir
assert!(!metadata.is_dir(), "Invalid file metadata returned");
assert!(!metadata.ty.is_dir(), "Invalid file metadata returned");
assert!(metadata.ty.is_symlink(), "Invalid file metadata returned");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn symlink_metadata_should_fail_if_path_missing(#[future] session: SessionWithSshd) {
fn symlink_metadata_should_fail_if_path_missing(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -419,12 +431,13 @@ async fn symlink_metadata_should_fail_if_path_missing(#[future] session: Session
"symlink_metadata unexpectedly succeeded: {:?}",
result
);
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn symlink_should_create_symlink_pointing_to_file(#[future] session: SessionWithSshd) {
fn symlink_should_create_symlink_pointing_to_file(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -450,12 +463,13 @@ async fn symlink_should_create_symlink_pointing_to_file(#[future] session: Sessi
// TODO: This fails even though the type is a symlink:
// https://github.com/assert-rs/assert_fs/issues/70
// link.assert(predicate::path::is_symlink());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn symlink_should_create_symlink_pointing_to_directory(#[future] session: SessionWithSshd) {
fn symlink_should_create_symlink_pointing_to_directory(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -471,12 +485,13 @@ async fn symlink_should_create_symlink_pointing_to_directory(#[future] session:
.expect("Failed to create symlink");
link.assert(predicate::path::is_symlink());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn symlink_should_succeed_even_if_path_missing(#[future] session: SessionWithSshd) {
fn symlink_should_succeed_even_if_path_missing(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -491,12 +506,13 @@ async fn symlink_should_succeed_even_if_path_missing(#[future] session: SessionW
.expect("Failed to create symlink");
link.assert(predicate::path::is_symlink());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn read_link_should_return_the_target_of_the_symlink(#[future] session: SessionWithSshd) {
fn read_link_should_return_the_target_of_the_symlink(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -526,12 +542,13 @@ async fn read_link_should_return_the_target_of_the_symlink(#[future] session: Se
.await
.expect("Failed to read symlink");
assert_eq!(path, file.path());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn read_link_should_fail_if_path_is_not_a_symlink(#[future] session: SessionWithSshd) {
fn read_link_should_fail_if_path_is_not_a_symlink(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -566,14 +583,13 @@ async fn read_link_should_fail_if_path_is_not_a_symlink(#[future] session: Sessi
"Unexpectedly read link for file: {:?}",
result
);
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn canonicalize_should_resolve_absolute_path_for_relative_path(
#[future] session: SessionWithSshd,
) {
fn canonicalize_should_resolve_absolute_path_for_relative_path(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
// For resolving parts of a path, all components must exist
@ -594,14 +610,15 @@ async fn canonicalize_should_resolve_absolute_path_for_relative_path(
"Canonicalize unexpectedly failed: {:?}",
result
);
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn canonicalize_should_either_return_resolved_path_or_error_if_missing(
fn canonicalize_should_either_return_resolved_path_or_error_if_missing(
#[future] session: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -631,14 +648,15 @@ async fn canonicalize_should_either_return_resolved_path_or_error_if_missing(
x
),
}
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn canonicalize_should_fail_if_resolving_missing_path_with_dots(
fn canonicalize_should_fail_if_resolving_missing_path_with_dots(
#[future] session: SessionWithSshd,
) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -649,12 +667,13 @@ async fn canonicalize_should_fail_if_resolving_missing_path_with_dots(
.canonicalize(missing.path().to_path_buf())
.await;
assert!(result.is_err(), "Canonicalize unexpectedly succeeded");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn rename_should_support_singular_file(#[future] session: SessionWithSshd) {
fn rename_should_support_singular_file(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -676,12 +695,13 @@ async fn rename_should_support_singular_file(#[future] session: SessionWithSshd)
// Verify that file was moved to destination
file.assert(predicate::path::missing());
dst.assert("some text");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn rename_should_support_dirtectory(#[future] session: SessionWithSshd) {
fn rename_should_support_dirtectory(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -712,12 +732,13 @@ async fn rename_should_support_dirtectory(#[future] session: SessionWithSshd) {
dst.assert(predicate::path::is_dir());
dst.child("file").assert("some text");
dst.child("dir").assert(predicate::path::is_dir());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn rename_should_fail_if_source_path_missing(#[future] session: SessionWithSshd) {
fn rename_should_fail_if_source_path_missing(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -737,12 +758,13 @@ async fn rename_should_fail_if_source_path_missing(#[future] session: SessionWit
"Rename unexpectedly succeeded with missing path: {:?}",
result
);
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn remove_file_should_remove_file(#[future] session: SessionWithSshd) {
fn remove_file_should_remove_file(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -756,12 +778,13 @@ async fn remove_file_should_remove_file(#[future] session: SessionWithSshd) {
.expect("Failed to remove file");
file.assert(predicate::path::missing());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn remove_file_should_remove_symlink_to_file(#[future] session: SessionWithSshd) {
fn remove_file_should_remove_symlink_to_file(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -779,12 +802,13 @@ async fn remove_file_should_remove_symlink_to_file(#[future] session: SessionWit
// Verify link removed but file still exists
link.assert(predicate::path::missing());
file.assert(predicate::path::is_file());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn remove_file_should_remove_symlink_to_directory(#[future] session: SessionWithSshd) {
fn remove_file_should_remove_symlink_to_directory(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -802,12 +826,13 @@ async fn remove_file_should_remove_symlink_to_directory(#[future] session: Sessi
// Verify link removed but directory still exists
link.assert(predicate::path::missing());
dir.assert(predicate::path::is_dir());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn remove_file_should_fail_if_path_to_directory(#[future] session: SessionWithSshd) {
fn remove_file_should_fail_if_path_to_directory(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -823,12 +848,13 @@ async fn remove_file_should_fail_if_path_to_directory(#[future] session: Session
// Verify directory still here
dir.assert(predicate::path::is_dir());
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn remove_file_should_fail_if_path_missing(#[future] session: SessionWithSshd) {
fn remove_file_should_fail_if_path_missing(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -842,4 +868,5 @@ async fn remove_file_should_fail_if_path_missing(#[future] session: SessionWithS
"Unexpectedly removed missing path: {:?}",
result
);
})
}

View File

@ -7,9 +7,9 @@ use std::convert::TryInto;
use std::path::PathBuf;
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn metadata_should_retrieve_file_stat(#[future] session: SessionWithSshd) {
fn metadata_should_retrieve_file_stat(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -29,12 +29,13 @@ async fn metadata_should_retrieve_file_stat(#[future] session: SessionWithSshd)
// Verify that file stat makes sense
assert!(metadata.is_file(), "Invalid file metadata returned");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn read_dir_should_retrieve_next_dir_entry(#[future] session: SessionWithSshd) {
fn read_dir_should_retrieve_next_dir_entry(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -78,12 +79,13 @@ async fn read_dir_should_retrieve_next_dir_entry(#[future] session: SessionWithS
(PathBuf::from("link").try_into().unwrap(), "symlink"),
]
);
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn should_support_async_reading(#[future] session: SessionWithSshd) {
fn should_support_async_reading(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -110,12 +112,13 @@ async fn should_support_async_reading(#[future] session: SessionWithSshd) {
.read_to_string(&mut contents)
.await
.expect("Failed to read file to string second time");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn should_support_async_writing(#[future] session: SessionWithSshd) {
fn should_support_async_writing(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -140,12 +143,13 @@ async fn should_support_async_writing(#[future] session: SessionWithSshd) {
.write_all(b"new contents for file")
.await
.expect("Failed to write to file second time");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn should_support_async_flush(#[future] session: SessionWithSshd) {
fn should_support_async_flush(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -165,12 +169,13 @@ async fn should_support_async_flush(#[future] session: SessionWithSshd) {
.flush()
.await
.expect("Failed to flush file second time");
})
}
#[rstest]
#[smol_potat::test]
#[cfg_attr(not(any(target_os = "macos", target_os = "linux")), ignore)]
async fn should_support_async_close(#[future] session: SessionWithSshd) {
fn should_support_async_close(#[future] session: SessionWithSshd) {
smol::block_on(async {
let session: SessionWithSshd = session.await;
let temp = TempDir::new().unwrap();
@ -190,4 +195,5 @@ async fn should_support_async_close(#[future] session: SessionWithSshd) {
.close()
.await
.expect("Failed to close file second time");
})
}

View File

@ -71,7 +71,7 @@ winreg = "0.10"
dirs-next = "2.0"
filedescriptor = { version="0.8", path = "../filedescriptor" }
futures-util = "0.3"
futures-lite = "1.12"
futures-lite = "2.3"
x11 = {version ="2.21", features = ["xlib_xcb", "xlib"]}
xcb = {version="1.3", features=["render", "randr", "dri2", "xkb", "xlib_xcb", "present", "as-raw-xcb-connection"]}
xkbcommon = { version = "0.7.0", features = ["x11", "wayland"] }