File: source_code_info_test.go

package info (click to toggle)
golang-github-lyft-protoc-gen-star 2.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 940 kB
  • sloc: makefile: 145
file content (26 lines) | stat: -rw-r--r-- 669 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package pgs

import (
	"testing"

	"github.com/stretchr/testify/assert"
	"google.golang.org/protobuf/proto"
	descriptor "google.golang.org/protobuf/types/descriptorpb"
)

func TestSourceCodeInfo(t *testing.T) {
	t.Parallel()

	desc := &descriptor.SourceCodeInfo_Location{
		LeadingComments:         proto.String("leading"),
		TrailingComments:        proto.String("trailing"),
		LeadingDetachedComments: []string{"detached"},
	}

	info := sci{desc}

	assert.Equal(t, desc, info.Location())
	assert.Equal(t, "leading", info.LeadingComments())
	assert.Equal(t, "trailing", info.TrailingComments())
	assert.Equal(t, []string{"detached"}, info.LeadingDetachedComments())
}