mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
e752f7b4ae
The workspace denies `clippy::expect_used` in production. Although `clippy.toml` allows `expect` in tests, Bazel Clippy compiles integration-test helper code in a way that does not receive that exemption, which encouraged verbose `unwrap_or_else(... panic!(...))` and equivalent `match`/`let else` forms. This allows `clippy::expect_used` once at each integration-test crate root (including aggregated suites and test-support libraries), then replaces manual panic-based Result and Option unwraps with `expect`/`expect_err`. Standalone `tests/*.rs` files remain their own crate roots. Intentional assertion and unexpected-variant panics remain unchanged, and the production `expect_used = "deny"` lint remains in place. The cleanup is mechanical and net-negative in line count.
57 lines
1.6 KiB
Rust
57 lines
1.6 KiB
Rust
#![cfg(windows)]
|
|
#![allow(clippy::expect_used)]
|
|
|
|
mod common;
|
|
|
|
#[path = "file_system/shared.rs"]
|
|
mod shared;
|
|
#[path = "file_system/support.rs"]
|
|
mod support;
|
|
|
|
use std::path::Path;
|
|
use std::process::Command;
|
|
|
|
use anyhow::Result;
|
|
use test_case::test_case;
|
|
|
|
use crate::support::FileSystemImplementation;
|
|
|
|
fn create_directory_junction(target: &Path, alias: &Path) -> Result<()> {
|
|
let output = Command::new("cmd")
|
|
.args(["/C", "mklink", "/J"])
|
|
.arg(alias)
|
|
.arg(target)
|
|
.output()?;
|
|
if !output.status.success() {
|
|
anyhow::bail!(
|
|
"mklink /J failed: stdout={} stderr={}",
|
|
String::from_utf8_lossy(&output.stdout).trim(),
|
|
String::from_utf8_lossy(&output.stderr).trim()
|
|
);
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
#[test_case(FileSystemImplementation::Local ; "local")]
|
|
#[test_case(FileSystemImplementation::Remote ; "remote")]
|
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
|
async fn file_system_canonicalize_resolves_directory_junction(
|
|
implementation: FileSystemImplementation,
|
|
) -> Result<()> {
|
|
shared::assert_canonicalize_resolves_directory_alias(implementation, create_directory_junction)
|
|
.await
|
|
}
|
|
|
|
#[test_case(FileSystemImplementation::Local ; "local")]
|
|
#[test_case(FileSystemImplementation::Remote ; "remote")]
|
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
|
async fn file_system_sandboxed_canonicalize_resolves_directory_junction(
|
|
implementation: FileSystemImplementation,
|
|
) -> Result<()> {
|
|
shared::assert_sandboxed_canonicalize_resolves_directory_alias(
|
|
implementation,
|
|
create_directory_junction,
|
|
)
|
|
.await
|
|
}
|