v0.3.1-pre.007-fix.001

This commit is contained in:
2026-08-29 09:54:55 +02:00
parent 47b12e14e6
commit ad02b6f13c
4 changed files with 80 additions and 13 deletions

View File

@@ -83,15 +83,33 @@ fn pre_007_exact_crate_root_export_inventory_is_stable() {
}
#[test]
fn pre_007_exact_production_module_inventory_is_raw_only() -> std::io::Result<()> {
fn pre_007_exact_production_module_inventory_is_raw_only() {
let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
assert_eq!(rust_file_names(root.as_path())?, std::vec!["capability.rs", "error.rs", "lib.rs", "model.rs"]);
let root_names = rust_file_names(root.as_path());
assert!(root_names.is_ok());
let root_names = match root_names {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
assert_eq!(root_names, std::vec!["capability.rs", "error.rs", "lib.rs", "model.rs"]);
let model_names = rust_file_names(root.join("model").as_path());
assert!(model_names.is_ok());
let model_names = match model_names {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
assert_eq!(
rust_file_names(root.join("model").as_path())?,
model_names,
std::vec!["raw_account.rs", "raw_outcome.rs", "raw_pagination.rs", "raw_primitives.rs", "raw_retention.rs", "raw_transaction.rs"]
);
assert_eq!(rust_file_names(root.join("capability").as_path())?, std::vec!["raw_account.rs", "raw_retention.rs", "raw_transaction.rs"]);
return std::result::Result::Ok(());
let capability_names = rust_file_names(root.join("capability").as_path());
assert!(capability_names.is_ok());
let capability_names = match capability_names {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
assert_eq!(capability_names, std::vec!["raw_account.rs", "raw_retention.rs", "raw_transaction.rs"]);
return;
}
#[test]
@@ -208,11 +226,21 @@ fn assert_non_exhaustive(sources: &[&str], enum_name: &str) {
}
fn rust_file_names(directory: &std::path::Path) -> std::io::Result<std::vec::Vec<std::string::String>> {
let entries = std::fs::read_dir(directory)?;
let entries = match std::fs::read_dir(directory) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
let mut names = std::vec::Vec::new();
for entry in entries {
let entry = entry?;
if !entry.file_type()?.is_file() {
let entry = match entry {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
let file_type = match entry.file_type() {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
if !file_type.is_file() {
continue;
}
let name = match entry.file_name().into_string() {

View File

@@ -14,7 +14,7 @@ fn pre_007_hostile_model_query_and_provenance_errors_never_echo_input_material()
std::result::Result::Err(value) => value,
std::result::Result::Ok(_) => return,
};
assert_eq!(network_error.code(), &ksp_store_api::ERROR_CODE_RAW_MODEL_INVALID);
assert_eq!(network_error.code(), ksp_store_api::ERROR_CODE_RAW_MODEL_INVALID);
assert!(!std::format!("{network_error}").contains(HOSTILE_MARKER));
assert!(!std::format!("{network_error:?}").contains(HOSTILE_MARKER));
let provenance = ksp_store_api::RawProvenanceCode::new(hostile_code.clone());
@@ -23,7 +23,7 @@ fn pre_007_hostile_model_query_and_provenance_errors_never_echo_input_material()
std::result::Result::Err(value) => value,
std::result::Result::Ok(_) => return,
};
assert_eq!(provenance_error.code(), &ksp_store_api::ERROR_CODE_RAW_PROVENANCE_INVALID);
assert_eq!(provenance_error.code(), ksp_store_api::ERROR_CODE_RAW_PROVENANCE_INVALID);
assert!(!std::format!("{provenance_error}").contains(HOSTILE_MARKER));
assert!(!std::format!("{provenance_error:?}").contains(HOSTILE_MARKER));
let format = ksp_store_api::RawFormatId::new(hostile_code);
@@ -32,7 +32,7 @@ fn pre_007_hostile_model_query_and_provenance_errors_never_echo_input_material()
std::result::Result::Err(value) => value,
std::result::Result::Ok(_) => return,
};
assert_eq!(format_error.code(), &ksp_store_api::ERROR_CODE_RAW_PAYLOAD_INVALID);
assert_eq!(format_error.code(), ksp_store_api::ERROR_CODE_RAW_PAYLOAD_INVALID);
assert!(!std::format!("{format_error}").contains(HOSTILE_MARKER));
assert!(!std::format!("{format_error:?}").contains(HOSTILE_MARKER));
let cursor = ksp_store_api::RawPageCursor::try_new(std::vec![0x41_u8; ksp_store_api::MAX_RAW_PAGE_CURSOR_BYTES + 1].into_boxed_slice());
@@ -41,7 +41,7 @@ fn pre_007_hostile_model_query_and_provenance_errors_never_echo_input_material()
std::result::Result::Err(value) => value,
std::result::Result::Ok(_) => return,
};
assert_eq!(cursor_error.code(), &ksp_store_api::ERROR_CODE_RAW_QUERY_INVALID);
assert_eq!(cursor_error.code(), ksp_store_api::ERROR_CODE_RAW_QUERY_INVALID);
assert!(!std::format!("{cursor_error}").contains(HOSTILE_MARKER));
assert!(!std::format!("{cursor_error:?}").contains(HOSTILE_MARKER));
return;