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

Function TestNewNodeListNodePosition

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

Source from the content-addressed store, hash-verified

277}
278
279func TestNewNodeListNodePosition(t *testing.T) {
280 n1 := node.NewIdentifier("test node")
281 n1.SetPosition(&position.Position{
282 StartLine: 1,
283 EndLine: 1,
284 StartPos: 0,
285 EndPos: 8,
286 })
287 n2 := node.NewIdentifier("test node")
288 n2.SetPosition(&position.Position{
289 StartLine: 2,
290 EndLine: 2,
291 StartPos: 9,
292 EndPos: 17,
293 })
294 n3 := node.NewIdentifier("test node")
295 n3.SetPosition(&position.Position{
296 StartLine: 3,
297 EndLine: 3,
298 StartPos: 18,
299 EndPos: 26,
300 })
301
302 builder := positionbuilder.PositionBuilder{}
303
304 pos := builder.NewNodeListNodePosition([]node.Node{n1, n2}, n3)
305
306 if pos.String() != `Pos{Line: 1-3 Pos: 0-26}` {
307 t.Errorf("token value is not equal\n")
308 }
309}
310
311func TestNewOptionalListTokensPosition(t *testing.T) {
312 builder := positionbuilder.PositionBuilder{}

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…