1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! End-to-end tests for `rtcom` command-line behaviour that does not
//! require a live pseudo-terminal.
//!
//! These cases exercise the argv-only paths — `--help`, `--version`,
//! missing-device error, `--save` without a device — so they are cheap
//! to run on every platform and don't depend on socat.
//!
//! PTY-driven cases live in `e2e_pty.rs`.
use Command;
use *;
/// `rtcom --help` should print the `about` string and exit cleanly.
///
/// We match against "Rust Terminal Communication" because the tagline
/// is set in `args::Cli::command` and is stable across releases.
/// `rtcom --version` should print something version-ish and exit 0.
///
/// The exact version string is assembled by `build.rs` into
/// `RTCOM_VERSION`; asserting on the literal number would couple this
/// test to every release bump, so we only check that the `rtcom` name
/// shows up in the output.
/// `rtcom` with no positional arg must fail: `device` is required by
/// clap. We only check that clap's usage message mentions the missing
/// argument, not the exact wording, because clap's phrasing varies
/// between major versions.
/// `--save` without a device should still fail for the same reason as
/// the bare invocation — clap rejects it before main ever runs.
/// Guards against a regression where someone might make `device`
/// conditionally optional.