Skip to content

Commit

Permalink
Merge pull request #307 from epage/mv
Browse files Browse the repository at this point in the history
refactor: Move trycmd into a folder
  • Loading branch information
epage authored May 15, 2024
2 parents 3e9b830 + 72241dd commit 6907a75
Show file tree
Hide file tree
Showing 73 changed files with 126 additions and 124 deletions.
69 changes: 0 additions & 69 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,72 +87,3 @@ let_and_return = "allow" # sometimes good to name what you are returning

# Remove these later:
assigning_clones = "allow"

[package]
name = "trycmd"
version = "0.15.2"
description = "Snapshot testing for a herd of CLI tests"
authors = ["Ed Page <eopage@gmail.com>"]
repository = "https://github.com/assert-rs/trycmd.git"
homepage = "https://github.com/assert-rs/trycmd"
documentation = "http://docs.rs/trycmd/"
readme = "README.md"
categories = ["development-tools::testing"]
keywords = ["cli", "test", "assert", "command", "duct"]
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]

[package.metadata.release]
pre-release-replacements = [
{file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1},
{file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1},
{file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1},
{file="CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n", exactly=1},
{file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/assert-rs/trycmd/compare/{{tag_name}}...HEAD", exactly=1},
]

[features]
default = ["color-auto", "filesystem", "diff"]
color = ["snapbox/color", "dep:anstream"]
color-auto = ["snapbox/color-auto"]
diff = ["snapbox/diff"]
filesystem = ["snapbox/path"]

schema = ["dep:schemars", "dep:serde_json"]
examples = ["snapbox/examples"]
debug = ["snapbox/debug"]

[[bin]]
name = "bin-fixture"

[[bin]]
name = "trycmd-schema"
required-features = ["schema"]

[dependencies]
automod = "1.0.14"
snapbox = { path = "crates/snapbox", version = "0.5.10", default-features = false, features = ["cmd"] }
anstream = { version = "0.6.7", optional = true }

glob = "0.3.0"
rayon = "1.5.1"

serde = { version = "1.0", features = ["derive"] }
shlex = "1.1.0"
humantime = "2"
humantime-serde = "1"
toml_edit = { version = "0.19.14", features = ["serde"] }
escargot = { version = "0.5.7", optional = true }

schemars = { version = "0.8.3", features = ["preserve_order"], optional = true }
serde_json = { version = "1.0", optional = true }

[lints]
workspace = true
55 changes: 0 additions & 55 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
File renamed without changes.
68 changes: 68 additions & 0 deletions crates/trycmd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[package]
name = "trycmd"
version = "0.15.2"
description = "Snapshot testing for a herd of CLI tests"
authors = ["Ed Page <eopage@gmail.com>"]
repository = "https://github.com/assert-rs/trycmd.git"
homepage = "https://github.com/assert-rs/trycmd"
documentation = "http://docs.rs/trycmd/"
readme = "README.md"
categories = ["development-tools::testing"]
keywords = ["cli", "test", "assert", "command", "duct"]
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]

[package.metadata.release]
pre-release-replacements = [
{file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1},
{file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1},
{file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1},
{file="CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n", exactly=1},
{file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/assert-rs/trycmd/compare/{{tag_name}}...HEAD", exactly=1},
]

[features]
default = ["color-auto", "filesystem", "diff"]
color = ["snapbox/color", "dep:anstream"]
color-auto = ["snapbox/color-auto"]
diff = ["snapbox/diff"]
filesystem = ["snapbox/path"]

schema = ["dep:schemars", "dep:serde_json"]
examples = ["snapbox/examples"]
debug = ["snapbox/debug"]

[[bin]]
name = "bin-fixture"

[[bin]]
name = "trycmd-schema"
required-features = ["schema"]

[dependencies]
automod = "1.0.14"
snapbox = { path = "../snapbox", version = "0.5.10", default-features = false, features = ["cmd"] }
anstream = { version = "0.6.7", optional = true }

glob = "0.3.0"
rayon = "1.5.1"

serde = { version = "1.0", features = ["derive"] }
shlex = "1.1.0"
humantime = "2"
humantime-serde = "1"
toml_edit = { version = "0.19.14", features = ["serde"] }
escargot = { version = "0.5.7", optional = true }

schemars = { version = "0.8.3", features = ["preserve_order"], optional = true }
serde_json = { version = "1.0", optional = true }

[lints]
workspace = true
1 change: 1 addition & 0 deletions crates/trycmd/LICENSE-APACHE
1 change: 1 addition & 0 deletions crates/trycmd/LICENSE-MIT
55 changes: 55 additions & 0 deletions crates/trycmd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# trycmd

> Treat your tests like cattle, instead of [pets](https://docs.rs/snapbox)
[![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation]
![License](https://img.shields.io/crates/l/trycmd.svg)
[![Crates Status](https://img.shields.io/crates/v/trycmd.svg)][Crates.io]

`trycmd` is a test harness that will enumerate test case files and run them to verify the
results, taking inspiration from
[trybuild](https://crates.io/crates/trybuild) and [cram](https://bitheap.org/cram/).

## Example

To create a minimal setup, create a `tests/cli_tests.rs` with
```rust,no_run
#[test]
fn cli_tests() {
trycmd::TestCases::new()
.case("tests/cmd/*.toml")
.case("README.md");
}
```
and write out your test cases in `.toml` files along with examples in your `README.md`.

Run this with `cargo test` like normal. `TestCases` will enumerate all test case files and
run the contained commands, verifying they run as expected.

See the [docs](http://docs.rs/trycmd) for more.

## Users

- [typos](https://github.com/crate-ci/typos) (source code spell checker)
- See [port from `assert_cmd`](https://github.com/crate-ci/typos/compare/a8ae8a5..cdfdc4084c928423211c6a80acbd24dbed7108f6)
- [cargo-edit](https://github.com/killercup/cargo-edit) (`Cargo.toml` editor)
- [clap](https://github.com/clap-rs/clap/) (CLI parser) to test examples

## License

Licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)

at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.

[Crates.io]: https://crates.io/crates/trycmd
[Documentation]: https://docs.rs/trycmd
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6907a75

Please sign in to comment.