Commit 8f901c3635

8f901c3635249470f44d41ec28059217ab87d6ac

parent: 6bee23b811

Unsigned

Wraient <wraient.911@gmail.com> · 2026-07-22 20:55 UTC

Fix recovery Quit to return quit without os.Exit in tests

promptEpisodeLinkFailureRecovery maps Quit to \"quit\" for callers to
handle, instead of calling ExitCurd (which aborts unit tests).

Layout: unified · split

internal/episode_link_recovery_test.go +2 −2
@@ -73,8 +73,8 @@ func TestPromptEpisodeLinkFailureRecoveryMapsExitKeysToBack(t *testing.T) {
73 withPromptSelect(t, func(options []SelectionOption) (SelectionOption, error) { 73 withPromptSelect(t, func(options []SelectionOption) (SelectionOption, error) {
74 return SelectionOption{Key: "-1", Label: "Quit"}, nil 74 return SelectionOption{Key: "-1", Label: "Quit"}, nil
75 }) 75 })
76 if got := promptEpisodeLinkFailureRecovery(cfg, anime, errors.New("fail"), true); got != "back" { 76 if got := promptEpisodeLinkFailureRecovery(cfg, anime, errors.New("fail"), true); got != "quit" {
77 t.Fatalf("expected back for -1, got %q", got) 77 t.Fatalf("expected quit for -1, got %q", got)
78 } 78 }
79} 79}
80 80
internal/provider_mapping.go +1 −2
@@ -893,8 +893,7 @@ func promptEpisodeLinkFailureRecovery(config *CurdConfig, anime *Anime, lastErr
893 } 893 }
894 selected = NormalizeSelectionKey(selected) 894 selected = NormalizeSelectionKey(selected)
895 if SelectionMeansQuit(selected) { 895 if SelectionMeansQuit(selected) {
896 ExitCurd(nil) 896 return "quit"
897 return "back"
898 } 897 }
899 if SelectionMeansBack(selected) || selected.Key == "" { 898 if SelectionMeansBack(selected) || selected.Key == "" {
900 return "back" 899 return "back"