-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more follow-up for editions in protoprint: expand test, fix issue unc…
…overed w/ custom sort order (#602)
- Loading branch information
Showing
11 changed files
with
338 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
desc/protoprint/testfiles/desc_test_editions-compact.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
edition = "2023"; | ||
package testprotos; | ||
option features = { enum_type: CLOSED }; | ||
option go_package = "github.com/jhump/protoreflect/internal/testprotos"; | ||
message Foo { | ||
reserved reserved_field; | ||
int32 a = 1; | ||
int32 required_field = 2 [features = { field_presence: LEGACY_REQUIRED }]; | ||
int32 default_field = 3 [default = 99]; | ||
DelimitedField delimitedfield = 4 [features = { message_encoding: DELIMITED }]; | ||
message DelimitedField { | ||
int32 b = 1; | ||
} | ||
} | ||
enum Closed { | ||
CLOSED_C = 1; | ||
CLOSED_A = 2; | ||
reserved CLOSED_E, CLOSED_F; | ||
} | ||
enum Open { | ||
option features = { enum_type: OPEN }; | ||
OPEN_B = 0; | ||
OPEN_C = -1; | ||
OPEN_A = 2; | ||
} |
41 changes: 41 additions & 0 deletions
41
desc/protoprint/testfiles/desc_test_editions-custom-sort.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
edition = "2023"; | ||
|
||
enum Open { | ||
OPEN_B = 0; | ||
|
||
OPEN_C = -1; | ||
|
||
OPEN_A = 2; | ||
|
||
option features = { enum_type: OPEN }; | ||
} | ||
|
||
enum Closed { | ||
CLOSED_C = 1; | ||
|
||
CLOSED_A = 2; | ||
|
||
reserved CLOSED_F, CLOSED_E; | ||
} | ||
|
||
message Foo { | ||
reserved reserved_field; | ||
|
||
message DelimitedField { | ||
int32 b = 1; | ||
} | ||
|
||
int32 required_field = 2 [features = { field_presence: LEGACY_REQUIRED }]; | ||
|
||
DelimitedField delimitedfield = 4 [features = { message_encoding: DELIMITED }]; | ||
|
||
int32 default_field = 3 [default = 99]; | ||
|
||
int32 a = 1; | ||
} | ||
|
||
option go_package = "github.com/jhump/protoreflect/internal/testprotos"; | ||
|
||
option features = { enum_type: CLOSED }; | ||
|
||
package testprotos; |
41 changes: 41 additions & 0 deletions
41
desc/protoprint/testfiles/desc_test_editions-multiline-style-comments.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
edition = "2023"; | ||
|
||
package testprotos; | ||
|
||
option features = { enum_type: CLOSED }; | ||
|
||
option go_package = "github.com/jhump/protoreflect/internal/testprotos"; | ||
|
||
message Foo { | ||
reserved reserved_field; | ||
|
||
int32 a = 1; | ||
|
||
int32 required_field = 2 [features = { field_presence: LEGACY_REQUIRED }]; | ||
|
||
int32 default_field = 3 [default = 99]; | ||
|
||
DelimitedField delimitedfield = 4 [features = { message_encoding: DELIMITED }]; | ||
|
||
message DelimitedField { | ||
int32 b = 1; | ||
} | ||
} | ||
|
||
enum Closed { | ||
CLOSED_C = 1; | ||
|
||
CLOSED_A = 2; | ||
|
||
reserved CLOSED_E, CLOSED_F; | ||
} | ||
|
||
enum Open { | ||
option features = { enum_type: OPEN }; | ||
|
||
OPEN_B = 0; | ||
|
||
OPEN_C = -1; | ||
|
||
OPEN_A = 2; | ||
} |
41 changes: 41 additions & 0 deletions
41
desc/protoprint/testfiles/desc_test_editions-no-trailing-comments.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
edition = "2023"; | ||
|
||
package testprotos; | ||
|
||
option features = { enum_type: CLOSED }; | ||
|
||
option go_package = "github.com/jhump/protoreflect/internal/testprotos"; | ||
|
||
message Foo { | ||
reserved reserved_field; | ||
|
||
int32 a = 1; | ||
|
||
int32 required_field = 2 [features = { field_presence: LEGACY_REQUIRED }]; | ||
|
||
int32 default_field = 3 [default = 99]; | ||
|
||
DelimitedField delimitedfield = 4 [features = { message_encoding: DELIMITED }]; | ||
|
||
message DelimitedField { | ||
int32 b = 1; | ||
} | ||
} | ||
|
||
enum Closed { | ||
CLOSED_C = 1; | ||
|
||
CLOSED_A = 2; | ||
|
||
reserved CLOSED_E, CLOSED_F; | ||
} | ||
|
||
enum Open { | ||
option features = { enum_type: OPEN }; | ||
|
||
OPEN_B = 0; | ||
|
||
OPEN_C = -1; | ||
|
||
OPEN_A = 2; | ||
} |
41 changes: 41 additions & 0 deletions
41
desc/protoprint/testfiles/desc_test_editions-only-doc-comments.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
edition = "2023"; | ||
|
||
package testprotos; | ||
|
||
option features = { enum_type: CLOSED }; | ||
|
||
option go_package = "github.com/jhump/protoreflect/internal/testprotos"; | ||
|
||
message Foo { | ||
reserved reserved_field; | ||
|
||
int32 a = 1; | ||
|
||
int32 required_field = 2 [features = { field_presence: LEGACY_REQUIRED }]; | ||
|
||
int32 default_field = 3 [default = 99]; | ||
|
||
DelimitedField delimitedfield = 4 [features = { message_encoding: DELIMITED }]; | ||
|
||
message DelimitedField { | ||
int32 b = 1; | ||
} | ||
} | ||
|
||
enum Closed { | ||
CLOSED_C = 1; | ||
|
||
CLOSED_A = 2; | ||
|
||
reserved CLOSED_E, CLOSED_F; | ||
} | ||
|
||
enum Open { | ||
option features = { enum_type: OPEN }; | ||
|
||
OPEN_B = 0; | ||
|
||
OPEN_C = -1; | ||
|
||
OPEN_A = 2; | ||
} |
41 changes: 41 additions & 0 deletions
41
desc/protoprint/testfiles/desc_test_editions-sorted-AND-multiline-style-comments.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
edition = "2023"; | ||
|
||
package testprotos; | ||
|
||
option features = { enum_type: CLOSED }; | ||
|
||
option go_package = "github.com/jhump/protoreflect/internal/testprotos"; | ||
|
||
message Foo { | ||
int32 a = 1; | ||
|
||
int32 required_field = 2 [features = { field_presence: LEGACY_REQUIRED }]; | ||
|
||
int32 default_field = 3 [default = 99]; | ||
|
||
DelimitedField delimitedfield = 4 [features = { message_encoding: DELIMITED }]; | ||
|
||
message DelimitedField { | ||
int32 b = 1; | ||
} | ||
|
||
reserved reserved_field; | ||
} | ||
|
||
enum Closed { | ||
CLOSED_C = 1; | ||
|
||
CLOSED_A = 2; | ||
|
||
reserved CLOSED_E, CLOSED_F; | ||
} | ||
|
||
enum Open { | ||
option features = { enum_type: OPEN }; | ||
|
||
OPEN_B = 0; | ||
|
||
OPEN_C = -1; | ||
|
||
OPEN_A = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
edition = "2023"; | ||
|
||
package testprotos; | ||
|
||
option features = { enum_type: CLOSED }; | ||
|
||
option go_package = "github.com/jhump/protoreflect/internal/testprotos"; | ||
|
||
message Foo { | ||
int32 a = 1; | ||
|
||
int32 required_field = 2 [features = { field_presence: LEGACY_REQUIRED }]; | ||
|
||
int32 default_field = 3 [default = 99]; | ||
|
||
DelimitedField delimitedfield = 4 [features = { message_encoding: DELIMITED }]; | ||
|
||
message DelimitedField { | ||
int32 b = 1; | ||
} | ||
|
||
reserved reserved_field; | ||
} | ||
|
||
enum Closed { | ||
CLOSED_C = 1; | ||
|
||
CLOSED_A = 2; | ||
|
||
reserved CLOSED_E, CLOSED_F; | ||
} | ||
|
||
enum Open { | ||
option features = { enum_type: OPEN }; | ||
|
||
OPEN_B = 0; | ||
|
||
OPEN_C = -1; | ||
|
||
OPEN_A = 2; | ||
} |
41 changes: 41 additions & 0 deletions
41
desc/protoprint/testfiles/desc_test_editions-trailing-on-next-line.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
edition = "2023"; | ||
|
||
package testprotos; | ||
|
||
option features = { enum_type: CLOSED }; | ||
|
||
option go_package = "github.com/jhump/protoreflect/internal/testprotos"; | ||
|
||
message Foo { | ||
reserved reserved_field; | ||
|
||
int32 a = 1; | ||
|
||
int32 required_field = 2 [features = { field_presence: LEGACY_REQUIRED }]; | ||
|
||
int32 default_field = 3 [default = 99]; | ||
|
||
DelimitedField delimitedfield = 4 [features = { message_encoding: DELIMITED }]; | ||
|
||
message DelimitedField { | ||
int32 b = 1; | ||
} | ||
} | ||
|
||
enum Closed { | ||
CLOSED_C = 1; | ||
|
||
CLOSED_A = 2; | ||
|
||
reserved CLOSED_E, CLOSED_F; | ||
} | ||
|
||
enum Open { | ||
option features = { enum_type: OPEN }; | ||
|
||
OPEN_B = 0; | ||
|
||
OPEN_C = -1; | ||
|
||
OPEN_A = 2; | ||
} |