MCPcopy Create free account
hub / github.com/z7zmey/php-parser / TestNewNodeListTokenPosition

Function TestNewNodeListTokenPosition

positionbuilder/position_builder_test.go:177–209  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

175}
176
177func TestNewNodeListTokenPosition(t *testing.T) {
178 n1 := node.NewIdentifier("test node")
179 n1.SetPosition(&position.Position{
180 StartLine: 1,
181 EndLine: 1,
182 StartPos: 0,
183 EndPos: 9,
184 })
185
186 n2 := node.NewIdentifier("test node")
187 n2.SetPosition(&position.Position{
188 StartLine: 2,
189 EndLine: 2,
190 StartPos: 10,
191 EndPos: 19,
192 })
193
194 tkn := &scanner.Token{
195 Value: `foo`,
196 StartLine: 3,
197 EndLine: 3,
198 StartPos: 20,
199 EndPos: 22,
200 }
201
202 builder := positionbuilder.PositionBuilder{}
203
204 pos := builder.NewNodeListTokenPosition([]node.Node{n1, n2}, tkn)
205
206 if pos.String() != `Pos{Line: 1-3 Pos: 0-22}` {
207 t.Errorf("token value is not equal\n")
208 }
209}
210
211func TestNewTokenNodeListPosition(t *testing.T) {
212 tkn := &scanner.Token{

Callers

nothing calls this directly

Calls 4

SetPositionMethod · 0.95
NewIdentifierFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…