From 6e107f80f950ac11ad5f930cfe5e734963eb69d2 Mon Sep 17 00:00:00 2001 From: Hazel Noack Date: Tue, 7 Oct 2025 14:27:16 +0200 Subject: [PATCH] improved test fail messages --- internal/data/song_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/data/song_test.go b/internal/data/song_test.go index af3dd8b..44e1c89 100644 --- a/internal/data/song_test.go +++ b/internal/data/song_test.go @@ -25,11 +25,11 @@ func TestSongDeduplicate(t *testing.T) { compiled := song.Compile().(Song) if len(compiled.Artists) != 2 { - t.Errorf(`the two artists with the same name have to be merged, %d`, len(compiled.Artists)) + t.Errorf("expected 2 unique artists after deduplication, but got %d: %v", len(compiled.Artists), compiled.Artists) } if len(compiled.Album.Artists) != 2 { - t.Errorf(`the two artists with the same names in the album have to be merged, %d`, len(compiled.Album.Artists)) + t.Errorf("expected 2 unique album artists after deduplication, but got %d: %v", len(compiled.Album.Artists), compiled.Album.Artists) } } @@ -44,11 +44,11 @@ func TestSongUnify(t *testing.T) { compiled := song.Compile().(Song) if compiled.UnifiedName != "foo bar baz" { - t.Errorf(`the song name doesn't get compiled properly`) + t.Errorf("song unified name mismatch: expected 'foo bar baz', but got '%s'", compiled.UnifiedName) } if compiled.Album.UnifiedName != "foo" { - t.Errorf(`the album name in the song isn't unified`) + t.Errorf("album unified name mismatch: expected 'foo', but got '%s'", compiled.Album.UnifiedName) } } @@ -79,15 +79,15 @@ func TestAlbumDeduplicate(t *testing.T) { compiled := album.Compile().(Album) if len(compiled.Songs) != 4 { - t.Errorf(`didn't properly merge songs`) + t.Errorf("expected 4 unique songs after deduplication, but got %d: %v", len(compiled.Songs), compiled.Songs) } if len(compiled.Artists) != 1 { - t.Errorf(`didn't properly merge artists`) + t.Errorf("expected 1 unique artist after deduplication, but got %d: %v", len(compiled.Artists), compiled.Artists) } if len(compiled.Artists[0].Albums) != 2 { - t.Errorf(`didn't properly merge or deduplicate albums`) + t.Errorf("expected artist to have 2 unique albums after deduplication, but got %d: %v", len(compiled.Artists[0].Albums), compiled.Artists[0].Albums) } }