mirror of
https://github.com/Hopiu/lychee.git
synced 2026-03-28 02:10:27 +00:00
Add doc-comment tests
This commit is contained in:
parent
16cd67331a
commit
fe5cea1de3
5 changed files with 18 additions and 8 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -1399,6 +1399,7 @@ dependencies = [
|
|||
"check-if-email-exists",
|
||||
"deadpool",
|
||||
"derive_builder",
|
||||
"doc-comment",
|
||||
"futures",
|
||||
"glob",
|
||||
"headers",
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ assert_cmd = "1.0.3"
|
|||
predicates = "1.0.7"
|
||||
uuid = { version = "0.8.2", features = ["v4"] }
|
||||
tempfile = "3.2.0"
|
||||
doc-comment = "0.3.3"
|
||||
|
||||
[features]
|
||||
vendored-openssl = ["openssl-sys/vendored"]
|
||||
|
|
|
|||
12
README.md
12
README.md
|
|
@ -89,13 +89,13 @@ You can run lychee directly from the commandline.
|
|||
|
||||
#### Using cargo
|
||||
|
||||
```
|
||||
```sh
|
||||
cargo install lychee
|
||||
```
|
||||
|
||||
#### Using the official Docker image
|
||||
|
||||
```
|
||||
```sh
|
||||
docker pull lycheeverse/lychee
|
||||
```
|
||||
|
||||
|
|
@ -108,13 +108,13 @@ You can download them from the [releases page](https://github.com/lycheeverse/ly
|
|||
|
||||
Run it inside a repository with a `README.md`:
|
||||
|
||||
```
|
||||
```sh
|
||||
lychee
|
||||
```
|
||||
|
||||
You can also specify various types of inputs:
|
||||
|
||||
```
|
||||
```sh
|
||||
# check links on a website:
|
||||
lychee https://endler.dev/
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ token with no extra permissions is enough to be able to check public repos links
|
|||
There is an extensive list of commandline parameters to customize the behavior,
|
||||
see below for a full list.
|
||||
|
||||
```
|
||||
```sh
|
||||
USAGE:
|
||||
lychee [FLAGS] [OPTIONS] [--] [inputs]...
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||
|
||||
The client builder is very customizable:
|
||||
|
||||
```rust
|
||||
```rust,ignore
|
||||
let client = lychee::ClientBuilder::default()
|
||||
.includes(includes)
|
||||
.excludes(excludes)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,14 @@
|
|||
* }
|
||||
* ```
|
||||
*/
|
||||
|
||||
#[cfg(doctest)]
|
||||
#[macro_use]
|
||||
extern crate doc_comment;
|
||||
|
||||
#[cfg(doctest)]
|
||||
doctest!("../README.md");
|
||||
|
||||
mod client;
|
||||
mod client_pool;
|
||||
mod excludes;
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ mod readme {
|
|||
.expect("Invalid utf8 output for `--help`");
|
||||
let readme = load_readme_text();
|
||||
|
||||
const BACKTICKS_OFFSET: usize = 3;
|
||||
const BACKTICKS_OFFSET: usize = 5; // marker: ```sh
|
||||
const NEWLINE_OFFSET: usize = 1;
|
||||
|
||||
let usage_start = BACKTICKS_OFFSET
|
||||
+ NEWLINE_OFFSET
|
||||
+ readme
|
||||
.find("```\nUSAGE:\n")
|
||||
.find("```sh\nUSAGE:\n")
|
||||
.expect("Couldn't find USAGE section in README.md");
|
||||
|
||||
let usage_end = readme[usage_start..]
|
||||
Loading…
Reference in a new issue