Skip to content

Commit

Permalink
Add tests for forc check
Browse files Browse the repository at this point in the history
  • Loading branch information
crodas committed Jan 9, 2024
1 parent d18d260 commit b87d0fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions forc/src/cli/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ use forc_pkg::source::IPFSNode;
use forc_util::{forc_result_bail, ForcResult};
use sway_core::{BuildTarget, Engines};

forc_util::cli_examples! {
[ Check the current project => forc "check" => r#".*could not find `Forc.toml`.*"# ]
[ Check the current project with a different path => forc "check --path ../tests/" => r#".*could not find `Forc.toml`.*"# ]
[ Check the current project without updating dependencies => forc "check --locked" => r#".*could not find `Forc.toml`.*"# ]
}

/// Check the current or target project and all of its dependencies for errors.
///
/// This will essentially compile the packages without performing the final step of code generation,
/// which is faster than running forc build.
#[derive(Debug, Default, Parser)]
#[clap(bin_name = "forc check", version, after_help = help())]
pub struct Command {
/// Build target to use for code generation.
#[clap(value_enum, default_value_t=BuildTarget::default(), alias="target")]
Expand Down
5 changes: 3 additions & 2 deletions forc/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ pub mod shared;
fn help() -> &'static str {
Box::leak(
format!(
"Examples:\n{}{}{}",
"Examples:\n{}{}{}{}",
plugins::examples(),
test::examples(),
build::examples()
build::examples(),
check::examples(),
)
.trim_end()
.to_string()
Expand Down

0 comments on commit b87d0fe

Please sign in to comment.