Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Add UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cassaundra committed Apr 2, 2024
1 parent 416c7a0 commit 00464c2
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 4 deletions.
135 changes: 132 additions & 3 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license = "MIT"
edition = "2021"

[workspace.dependencies]
miette = "5.10.0"
nu-ansi-term = "0.49.0"
nu-cli = { git = "https://github.com/quake-build/nushell" }
nu-cmd-lang = { git = "https://github.com/quake-build/nushell" }
Expand Down Expand Up @@ -39,6 +38,9 @@ quake_engine = { path = "crates/quake_engine" }
clap = { version = "4.4.18", features = ["cargo", "wrap_help"] }
serde_json = "1.0.113"

[dev-dependencies]
trycmd = { version = "0.15.0", features = ["examples"] }

[[bin]]
name = "quake"
path = "src/main.rs"
9 changes: 9 additions & 0 deletions tests/examples.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use trycmd::cargo;

#[test]
fn test_examples() {
trycmd::TestCases::new()
.default_bin_name("quake")
.register_bins(cargo::compile_examples([]).unwrap())
.case("tests/examples/*.toml");
}
6 changes: 6 additions & 0 deletions tests/ui.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#[test]
fn test_ui() {
trycmd::TestCases::new()
.default_bin_name("quake")
.case("tests/ui/*.toml");
}
29 changes: 29 additions & 0 deletions tests/ui/help.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
args = ["--help"]
status.code = 0
stdout = """
quake: a meta-build system powered by nushell
Usage: quake [OPTIONS] <TASK> [--] [TASK_ARGS]
quake [OPTIONS]
Subcommands:
list List the available tasks
inspect Dump build script metadata as JSON
Options:
-h, --help Print help
-V, --version Print version
Environment:
--project <PROJECT_DIR> Path to the project root directory
Output handling:
--quiet Suppress the output (stdout and stderr) of any executed commands
--json Output events as a line-delimited JSON objects to stderr. See the JSON appendix in
the manual for the specification of these objects.
Evaluation modes:
--force Execute tasks regardless of initial dirtiness checks
--watch Run the task, and re-run whenever sources have changed
"""
stderr = ""
18 changes: 18 additions & 0 deletions tests/ui/help_inspect.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
args = ["inspect", "--help"]
status.code = 0
stdout = """
Dump build script metadata as JSON
Usage: quake inspect [OPTIONS]
Options:
-h, --help Print help
Environment:
--project <PROJECT_DIR> Path to the project root directory
Output handling:
--json Output events as a line-delimited JSON objects to stderr. See the JSON appendix in the
manual for the specification of these objects.
"""
stderr = ""
18 changes: 18 additions & 0 deletions tests/ui/help_list.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
args = ["list", "--help"]
status.code = 0
stdout = """
List the available tasks
Usage: quake list [OPTIONS]
Options:
-h, --help Print help
Environment:
--project <PROJECT_DIR> Path to the project root directory
Output handling:
--json Output events as a line-delimited JSON objects to stderr. See the JSON appendix in the
manual for the specification of these objects.
"""
stderr = ""

0 comments on commit 00464c2

Please sign in to comment.