Skip to content

Commit

Permalink
Update insta-cmd and fix usage
Browse files Browse the repository at this point in the history
  • Loading branch information
cnpryer committed May 3, 2024
1 parent 53266de commit b13189f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/huak-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ url = "2.5.0"

[dev-dependencies]
huak-dev = { path = "../huak-dev" }
insta-cmd = "0.4.0"
insta-cmd = "0.6.0"
tempfile.workspace = true

[lints]
Expand Down
48 changes: 26 additions & 22 deletions crates/huak-cli/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,108 +1,108 @@
#[cfg(test)]
mod tests {
use insta_cmd::assert_cmd_snapshot;
use insta_cmd::{assert_cmd_snapshot, get_cargo_bin};
use std::{path::PathBuf, process::Command};

#[test]
fn test_activate_help() {
assert_cmd_snapshot!(Command::new("huak").arg("activate").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("activate").arg("--help"));
}

#[test]
fn test_add_help() {
assert_cmd_snapshot!(Command::new("huak").arg("add").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("add").arg("--help"));
}

#[test]
fn test_build_help() {
assert_cmd_snapshot!(Command::new("huak").arg("build").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("build").arg("--help"));
}

#[test]
fn test_clean_help() {
assert_cmd_snapshot!(Command::new("huak").arg("clean").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("clean").arg("--help"));
}

#[test]
fn test_completion_help() {
assert_cmd_snapshot!(Command::new("huak").arg("completion").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("completion").arg("--help"));
}

#[test]
fn test_fix_help() {
assert_cmd_snapshot!(Command::new("huak").arg("fix").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("fix").arg("--help"));
}

#[test]
fn test_fmt_help() {
assert_cmd_snapshot!(Command::new("huak").arg("fmt").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("fmt").arg("--help"));
}

#[test]
fn test_help() {
assert_cmd_snapshot!(Command::new("huak").arg("help"));
assert_cmd_snapshot!(Command::new("huak").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("help"));
assert_cmd_snapshot!(Command::new(bin()).arg("--help"));
}

#[test]
fn test_init_help() {
assert_cmd_snapshot!(Command::new("huak").arg("init").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("init").arg("--help"));
}

#[test]
fn test_install_help() {
assert_cmd_snapshot!(Command::new("huak").arg("install").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("install").arg("--help"));
}

#[test]
fn test_lint_help() {
assert_cmd_snapshot!(Command::new("huak").arg("lint").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("lint").arg("--help"));
}

#[test]
fn test_new_help() {
assert_cmd_snapshot!(Command::new("huak").arg("new").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("new").arg("--help"));
}

#[test]
fn test_publish_help() {
assert_cmd_snapshot!(Command::new("huak").arg("publish").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("publish").arg("--help"));
}

#[test]
fn test_python_help() {
assert_cmd_snapshot!(Command::new("huak").arg("python").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("python").arg("--help"));
}

#[test]
fn test_remove_help() {
assert_cmd_snapshot!(Command::new("huak").arg("remove").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("remove").arg("--help"));
}

#[test]
fn test_run_help() {
assert_cmd_snapshot!(Command::new("huak").arg("run").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("run").arg("--help"));
}

#[test]
fn test_test_help() {
assert_cmd_snapshot!(Command::new("huak").arg("test").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("test").arg("--help"));
}

#[test]
fn test_update_help() {
assert_cmd_snapshot!(Command::new("huak").arg("update").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("update").arg("--help"));
}

#[test]
fn test_version_help() {
assert_cmd_snapshot!(Command::new("huak").arg("version").arg("--help"));
assert_cmd_snapshot!(Command::new(bin()).arg("version").arg("--help"));
}

#[test]
fn test_version() {
let from = dev_resources_dir().join("mock-project");
assert_cmd_snapshot!(Command::new("huak")
assert_cmd_snapshot!(Command::new(bin())
.arg("version")
.arg("--no-color")
.current_dir(from));
Expand All @@ -117,4 +117,8 @@ mod tests {
.unwrap()
.join("dev-resources")
}

fn bin() -> PathBuf {
get_cargo_bin("huak")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Arguments:

Options:
--python-version <PYTHON_VERSION>
The Python version to use. TODO(cnpryer): https://github.com/cnpryer/huak/issues/850
The Python version to use
--package-index-url <PACKAGE_INDEX_URL>
The package index to use. TODO(cnpryer): Deps (document this) [default: https://pypi.python.org/simple]
The package index to use [default: https://pypi.python.org/simple]
-q, --quiet

--no-color
Expand Down

0 comments on commit b13189f

Please sign in to comment.