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

Function TestNewNodeNodeListPosition

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

Source from the content-addressed store, hash-verified

243}
244
245func TestNewNodeNodeListPosition(t *testing.T) {
246 n1 := node.NewIdentifier("test node")
247 n1.SetPosition(&position.Position{
248 StartLine: 1,
249 EndLine: 1,
250 StartPos: 0,
251 EndPos: 8,
252 })
253
254 n2 := node.NewIdentifier("test node")
255 n2.SetPosition(&position.Position{
256 StartLine: 2,
257 EndLine: 2,
258 StartPos: 9,
259 EndPos: 17,
260 })
261
262 n3 := node.NewIdentifier("test node")
263 n3.SetPosition(&position.Position{
264 StartLine: 3,
265 EndLine: 3,
266 StartPos: 18,
267 EndPos: 26,
268 })
269
270 builder := positionbuilder.PositionBuilder{}
271
272 pos := builder.NewNodeNodeListPosition(n1, []node.Node{n2, n3})
273
274 if pos.String() != `Pos{Line: 1-3 Pos: 0-26}` {
275 t.Errorf("token value is not equal\n")
276 }
277}
278
279func TestNewNodeListNodePosition(t *testing.T) {
280 n1 := node.NewIdentifier("test node")

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…