use std::fmt::Write as _;
use super::*;
use crate::version::DATA_VERSION;
use crate::wire::Declared;
fn python() -> String {
let mut out = String::from(
"\"\"\"The constructor numbers of the type descriptions' enums (abi.md, *Type\n\
descriptions*) and the data version, rendered from flow-abi's declarations of\n\
them by its tests. FLOW_BLESS=1 cargo test -p flow-abi rewrites this file;\n\
do not edit it by hand.\n\"\"\"\n\n",
);
writeln!(out, "DATA_MAJOR = {}", DATA_VERSION.major).expect("a string");
writeln!(out, "DATA_MINOR = {}", DATA_VERSION.minor).expect("a string");
for shape in [
Term::shape(),
Owner::shape(),
Body::shape(),
Payload::shape(),
] {
out.push('\n');
for (name, number) in shape.constants() {
writeln!(out, "{name} = {number}").expect("a string");
}
}
out
}
#[test]
fn the_python_toolkit_s_numbers_are_these_declarations() {
let module = flow_testing::repository_root()
.join("toolkits/python/src/flow_toolkit/_wire_descriptions.py");
if let Err(error) = flow_testing::compare_snapshot(&module, &python()) {
panic!("{error}");
}
}