add error handling to arg encoding and message/bundle ToBytes()

This commit is contained in:
Joel Wetzell
2026-04-13 18:38:25 -05:00
parent 1130adf046
commit 4744321d71
9 changed files with 169 additions and 62 deletions
+15 -9
View File
@@ -9,9 +9,9 @@ import (
func TestOSCBundleEncoding(t *testing.T) {
testCases := []struct {
description string
bundle *OSCBundle
expected []byte
name string
bundle *OSCBundle
expected []byte
}{
{
"simple contents single message",
@@ -32,13 +32,19 @@ func TestOSCBundleEncoding(t *testing.T) {
for _, testCase := range testCases {
actual := testCase.bundle.ToBytes()
t.Run(testCase.name, func(t *testing.T) {
got, err := testCase.bundle.ToBytes()
if err != nil {
t.Fatalf("failed to encode properly: %s", err.Error())
}
if !reflect.DeepEqual(got, testCase.expected) {
t.Fatalf("failed to encode properly got '%v', expected '%v'", got, testCase.expected)
}
})
if !reflect.DeepEqual(actual, testCase.expected) {
t.Errorf("Test '%s' failed to encode properly", testCase.description)
fmt.Printf("expected: %v\n", testCase.expected)
fmt.Printf("actual: %v\n", actual)
}
}
}