Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 committed Oct 16, 2024
1 parent e800fe9 commit 111b35a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ mod optimization;
mod output_dir;
mod overwrite;
mod supress;
mod version;
mod vyper;

/// The solidity contract name
Expand Down
30 changes: 30 additions & 0 deletions tests/cli/version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use crate::{cli, common};
use predicates::prelude::*;

#[test]
fn test_version() -> anyhow::Result<()> {
let _ = common::setup();

let args = &["--version"];
let result = cli::execute_zkvyper(args)?;

result
.success()
.stdout(predicate::str::contains("Vyper compiler for ZKsync"));

Ok(())
}

#[test]
fn test_version_with_extra_args() -> anyhow::Result<()> {
let _ = common::setup();

let args = &["--version", cli::TEST_VYPER_CONTRACT_PATH];
let result = cli::execute_zkvyper(args)?;

result.failure().stderr(predicate::str::contains(
"Error: No other options are allowed while getting the compiler version.",
));

Ok(())
}

0 comments on commit 111b35a

Please sign in to comment.