package cli import ( "context" "io" "strings" "testing" "intake/internal/config" "intake/internal/scan" ) func TestFileAlbumKeepsAnInstalledLogger(t *testing.T) { var lines []string app := New(config.Defaults(), io.Discard, io.Discard, strings.NewReader("")) app.Logf = func(line string) { lines = append(lines, line) } if _, err := app.FileAlbum(context.Background(), "/nonexistent/album", nil); err == nil { t.Skip("expected a failure for a missing album") } app.logf("still listening") found := false for _, l := range lines { if strings.Contains(l, "still listening") { found = true } } if !found { t.Errorf("the installed logger was cleared by FileAlbum; got %v", lines) } } func TestQuietSuppressesEverything(t *testing.T) { var out strings.Builder app := New(config.Defaults(), &out, io.Discard, strings.NewReader("")) app.Quiet = true app.Logf = func(string) { t.Error("a quiet app must not call its logger") } app.logf("this must not appear") app.logf("nor this") if out.Len() != 0 { t.Errorf("quiet app wrote to its output: %q", out.String()) } } var _ = scan.Album{}