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

     1  package dbc
     2  
     3  import (
     4  	"testing"
     5  
     6  	"gotest.tools/v3/assert"
     7  )
     8  
     9  func TestAccessType_Validate(t *testing.T) {
    10  	for _, tt := range []AccessType{
    11  		AccessTypeUnrestricted,
    12  		AccessTypeRead,
    13  		AccessTypeWrite,
    14  		AccessTypeReadWrite,
    15  	} {
    16  		assert.NilError(t, tt.Validate())
    17  	}
    18  }
    19  
    20  func TestAccessType_Validate_Error(t *testing.T) {
    21  	assert.ErrorContains(t, AccessType("foo").Validate(), "invalid access type")
    22  }