mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
improve CLI error semantics and soundcloud canonicalization
Auto-upgrade outdated configs on startup, add actionable SSL verification hints in rip error paths, and harden SoundCloud search/metadata with canonical URL handling and richer source IDs.
This commit is contained in:
@@ -53,6 +53,37 @@ func TestLoadOutdatedConfig(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpgradeOutdatedConfig(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
path := filepath.Join(tmpDir, "config.toml")
|
||||
|
||||
data := DefaultConfigData()
|
||||
data.Misc.Version = "1.0.0"
|
||||
data.Downloads.Folder = filepath.Join(tmpDir, "Music")
|
||||
if err := saveConfigData(path, data); err != nil {
|
||||
t.Fatalf("saveConfigData() error = %v", err)
|
||||
}
|
||||
|
||||
resolved, err := UpgradeOutdated(path)
|
||||
if err != nil {
|
||||
t.Fatalf("UpgradeOutdated() error = %v", err)
|
||||
}
|
||||
if resolved != path {
|
||||
t.Fatalf("resolved path = %q, want %q", resolved, path)
|
||||
}
|
||||
|
||||
cfg, err := Load(path)
|
||||
if err != nil {
|
||||
t.Fatalf("Load() after upgrade error = %v", err)
|
||||
}
|
||||
if cfg.File.Misc.Version != CurrentConfigVersion {
|
||||
t.Fatalf("version = %q, want %q", cfg.File.Misc.Version, CurrentConfigVersion)
|
||||
}
|
||||
if cfg.File.Downloads.Folder != data.Downloads.Folder {
|
||||
t.Fatalf("downloads folder changed unexpectedly")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSessionCloneDoesNotAliasSlices(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
path := filepath.Join(tmpDir, "config.toml")
|
||||
|
||||
Reference in New Issue
Block a user