Examples
Doctests
Aggregated doctests across the workspace.
Doctests
5 runnable examples.
new
use runx_sdk::command::CommandPlan;
use runx_sdk::error::RunxResult;
let plan = CommandPlan::new(&["runx".into()], &["skill".into(), "echo".into()])?;
assert_eq!(plan.program, "runx");
assert_eq!(plan.args, ["skill", "echo"]);
assert_eq!(plan.argv(), ["runx", "skill", "echo"]);
// An empty command is rejected.
assert!(CommandPlan::new(&[], &[]).is_err());
runx_contracts::fingerprint::hex_lower
use runx_contracts::fingerprint::hex_lower;
assert_eq!(hex_lower(&[0xde, 0xad, 0xbe, 0xef]), "deadbeef");
runx_contracts::fingerprint::sha256_hex
use runx_contracts::fingerprint::sha256_hex;
assert_eq!(
sha256_hex(b"runx"),
"8186b7035bea2f66ebe27c1f5cf7de4e94ef935e259a2f3160352adffc752f28",
);
runx_contracts::fingerprint::sha256_prefixed
use runx_contracts::fingerprint::sha256_prefixed;
let id = sha256_prefixed(b"runx");
assert!(id.starts_with("sha256:"));
assert_eq!(
id,
"sha256:8186b7035bea2f66ebe27c1f5cf7de4e94ef935e259a2f3160352adffc752f28",
);
runx_parser::yaml::yaml_scalar_subset_allows
use runx_parser::yaml::yaml_scalar_subset_allows;
assert!(yaml_scalar_subset_allows("echo")); // plain string: safe
assert!(!yaml_scalar_subset_allows("yes")); // YAML boolean: ambiguous