github.com/lambdatest/go-gitignore@v0.0.0-20230214141342-7fe15342e580/position_test.go (about)

     1  package gitignore_test
     2  
     3  import (
     4  	"github.com/denormal/go-gitignore"
     5  	"testing"
     6  )
     7  
     8  func TestPosition(t *testing.T) {
     9  	// test the conversion of Positions to strings
    10  	for _, _p := range _POSITIONS {
    11  		_position := gitignore.Position{
    12  			File:   _p.File,
    13  			Line:   _p.Line,
    14  			Column: _p.Column,
    15  			Offset: _p.Offset,
    16  		}
    17  
    18  		// ensure the string representation of the Position is as expected
    19  		_rtn := _position.String()
    20  		if _rtn != _p.String {
    21  			t.Errorf(
    22  				"position mismatch; expected %q, got %q",
    23  				_p.String, _rtn,
    24  			)
    25  		}
    26  	}
    27  } // TestPosition()