Skip to content

Commit 0036907

Browse files
committed
[meta] switch to cargo sync-rdme
This is exactly the readme generator I feel like I wanted.
1 parent b421998 commit 0036907

File tree

5 files changed

+31
-54
lines changed

5 files changed

+31
-54
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
run: cargo clippy --all-features --all-targets
2626
- name: Lint (rustfmt)
2727
run: cargo xfmt --check
28-
- name: Install cargo readme and just
28+
- name: Install cargo-sync-rdme and just
2929
uses: taiki-e/install-action@8484225d9734e230a8bf38421a4ffec1cc249372 # v2
3030
with:
31-
tool: cargo-readme,just
31+
tool: cargo-sync-rdme,just
3232
- name: Generate readmes
3333
run: just generate-readmes
3434
- name: Check for differences

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ categories = ["development-tools::testing"]
1111
keywords = ["datatest", "data-driven-tests", "test-harness"]
1212
rust-version = "1.72"
1313

14+
[badges]
15+
maintenance = { status = "passively-maintained" }
16+
17+
[package.metadata.cargo-sync-rdme.badge.badges]
18+
maintenance = true
19+
license = true
20+
crates-io = true
21+
docs-rs = true
22+
rust-version = true
23+
1424
[dependencies]
1525
camino = "1.1.9"
1626
fancy-regex = "0.14.0"

Justfile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ rustdoc:
99
| xargs printf -- '-p %s\n' \
1010
| RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS='--cfg=doc_cfg' xargs cargo doc --no-deps --lib --all-features
1111

12-
# Generate README.md files from README.tpl and lib.rs files
12+
# Generate README.md files using `cargo-sync-rdme`.
1313
generate-readmes:
14-
#!/usr/bin/env bash
15-
set -eo pipefail
16-
17-
git ls-files | grep README.tpl$ | while read -r readme; do
18-
echo "Generating README for $readme"
19-
dir=$(dirname "$readme")
20-
cargo readme --project-root "$dir" > "$dir/README.md.tmp"
21-
gawk -f "scripts/fix-readmes.awk" "$dir/README.md.tmp" > "$dir/README.md"
22-
rm "$dir/README.md.tmp"
23-
done
14+
cargo sync-rdme --toolchain nightly

README.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
<!-- cargo-sync-rdme title [[ -->
12
# datatest-stable
2-
3-
[![datatest-stable on crates.io](https://img.shields.io/crates/v/datatest-stable)](https://crates.io/crates/datatest-stable)
4-
[![Documentation (latest release)](https://img.shields.io/badge/docs-latest-brightgreen)](https://docs.rs/datatest-stable/)
5-
[![Documentation (main)](https://img.shields.io/badge/docs-main-purple)](https://datatest-stable.nexte.st/)
6-
[![License](https://img.shields.io/badge/license-Apache-green.svg)](../LICENSE-APACHE)
7-
[![License](https://img.shields.io/badge/license-MIT-green.svg)](../LICENSE-MIT)
8-
3+
<!-- cargo-sync-rdme ]] -->
4+
<!-- cargo-sync-rdme badge [[ -->
5+
[![Maintenance: passively-maintained](https://img.shields.io/badge/maintenance-passively--maintained-yellowgreen.svg?)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section)
6+
![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/datatest-stable.svg?)
7+
[![crates.io](https://img.shields.io/crates/v/datatest-stable.svg?logo=rust)](https://crates.io/crates/datatest-stable)
8+
[![docs.rs](https://img.shields.io/docsrs/datatest-stable.svg?logo=docs.rs)](https://docs.rs/datatest-stable)
9+
[![Rust: ^1.72.0](https://img.shields.io/badge/rust-^1.72.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)
10+
<!-- cargo-sync-rdme ]] -->
11+
<!-- cargo-sync-rdme rustdoc [[ -->
912
`datatest-stable` is a test harness intended to write *file-driven* or *data-driven* tests,
1013
where individual test cases are specified as files and not as code.
1114

@@ -24,11 +27,11 @@ organization](https://github.com/nextest-rs/) on GitHub.
2427

2528
1. Configure the test target by setting `harness = false` in `Cargo.toml`:
2629

27-
```toml
30+
````toml
2831
[[test]]
2932
name = "<test target name>"
3033
harness = false
31-
```
34+
````
3235

3336
2. Call the `datatest_stable::harness!(testfn, root, pattern)` macro with the following
3437
parameters:
@@ -37,15 +40,15 @@ harness = false
3740
of:
3841
* `fn(&Path) -> datatest_stable::Result<()>`
3942
* `fn(&Utf8Path) -> datatest_stable::Result<()>` (`Utf8Path` is part of the
40-
[`camino`](https://docs.rs/camino) library, and is re-exported here for convenience.)
43+
[`camino`](https://docs.rs/camino) library, and is re-exported here for convenience.)
4144
* `fn(&P, String) -> datatest_stable::Result<()>` where `P` is `Path` or `Utf8Path`. If the
4245
extra `String` parameter is specified, the contents of the file will be loaded and passed in
4346
as a string (erroring out if that failed).
4447
* `fn(&P, Vec<u8>) -> datatest_stable::Result<()>` where `P` is `Path` or `Utf8Path`. If the
4548
extra `Vec<u8>` parameter is specified, the contents of the file will be loaded and passed
4649
in as a `Vec<u8>` (erroring out if that failed).
4750
* `root` - The path to the root directory where the input files (fixtures) live. This path is
48-
relative to the root of the crate (the directory where the crate's `Cargo.toml` is located).
51+
relative to the root of the crate (the directory where the crates `Cargo.toml` is located).
4952
* `pattern` - a regex used to match against and select each file to be tested. Extended regexes
5053
with lookaround and backtracking are supported via the
5154
[`fancy_regex`](https://docs.rs/fancy-regex) crate.
@@ -57,7 +60,7 @@ The three parameters can be repeated if you have multiple sets of data-driven te
5760

5861
This is an example test. Use it with `harness = false`.
5962

60-
```rust
63+
````rust
6164
use datatest_stable::Utf8Path;
6265
use std::path::Path;
6366

@@ -77,7 +80,7 @@ datatest_stable::harness!(
7780
my_test, "path/to/fixtures", r"^.*/*",
7881
my_test_utf8, "path/to/fixtures", r"^.*/*",
7982
);
80-
```
83+
````
8184

8285
## Minimum supported Rust version (MSRV)
8386

@@ -89,15 +92,9 @@ version update; at any time, Rust versions from at least the last 6 months are s
8992
* [`datatest`](https://crates.io/crates/datatest): the original inspiration for this crate, with
9093
more features but targeting nightly Rust.
9194
* [Data-driven testing](https://en.wikipedia.org/wiki/Data-driven_testing)
95+
<!-- cargo-sync-rdme ]] -->
9296

9397
## License
9498

9599
This project is available under the terms of either the [Apache 2.0 license](LICENSE-APACHE) or the [MIT
96100
license](LICENSE-MIT).
97-
98-
<!--
99-
README.md is generated from README.tpl by cargo readme. To regenerate:
100-
101-
cargo install cargo-readme
102-
./scripts/regenerate-readmes.sh
103-
-->

README.tpl

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)