feat(cli): real doctor subcommand with adb/emulator/java checks

Each check is a value so tests can swap in fakes. Java check parses
both legacy (1.8) and modern (17+) version strings. Emulator check
falls back to ANDROID_HOME/emulator/emulator since the brew cask
ships it without putting it on PATH.
This commit is contained in:
pj committed 2026-04-17 23:56:00 +07:00
1 parent 63796fbd42
commit b6b18c3681
4 files changed
+210 -7

No files matched your search

+6 -5
View File
@@ -104,11 +104,12 @@ func TestRun_UnknownCommand(t *testing.T) {
func TestRun_Doctor(t *testing.T) {
var stdout bytes.Buffer
if err := run([]string{"uatu", "doctor"}, &stdout, io.Discard); err != nil {
t.Fatal(err)
}
if !strings.Contains(stdout.String(), "doctor") {
t.Errorf("doctor output missing, got: %q", stdout.String())
// Doctor may pass or fail depending on host environment; we just want to
// confirm it runs and emits per-check lines.
_ = run([]string{"uatu", "doctor"}, &stdout, io.Discard)
output := stdout.String()
if !strings.Contains(output, "OK") && !strings.Contains(output, "FAIL") {
t.Errorf("doctor output missing OK/FAIL lines: %q", output)
}
}