mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-15 06:15:28 +02:00
Trim after removing inline timestamps before matching speaker prefixes in Dart. Run one 21-case usability corpus through Dart, Go, and Kotlin tests. Document the shared fixture and trigger Dart and Go CI when its resources change.
36 lines
906 B
Go
36 lines
906 B
Go
package gobackend
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strconv"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestSharedLyricsUsabilityCases(t *testing.T) {
|
|
data, err := os.ReadFile(filepath.Join("..", "android", "app", "src", "test", "resources", "lyrics_usability_cases.tsv"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
decode := strings.NewReplacer(`\n`, "\n", `\r`, "\r", `\t`, "\t")
|
|
for _, line := range strings.Split(string(data), "\n") {
|
|
if line == "" || strings.HasPrefix(line, "#") {
|
|
continue
|
|
}
|
|
fields := strings.Split(line, "\t")
|
|
if len(fields) != 3 {
|
|
t.Fatalf("invalid shared fixture: %q", line)
|
|
}
|
|
t.Run(fields[0], func(t *testing.T) {
|
|
want, err := strconv.ParseBool(fields[1])
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got := rawLyricsHasUsableContent(decode.Replace(fields[2])); got != want {
|
|
t.Errorf("rawLyricsHasUsableContent(%q) = %v, want %v", fields[2], got, want)
|
|
}
|
|
})
|
|
}
|
|
}
|