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

Function TestNewNodeTokenPosition

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

Source from the content-addressed store, hash-verified

97}
98
99func TestNewNodeTokenPosition(t *testing.T) {
100 n := node.NewIdentifier("test node")
101 n.SetPosition(&position.Position{
102 StartLine: 1,
103 EndLine: 1,
104 StartPos: 0,
105 EndPos: 9,
106 })
107
108 tkn := &scanner.Token{
109 Value: `foo`,
110 StartLine: 2,
111 EndLine: 2,
112 StartPos: 10,
113 EndPos: 12,
114 }
115
116 builder := positionbuilder.PositionBuilder{}
117
118 pos := builder.NewNodeTokenPosition(n, tkn)
119
120 if pos.String() != `Pos{Line: 1-2 Pos: 0-12}` {
121 t.Errorf("token value is not equal\n")
122 }
123}
124
125func TestNewNodeListPosition(t *testing.T) {
126 n1 := node.NewIdentifier("test node")

Callers

nothing calls this directly

Calls 4

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