github.com/jshiv/can-go@v0.2.1-0.20210224011015-069e90e90bdf/pkg/descriptor/sendtype_test.go (about)

     1  package descriptor
     2  
     3  import (
     4  	"testing"
     5  
     6  	"gotest.tools/v3/assert"
     7  )
     8  
     9  func TestSendType_UnmarshalString(t *testing.T) {
    10  	for _, tt := range []struct {
    11  		str      string
    12  		expected SendType
    13  	}{
    14  		{str: "Cyclic", expected: SendTypeCyclic},
    15  		{str: "Periodic", expected: SendTypeCyclic},
    16  		{str: "OnEvent", expected: SendTypeEvent},
    17  		{str: "Event", expected: SendTypeEvent},
    18  	} {
    19  		tt := tt
    20  		t.Run(tt.str, func(t *testing.T) {
    21  			var actual SendType
    22  			assert.NilError(t, actual.UnmarshalString(tt.str))
    23  			assert.Equal(t, tt.expected, actual)
    24  		})
    25  	}
    26  }