MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / verify_capi

Function verify_capi

scripts/publish.rs:550–578  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

548 }
549
550 fn verify_capi() {
551 let version = read_crate(None, "./Cargo.toml".as_ref()).version;
552
553 let mut iter = version.split('.').map(|s| s.parse::<u32>().unwrap());
554 let major = iter.next().expect("major version");
555 let minor = iter.next().expect("minor version");
556 let patch = iter.next().expect("patch version");
557
558 let mut count = 0;
559 let contents = fs::read_to_string(C_HEADER_PATH).unwrap();
560 for line in contents.lines() {
561 if line.starts_with(&format!("#define WASMTIME_VERSION \"{version}\"")) {
562 count += 1;
563 } else if line.starts_with(&format!("#define WASMTIME_VERSION_MAJOR {major}")) {
564 count += 1;
565 } else if line.starts_with(&format!("#define WASMTIME_VERSION_MINOR {minor}")) {
566 count += 1;
567 } else if line.starts_with(&format!("#define WASMTIME_VERSION_PATCH {patch}")) {
568 count += 1;
569 }
570 }
571
572 assert!(
573 count == 4,
574 "invalid version macros in {}, should match \"{}\"",
575 C_HEADER_PATH,
576 version
577 );
578 }
579
580 fn verify_crates_io(krate: &Crate) {
581 let name = &krate.name;

Callers 1

verifyFunction · 0.85

Calls 8

read_crateFunction · 0.85
read_to_stringFunction · 0.85
splitMethod · 0.80
as_refMethod · 0.45
mapMethod · 0.45
unwrapMethod · 0.45
expectMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected