internal/pipewire: use type name in error strings
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m44s
Test / Sandbox (race detector) (push) Successful in 4m39s
Test / Hakurei (push) Successful in 4m52s
Test / Hpkg (push) Successful in 4m53s
Test / Hakurei (race detector) (push) Successful in 6m28s
Test / Flake checks (push) Successful in 1m33s

This provides more useful messages for protocol errors.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-12-04 02:27:45 +09:00
parent 2c0b92771a
commit 69b1131d66
4 changed files with 110 additions and 20 deletions

View File

@@ -3,10 +3,32 @@ package pipewire_test
import (
_ "embed"
"encoding/binary"
"testing"
"hakurei.app/internal/pipewire"
)
func TestSPAKind(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
v pipewire.SPAKind
want string
}{
{"invalid", 0xdeadbeef, "invalid type field 0xdeadbeef"},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
if got := tc.v.String(); got != tc.want {
t.Errorf("String: %q, want %q", got, tc.want)
}
})
}
}
// splitMessages splits concatenated messages into groups of
// header, payload, footer of each individual message.
// splitMessages panics on any decoding error.