github.com/blueinnovationsgroup/can-go@v0.0.0-20230518195432-d0567cda0028/pkg/dbc/analysis/passes/newsymbols/analyzer_test.go (about)

     1  package newsymbols
     2  
     3  import (
     4  	"testing"
     5  	"text/scanner"
     6  
     7  	"github.com/blueinnovationsgroup/can-go/pkg/dbc/analysis"
     8  	"github.com/blueinnovationsgroup/can-go/pkg/dbc/analysis/analysistest"
     9  )
    10  
    11  func TestAnalyzer(t *testing.T) {
    12  	analysistest.Run(t, Analyzer(), []*analysistest.Case{
    13  		{
    14  			Name: "ok",
    15  			Data: `NS_ :`,
    16  		},
    17  
    18  		{
    19  			Name: "not ok",
    20  			Data: `
    21  NS_ :
    22  	BA_DEF_DEF_REL_
    23  	BA_DEF_SGTYPE_`,
    24  			Diagnostics: []*analysis.Diagnostic{
    25  				{
    26  					Pos:     scanner.Position{Line: 1, Column: 1},
    27  					Message: "new symbols should be empty",
    28  				},
    29  			},
    30  		},
    31  	})
    32  }