Skip to content

Commit

Permalink
Allow protofiles to be specified by fullpath (#129)
Browse files Browse the repository at this point in the history
* Allow protofiles to be specified by fullpath

Signed-off-by: Ricardo Seriani <[email protected]>

* Remove helper func testdata and refactor tests

Signed-off-by: Ricardo Seriani <[email protected]>
  • Loading branch information
ricardoseriani authored and ktr0731 committed Nov 15, 2018
1 parent 267b27c commit 0fa49ad
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions adapter/internal/protoparser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
)

func ParseFile(fnames []string, paths []string) ([]*desc.FileDescriptor, error) {
paths = append(paths, ".")

p := &protoparse.Parser{
ImportPaths: paths,
}
Expand Down
2 changes: 1 addition & 1 deletion adapter/protobuf/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestMessage(t *testing.T) {
})

t.Run("importing", func(t *testing.T) {
libraryProto := testdata("importing", "library.proto")
libraryProto := "library.proto"
d, err := protoparser.ParseFile([]string{libraryProto}, []string{"testdata/importing"})
require.NoError(t, err)

Expand Down
2 changes: 1 addition & 1 deletion adapter/protobuf/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func TestParseFile(t *testing.T) {
t.Run("importing", func(t *testing.T) {
fnames := []string{testdata("importing", "library.proto")}
fnames := []string{"library.proto"}
pkgs, err := ParseFile(fnames, []string{"testdata/importing"})
require.NoError(t, err)
assert.Len(t, pkgs, 1)
Expand Down
4 changes: 0 additions & 4 deletions adapter/protobuf/protobuf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,3 @@ func toEntitiesFrom(files []*desc.FileDescriptor) ([]*entity.Package, error) {

return pkgs, nil
}

func testdata(s ...string) string {
return filepath.Join(append([]string{"testdata"}, s...)...)
}

0 comments on commit 0fa49ad

Please sign in to comment.