-
-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process aux field options in order, and let local setting takes over
- Loading branch information
Showing
5 changed files
with
77 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
syntax = "proto3"; | ||
|
||
package scalapb.e2e.scoped; | ||
|
||
import "scalapb/scalapb.proto"; | ||
|
||
message OrderTest { | ||
int32 x1 = 11; // renamed at package level and also locally here. | ||
// File should take over. | ||
int32 x2 = 12; // renamed in file twice. Second override should take over. | ||
int32 x3 = 13 [ | ||
(scalapb.field).scala_name = "local_x3" | ||
]; // renamed in file, and also locally. Local should override. | ||
} | ||
|
||
option (scalapb.options) = { | ||
scope : FILE | ||
// For x1 | ||
aux_field_options : [ | ||
{ | ||
target : "scalapb.e2e.scoped.OrderTest.x1" | ||
options : {scala_name : "file_x1"} | ||
}, | ||
|
||
// For x2 | ||
{ | ||
target : "scalapb.e2e.scoped.OrderTest.x2" | ||
options : {scala_name : "file_x2_take1"} | ||
}, | ||
{ | ||
target : "scalapb.e2e.scoped.OrderTest.x2" | ||
options : {scala_name : "file_x2_take2"} | ||
}, | ||
|
||
// For x3 | ||
{ | ||
target : "scalapb.e2e.scoped.OrderTest.x3" | ||
options : {scala_name : "file_x3"} | ||
} | ||
] | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package scalapb.e2e.scoped | ||
|
||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.must.Matchers | ||
|
||
import scalapb.changed.scoped.OrderTest | ||
|
||
class OrderSpec extends AnyFlatSpec with Matchers { | ||
// The goal of this test is to validate the order aux_field_options are applied. | ||
// Having the code compile with the expected field name verifies that the expected | ||
// transformation occurred. | ||
val M = OrderTest( | ||
file_x1 = 1, | ||
file_x2_take2 = 2, | ||
local_x3 = 3 | ||
) | ||
} |