use std::fs;
use std::path::{Path, PathBuf};
fn workspace_root() -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
.parent()
.expect("crate directory should have a parent")
.parent()
.expect("workspace root should exist")
.to_path_buf()
}
fn read_text(path: &Path) -> String {
fs::read_to_string(path)
.unwrap_or_else(|err| panic!("failed to read {}: {err}", path.display()))
}
#[test]
fn removed_cycles_accept_surface_stays_absent() {
let did_path = workspace_root().join("crates/canic-wasm-store/wasm_store.did");
let did = read_text(&did_path);
assert!(
!did.contains(" ic_cycles_accept : (nat) -> (nat);"),
"unexpected `ic_cycles_accept` method in {}",
did_path.display()
);
assert!(
!did.contains(" msg_cycles_accept : (nat) -> (nat);"),
"unexpected `msg_cycles_accept` method in {}",
did_path.display()
);
assert!(
!did.contains(" canic_ic_cycles_accept : (nat) -> (nat);"),
"unexpected `canic_ic_cycles_accept` method in {}",
did_path.display()
);
}