Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcea04ee4e |
No files matched your search
@@ -253,9 +253,9 @@ In order:
|
||||
`trees` check only that each copy they name still exists, and leave out a
|
||||
copy that is gone. `scan` is built to run from `cron`. The reports run at any
|
||||
time, against what the database holds.
|
||||
4. **Keep the streams apart.** stdout holds only what was asked for:
|
||||
machine-readable data, or help. Everything else for a human reader, such as
|
||||
progress and warnings, goes to stderr.
|
||||
4. **Keep the streams apart.** Everything on stdout is machine-readable data.
|
||||
Everything for a human reader, such as progress and warnings, goes to stderr.
|
||||
The one exception is help that was asked for, which goes to stdout.
|
||||
|
||||
### Subcommands
|
||||
|
||||
|
||||
@@ -773,36 +773,6 @@ func TestRunHelp(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunHelpScanPrintsScanHelp(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// "sfdupes help scan" and "sfdupes --help scan" print exactly what
|
||||
// "sfdupes scan --help" prints: the help of scan, not of sfdupes.
|
||||
var want bytes.Buffer
|
||||
|
||||
run([]string{cmdScan, helpFlag}, &want, io.Discard)
|
||||
|
||||
for _, args := range [][]string{
|
||||
{helpCommand, cmdScan}, {helpFlag, cmdScan},
|
||||
} {
|
||||
var stdout, stderr bytes.Buffer
|
||||
|
||||
code := run(args, &stdout, &stderr)
|
||||
if code != exitOK {
|
||||
t.Errorf("run(%v) = %d, want %d", args, code, exitOK)
|
||||
}
|
||||
|
||||
if got := stdout.String(); got != want.String() {
|
||||
t.Errorf("run(%v) stdout = %q, want what scan %s prints, %q",
|
||||
args, got, helpFlag, want.String())
|
||||
}
|
||||
|
||||
if got := stderr.String(); got != "" {
|
||||
t.Errorf("run(%v) stderr = %q, want nothing", args, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunScanUsageLine(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in new issue
Block a user