v0.2.14-pre.004
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-program-api/tests/dependency_boundary.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Dependency and declarative-surface canaries for the Program API foundation.
|
||||
|
||||
@@ -46,10 +46,11 @@ fn pre_002_manifest_has_exact_core_and_interface_runtime_dependencies() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_003_crate_root_adds_only_recognition_and_decode_outcome() {
|
||||
fn pre_004_crate_root_adds_decoder_without_runtime_surface() {
|
||||
let crate_root = include_str!("../src/lib.rs");
|
||||
for required in [
|
||||
"ProgramInstructionDecodeOutcome",
|
||||
"ProgramInstructionDecoder",
|
||||
"ProgramInstructionRecognition",
|
||||
"Error",
|
||||
"ErrorCode",
|
||||
@@ -61,9 +62,18 @@ fn pre_003_crate_root_adds_only_recognition_and_decode_outcome() {
|
||||
] {
|
||||
assert!(crate_root.contains(required), "required Program API facade export missing: {required}");
|
||||
}
|
||||
for forbidden in ["pub mod ", "ProgramInstructionDecoder", "ProgramExecutionPreparer", "TRACING_TARGET", "ksp_logging_lib", "serde", "Any"] {
|
||||
assert!(!crate_root.contains(forbidden), "forbidden pre.003 Program API surface detected: {forbidden}");
|
||||
for forbidden in ["pub mod ", "ProgramExecutionPreparer", "TRACING_TARGET", "ksp_logging_lib", "serde", "Any"] {
|
||||
assert!(!crate_root.contains(forbidden), "forbidden pre.004 Program API surface detected: {forbidden}");
|
||||
}
|
||||
let decoder_source = include_str!("../src/program_instruction_decoder.rs");
|
||||
assert!(decoder_source.contains("pub trait ProgramInstructionDecoder: Send + Sync"));
|
||||
assert!(decoder_source.contains("type Decoded;"));
|
||||
assert!(decoder_source.contains("fn program_ids(&self) -> &[crate::Pubkey];"));
|
||||
assert!(decoder_source.contains("fn recognize(&self, instruction: &crate::ProgramInstruction)"));
|
||||
assert!(decoder_source.contains("crate::Result<crate::ProgramInstructionDecodeOutcome<Self::Decoded>>"));
|
||||
assert!(!decoder_source.contains("ProgramExecutionPreparer"));
|
||||
assert!(!decoder_source.contains("serde"));
|
||||
assert!(!decoder_source.contains("std::any::Any"));
|
||||
let outcome_source = include_str!("../src/program_instruction_decode.rs");
|
||||
for forbidden in ["Ignored", "Failed", "serde", "Any"] {
|
||||
assert!(!outcome_source.contains(forbidden), "forbidden recognition/outcome concept detected: {forbidden}");
|
||||
|
||||
Reference in New Issue
Block a user