Skip to content

Commit

Permalink
Cairo-test: Warn when scarb version does not match
Browse files Browse the repository at this point in the history
  • Loading branch information
maciektr committed Jul 27, 2023
1 parent b143571 commit 36a173f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions extensions/scarb-cairo-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ fn main() -> Result<()> {

let metadata = MetadataCommand::new().inherit_stderr().exec()?;

check_scarb_version(&metadata);

let starknet_package_id = metadata
.packages
.iter()
Expand Down Expand Up @@ -142,3 +144,20 @@ fn build_root_database(unit: &CompilationUnitMetadata, starknet: bool) -> Result

b.build()
}

fn check_scarb_version(metadata: &Metadata) {
let app_version = env!("CARGO_PKG_VERSION").to_string();
let scarb_version = metadata
.app_version_info
.clone()
.version
.clone()
.to_string();
if app_version != scarb_version {
println!(
"warn: the version of cairo-test does not match the version of scarb.\
cairo-test: `{}`, scarb: `{}`",
app_version, scarb_version
);
}
}

0 comments on commit 36a173f

Please sign in to comment.