补充AGC工作目录创建测试
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Successful in 5m14s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Successful in 5m33s
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Successful in 5m49s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Successful in 5m52s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m39s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m23s
Project CI / Frontend tests (pull_request) Failing after 2m46s
Project CI / Repository checks (pull_request) Failing after 3m29s
Project CI / AI game creator shell web tests (pull_request) Failing after 3m24s
Project CI / Native shell tests (pull_request) Successful in 8m35s
Project CI / Backend tests (pull_request) Successful in 10m52s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Successful in 5m14s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Successful in 5m33s
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Successful in 5m49s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Successful in 5m52s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m39s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m23s
Project CI / Frontend tests (pull_request) Failing after 2m46s
Project CI / Repository checks (pull_request) Failing after 3m29s
Project CI / AI game creator shell web tests (pull_request) Failing after 3m24s
Project CI / Native shell tests (pull_request) Successful in 8m35s
Project CI / Backend tests (pull_request) Successful in 10m52s
覆盖子目录创建、重名和路径分隔符校验
This commit is contained in:
@@ -5399,3 +5399,47 @@ pub(crate) fn write_project_permission_policy(
|
||||
let _lock = acquire_project_write_lock(root, "project.policy_write")?;
|
||||
write_project_permission_policy_at(root, policy)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod custom_directory_tests {
|
||||
use super::create_local_project_directory;
|
||||
use std::fs;
|
||||
|
||||
#[test]
|
||||
fn creates_child_directory_without_touching_parent_contents() {
|
||||
let root = tempfile::tempdir().expect("temp parent");
|
||||
let created = create_local_project_directory(
|
||||
root.path().to_string_lossy().into_owned(),
|
||||
"new-game".to_string(),
|
||||
)
|
||||
.expect("create directory");
|
||||
let path = std::path::PathBuf::from(created);
|
||||
assert!(path.is_dir());
|
||||
assert!(fs::read_dir(root.path())
|
||||
.expect("read parent")
|
||||
.next()
|
||||
.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_existing_child_and_path_separator() {
|
||||
let root = tempfile::tempdir().expect("temp parent");
|
||||
fs::create_dir(root.path().join("existing")).expect("existing");
|
||||
assert_eq!(
|
||||
create_local_project_directory(
|
||||
root.path().to_string_lossy().into_owned(),
|
||||
"existing".to_string(),
|
||||
)
|
||||
.expect_err("duplicate must fail"),
|
||||
"目录已存在"
|
||||
);
|
||||
assert_eq!(
|
||||
create_local_project_directory(
|
||||
root.path().to_string_lossy().into_owned(),
|
||||
"nested/name".to_string(),
|
||||
)
|
||||
.expect_err("separator must fail"),
|
||||
"目录名称无效"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user