test: prove the documented examples against the binary (#15)

* test: prove the documented examples against the binary

The README, the website and the shipped SKILL.md all promise specific
records, keys and exit codes, and nothing was checking that the binary
still agrees. Cover the claims that were unverified: the eleven
credential-free commands, the one-day bound on every wait, the config
directory relocation, `serve` refusing to run without a listener, the
four action commands that answer with an exit code alone, the search
filters, `--password-stdin`, `room listen`'s join records, and every
`--json` field the docs name for search, browse, whoami, user, shares,
room, download, serve and portmap.

The library README's examples now compile as doctests: lib.rs includes
it as the crate docs and the fences are `no_run`, so a signature change
cannot leave the advertised usage stale.

Two things were wrong. SKILL.md listed `queued` as a `serve` upload
status, which `upload_record` never emits — an agent branching on it
would wait for a state that never arrives. And the library README still
pointed at the 7.x lib.

* test: cover the completions commands the docs now advertise
This commit is contained in:
Michel de Graaf
2026-07-26 12:56:40 +02:00
committed by GitHub
parent 1eef886b88
commit af4434e764
4 changed files with 543 additions and 11 deletions
+4 -4
View File
@@ -15,14 +15,14 @@ Add this to your `Cargo.toml`:
```toml
[dependencies]
soulseek-rs-lib = "7"
soulseek-rs-lib = "8"
```
## Example
### Simple Usage
```rust
```rust,no_run
use soulseek_rs::Client;
use std::time::Duration;
@@ -59,7 +59,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
### Advanced Configuration
```rust
```rust,no_run
use soulseek_rs::{Client, ClientSettings, PeerAddress};
fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -85,7 +85,7 @@ The server-backed lookups are request/poll pairs: you ask, then read the
answer once it lands. `request_user_info` clears any previous answer first, so
the loop below observes this request rather than the last one.
```rust
```rust,no_run
use soulseek_rs::Client;
use std::thread::sleep;
use std::time::{Duration, Instant};