package model import ( "testing" ) func Test_Track_DescriptionHTML(t *testing.T) { track := Track{ Description: "this is\na test\ndescription!", } // descriptions are set by privileged users, // so we'll allow HTML injection here want := "this is
a test
description!" got := track.GetDescriptionHTML() if want != string(got) { t.Errorf(`track description incorrectly formatted (want "%s", got "%s")`, want, got) } } func Test_Track_LyricsHTML(t *testing.T) { track := Track{ Lyrics: "these are\ntest\nlyrics!", } // lyrics are set by privileged users, // so we'll allow HTML injection here want := "these are
test
lyrics!" got := track.GetLyricsHTML() if want != string(got) { t.Errorf(`track lyrics incorrectly formatted (want "%s", got "%s")`, want, got) } } func Test_Track_Add(t *testing.T) { track := Track{} want := 4 got := track.Add(2, 2) if want != got { t.Errorf(`somehow, we screwed up addition. (want %d, got %d)`, want, got) } }