v0.2.14-pre.003

This commit is contained in:
2026-08-28 14:10:49 +02:00
parent c1f61a380f
commit 27d4cb1f36
11 changed files with 588 additions and 68 deletions

View File

@@ -1,7 +1,7 @@
// file: crates/ksp-program-api/tests/public_api.rs
// version: 1
// version: 2
//! Integration canaries for the public `ksp-program-api` scaffold.
//! Integration canaries for the public `ksp-program-api` foundation.
fn consume_result(value: ksp_program_api::Result<ksp_program_api::Pubkey>) -> ksp_program_api::Result<ksp_program_api::Pubkey> {
return value;
@@ -31,3 +31,19 @@ fn public_pre_002_scaffold_does_not_require_private_modules() {
assert!(!source.contains("pub mod "));
return;
}
#[test]
fn public_pre_003_recognition_and_decode_outcome_are_available_from_crate_root() {
let recognition = ksp_program_api::ProgramInstructionRecognition::ProgramMatch;
assert_eq!(std::format!("{recognition:?}"), "ProgramMatch");
let decoded = ksp_program_api::ProgramInstructionDecodeOutcome::Decoded(31_u16);
assert_eq!(std::format!("{decoded:?}"), "Decoded");
let decoded_value = match decoded {
ksp_program_api::ProgramInstructionDecodeOutcome::Decoded(value) => value,
_ => 0_u16,
};
assert_eq!(decoded_value, 31_u16);
let unsupported = ksp_program_api::ProgramInstructionDecodeOutcome::<u16>::Unsupported;
assert_eq!(std::format!("{unsupported:?}"), "Unsupported");
return;
}