2020-06-29 11:38:10 +00:00
|
|
|
package position_test
|
2020-05-12 21:16:36 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"gotest.tools/assert"
|
|
|
|
"testing"
|
|
|
|
|
2020-06-29 11:38:10 +00:00
|
|
|
builder "github.com/z7zmey/php-parser/internal/position"
|
2020-05-12 21:16:36 +00:00
|
|
|
"github.com/z7zmey/php-parser/pkg/ast"
|
|
|
|
"github.com/z7zmey/php-parser/pkg/position"
|
2020-08-17 17:31:04 +00:00
|
|
|
"github.com/z7zmey/php-parser/pkg/token"
|
2020-05-12 21:16:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewTokenPosition(t *testing.T) {
|
2020-08-17 17:31:04 +00:00
|
|
|
tkn := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 3,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewTokenPosition(tkn)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 1, EndPos: 3}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewTokensPosition(t *testing.T) {
|
2020-08-17 17:31:04 +00:00
|
|
|
token1 := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 3,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
2020-08-17 17:31:04 +00:00
|
|
|
token2 := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 4,
|
|
|
|
EndPos: 6,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewTokensPosition(token1, token2)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 2, EndPos: 6}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewNodePosition(t *testing.T) {
|
|
|
|
n := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 3,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewNodePosition(n)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 1, EndPos: 3}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewTokenNodePosition(t *testing.T) {
|
2020-08-17 17:31:04 +00:00
|
|
|
tkn := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 3,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
n := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 4,
|
|
|
|
EndPos: 12,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewTokenNodePosition(tkn, n)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 2, EndPos: 12}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewNodeTokenPosition(t *testing.T) {
|
|
|
|
n := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 9,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-08-17 17:31:04 +00:00
|
|
|
tkn := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 10,
|
|
|
|
EndPos: 12,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewNodeTokenPosition(n, tkn)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 2, EndPos: 12}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewNodeListPosition(t *testing.T) {
|
|
|
|
n1 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 9,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
n2 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 10,
|
|
|
|
EndPos: 19,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewNodeListPosition([]ast.Vertex{n1, n2})
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 2, EndPos: 19}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewNodesPosition(t *testing.T) {
|
|
|
|
n1 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 9,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
n2 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 10,
|
|
|
|
EndPos: 19,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewNodesPosition(n1, n2)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 2, EndPos: 19}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewNodeListTokenPosition(t *testing.T) {
|
|
|
|
n1 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 9,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
n2 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 10,
|
|
|
|
EndPos: 19,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-08-17 17:31:04 +00:00
|
|
|
tkn := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 3,
|
|
|
|
EndLine: 3,
|
|
|
|
StartPos: 20,
|
|
|
|
EndPos: 22,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewNodeListTokenPosition([]ast.Vertex{n1, n2}, tkn)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 3, EndPos: 22}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewTokenNodeListPosition(t *testing.T) {
|
2020-08-17 17:31:04 +00:00
|
|
|
tkn := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 2,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
n1 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 3,
|
|
|
|
EndPos: 10,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
n2 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 3,
|
|
|
|
EndLine: 3,
|
|
|
|
StartPos: 11,
|
|
|
|
EndPos: 20,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewTokenNodeListPosition(tkn, []ast.Vertex{n1, n2})
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 3, EndPos: 20}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewNodeNodeListPosition(t *testing.T) {
|
|
|
|
n1 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 8,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
n2 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 9,
|
|
|
|
EndPos: 17,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
n3 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 3,
|
|
|
|
EndLine: 3,
|
|
|
|
StartPos: 18,
|
|
|
|
EndPos: 26,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewNodeNodeListPosition(n1, []ast.Vertex{n2, n3})
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 3, EndPos: 26}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewNodeListNodePosition(t *testing.T) {
|
|
|
|
n1 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 8,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
n2 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 9,
|
|
|
|
EndPos: 17,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
n3 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 3,
|
|
|
|
EndLine: 3,
|
|
|
|
StartPos: 18,
|
|
|
|
EndPos: 26,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewNodeListNodePosition([]ast.Vertex{n1, n2}, n3)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 3, EndPos: 26}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewOptionalListTokensPosition(t *testing.T) {
|
2020-08-17 17:31:04 +00:00
|
|
|
token1 := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 3,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
2020-08-17 17:31:04 +00:00
|
|
|
token2 := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 4,
|
|
|
|
EndPos: 6,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewOptionalListTokensPosition(nil, token1, token2)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: 2, EndPos: 6}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewOptionalListTokensPosition2(t *testing.T) {
|
|
|
|
n2 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 2,
|
|
|
|
EndLine: 2,
|
|
|
|
StartPos: 9,
|
|
|
|
EndPos: 17,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
n3 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 3,
|
|
|
|
EndLine: 3,
|
|
|
|
StartPos: 18,
|
|
|
|
EndPos: 26,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-08-17 17:31:04 +00:00
|
|
|
token1 := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 4,
|
|
|
|
EndLine: 4,
|
|
|
|
StartPos: 27,
|
|
|
|
EndPos: 29,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
2020-08-17 17:31:04 +00:00
|
|
|
token2 := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 5,
|
|
|
|
EndLine: 5,
|
|
|
|
StartPos: 30,
|
|
|
|
EndPos: 32,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewOptionalListTokensPosition([]ast.Vertex{n2, n3}, token1, token2)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 2, EndLine: 5, StartPos: 9, EndPos: 32}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNilNodePos(t *testing.T) {
|
|
|
|
pos := builder.NewNodesPosition(nil, nil)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: -1, EndLine: -1, StartPos: -1, EndPos: -1}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNilNodeListPos(t *testing.T) {
|
|
|
|
n1 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 8,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewNodeNodeListPosition(n1, nil)
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: -1, EndPos: -1}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNilNodeListTokenPos(t *testing.T) {
|
2020-12-07 22:04:12 +00:00
|
|
|
tkn := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 3,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
pos := builder.NewNodeListTokenPosition(nil, tkn)
|
2020-05-12 21:16:36 +00:00
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: -1, EndLine: 1, StartPos: -1, EndPos: 3}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestEmptyNodeListPos(t *testing.T) {
|
|
|
|
n1 := &ast.Identifier{
|
2020-12-07 22:04:12 +00:00
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 8,
|
2020-05-12 21:16:36 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
pos := builder.NewNodeNodeListPosition(n1, []ast.Vertex{})
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: 1, EndLine: -1, EndPos: -1}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestEmptyNodeListTokenPos(t *testing.T) {
|
2020-12-07 22:04:12 +00:00
|
|
|
tkn := &token.Token{
|
2020-05-17 20:50:23 +00:00
|
|
|
Value: []byte(`foo`),
|
2020-08-17 17:31:04 +00:00
|
|
|
Position: &position.Position{
|
2020-05-17 20:50:23 +00:00
|
|
|
StartLine: 1,
|
|
|
|
EndLine: 1,
|
|
|
|
StartPos: 0,
|
|
|
|
EndPos: 3,
|
|
|
|
},
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
pos := builder.NewNodeListTokenPosition([]ast.Vertex{}, tkn)
|
2020-05-12 21:16:36 +00:00
|
|
|
|
2020-12-07 22:04:12 +00:00
|
|
|
assert.DeepEqual(t, &position.Position{StartLine: -1, EndLine: 1, StartPos: -1, EndPos: 3}, pos)
|
2020-05-12 21:16:36 +00:00
|
|
|
}
|