improved test fail messages

This commit is contained in:
Hazel Noack 2025-10-07 14:27:16 +02:00
parent 60abe03885
commit 6e107f80f9

View File

@ -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)
}
}