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

Function TestNewTokenNodePosition

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

Source from the content-addressed store, hash-verified

72}
73
74func TestNewTokenNodePosition(t *testing.T) {
75 tkn := &scanner.Token{
76 Value: `foo`,
77 StartLine: 1,
78 EndLine: 1,
79 StartPos: 0,
80 EndPos: 3,
81 }
82 n := node.NewIdentifier("test node")
83 n.SetPosition(&position.Position{
84 StartLine: 2,
85 EndLine: 2,
86 StartPos: 4,
87 EndPos: 12,
88 })
89
90 builder := positionbuilder.PositionBuilder{}
91
92 pos := builder.NewTokenNodePosition(tkn, n)
93
94 if pos.String() != `Pos{Line: 1-2 Pos: 0-12}` {
95 t.Errorf("token value is not equal\n")
96 }
97}
98
99func TestNewNodeTokenPosition(t *testing.T) {
100 n := node.NewIdentifier("test node")

Callers

nothing calls this directly

Calls 4

SetPositionMethod · 0.95
NewTokenNodePositionMethod · 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…