From 588f7f942d0790da543531d9c4dad4b50618e2e6 Mon Sep 17 00:00:00 2001 From: Brandon Duffany Date: Thu, 20 Apr 2023 21:10:57 -0400 Subject: [PATCH] Test absolute paths --- test/proto/abs_reference.proto | 30 ++++++++++++++++++++++++++++++ test/run.sh | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 test/proto/abs_reference.proto diff --git a/test/proto/abs_reference.proto b/test/proto/abs_reference.proto new file mode 100644 index 0000000..42b4f08 --- /dev/null +++ b/test/proto/abs_reference.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package abs_reference; + +message Scope1 { + message Scope2 { + message A {} + + message Scope1 { + Scope2.A field_a = 1; + .abs_reference.Scope2.B field_b_should_be_message = 2; + abs_reference.Scope2.B field_b_should_be_enum = 3; + .abs_reference.Scope1.Scope2 field_c = 4; + } + + // Attempt to confuse the field references above by defining a message that + // clashes with the root package name. + message abs_reference { + // Attempt to further cause confusion by having this message define + // submessages with conflicting field types. + message Scope2 { + enum B { UNKNOWN_SCOPE2_ENUM_A = 0; } + } + } + } +} + +message Scope2 { + message B {} +} \ No newline at end of file diff --git a/test/run.sh b/test/run.sh index f23d446..3ec1b2a 100755 --- a/test/run.sh +++ b/test/run.sh @@ -49,6 +49,7 @@ _pbjs proto/trivial.proto & _pbjs proto/types.proto & _pbjs proto/nesting.proto & _pbjs proto/service.proto & +_pbjs proto/abs_reference.proto & OUT=proto/multifile/multifile.proto _pbjs proto/multi/*.proto & wait @@ -65,6 +66,7 @@ _protoc ./proto/trivial.proto _protoc ./proto/types.proto _protoc ./proto/service.proto _protoc ./proto/nesting.proto +_protoc ./proto/abs_reference.proto _protoc ./proto/multifile/a.proto ./proto/multifile/b.proto --protobufjs_opt=-out=proto/multifile/multifile.ts echo "Compiling encode.ts"