(t *testing.T)
| 217 | } |
| 218 | |
| 219 | func TestRunWatchSubcommandMessages(t *testing.T) { |
| 220 | root := t.TempDir() |
| 221 | |
| 222 | stdout, _ := captureMainStreams(t, func() { runWatchSubcommand("status", root) }) |
| 223 | if !strings.Contains(stdout, "Watch daemon not running") { |
| 224 | t.Fatalf("expected not-running status, got:\n%s", stdout) |
| 225 | } |
| 226 | |
| 227 | writeMainWatchState(t, root, watch.State{ |
| 228 | UpdatedAt: time.Now(), |
| 229 | FileCount: 9, |
| 230 | Hubs: []string{"pkg/types.go"}, |
| 231 | }, true) |
| 232 | |
| 233 | stdout, _ = captureMainStreams(t, func() { runWatchSubcommand("start", root) }) |
| 234 | if !strings.Contains(stdout, "Watch daemon already running") { |
| 235 | t.Fatalf("expected already-running start output, got:\n%s", stdout) |
| 236 | } |
| 237 | |
| 238 | stdout, _ = captureMainStreams(t, func() { runWatchSubcommand("status", root) }) |
| 239 | for _, check := range []string{"Watch daemon running", "Files: 9", "Hubs: 1"} { |
| 240 | if !strings.Contains(stdout, check) { |
| 241 | t.Fatalf("expected %q in output, got:\n%s", check, stdout) |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | watch.RemovePID(root) |
| 246 | stdout, _ = captureMainStreams(t, func() { runWatchSubcommand("stop", root) }) |
| 247 | if !strings.Contains(stdout, "Watch daemon not running") { |
| 248 | t.Fatalf("expected stop to report not running, got:\n%s", stdout) |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | func TestRunHandoffSubcommandLatestVariantsMore(t *testing.T) { |
| 253 | root := t.TempDir() |
nothing calls this directly
no test coverage detected