gomu/lyric/lyric_test.go

31 lines
445 B
Go
Raw Normal View History

2021-02-23 10:24:23 +08:00
package lyric
import (
"io/ioutil"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCleanHTML(t *testing.T) {
2021-03-03 01:56:04 +08:00
clean, err := ioutil.ReadFile("./sample-clean.lrc")
2021-02-23 10:24:23 +08:00
if err != nil {
t.Error(err)
}
2021-03-03 01:56:04 +08:00
unclean, err := ioutil.ReadFile("./sample-unclean.lrc")
2021-02-23 10:24:23 +08:00
if err != nil {
t.Error(err)
}
2021-02-23 21:34:50 +08:00
got := cleanHTML(string(unclean))
assert.Equal(t, string(clean), got)
2021-03-03 01:56:04 +08:00
_, err = NewFromLRC(got)
2021-02-23 21:34:50 +08:00
if err != nil {
t.Error(err)
}
2021-02-23 10:24:23 +08:00
}