mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex] migrate ExecutorFileSystem paths to PathUri (#27424)
## Why We're moving exec-server to use PathUri for its internal path representations. ## What Move `ExecutorFileSystem` APIs to use `PathUri` instead of `AbsolutePathBuf`. Future changes will convert higher-level parts of exec-server.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use pretty_assertions::assert_eq;
|
||||
use tokio::io;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn direct_file_system_rejects_non_native_uri_as_invalid_input() {
|
||||
let error = DirectFileSystem
|
||||
.read_file(&non_native_uri(), /*sandbox*/ None)
|
||||
.await
|
||||
.expect_err("non-native URI should be rejected");
|
||||
|
||||
assert_eq!(error.kind(), io::ErrorKind::InvalidInput);
|
||||
}
|
||||
|
||||
fn non_native_uri() -> PathUri {
|
||||
#[cfg(unix)]
|
||||
let uri = "file://server/share/file.txt";
|
||||
#[cfg(windows)]
|
||||
let uri = "file:///usr/local/file.txt";
|
||||
|
||||
match PathUri::parse(uri) {
|
||||
Ok(uri) => uri,
|
||||
Err(err) => panic!("valid non-native URI should parse: {err}"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user