Skip to content

Commit

Permalink
extend test
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Lehner <dev@der-flo.net>
  • Loading branch information
florianl committed May 13, 2021
1 parent 461b099 commit 47cac29
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions m_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,24 @@ func TestAction(t *testing.T) {
t.Fatalf("unexpected error: %v", err)
}
})

t.Run("unmarshalAction(unknown)", func(t *testing.T) {
info := &Action{}
if err := unmarshalAction(generateActUnknown(t), info); err == nil {
t.Fatal("Expected error but got none")
}
})
}

func generateActUnknown(t *testing.T) []byte {
t.Helper()
options := []tcOption{}
options = append(options, tcOption{Interpretation: vtString, Type: tcaActKind, Data: "unknown"})
options = append(options, tcOption{Interpretation: vtBytes, Type: tcaActOptions, Data: []byte{0x42}})

data, err := marshalAttributes(options)
if err != nil {
t.Fatalf("could not generate test data: %v", err)
}
return data
}

0 comments on commit 47cac29

Please sign in to comment.