-
-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addresses #8.
- Loading branch information
Showing
4 changed files
with
43 additions
and
0 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,23 @@ | ||
package com.trueaccord.proto.e2e; | ||
|
||
import "scalapb.proto"; | ||
|
||
import "one_of.proto"; // testing an import of non-flat proto | ||
|
||
option (scalapb.options) = { | ||
package_name: "com.trueaccord.pb.flat" | ||
flat_package: true | ||
}; | ||
|
||
enum Priority { | ||
LOW = 1; | ||
MEDIUM = 2; | ||
HIGH = 3; | ||
} | ||
|
||
message FlatTest { | ||
optional int32 b = 1; | ||
optional Priority priority = 2; | ||
optional OneofTest one_of_msg = 3; | ||
} | ||
|
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,13 @@ | ||
import com.trueaccord.proto.e2e.one_of._ | ||
import com.trueaccord.pb.flat.Priority | ||
import com.trueaccord.pb.flat.FlatTest | ||
import org.scalatest._ | ||
|
||
class FlatPackageSpec extends FlatSpec with MustMatchers { | ||
|
||
"FlatTest" should "serialize and parse" in { | ||
val ft = FlatTest(b=Some(4), priority=Some(Priority.MEDIUM), | ||
oneOfMsg=Some(OneofTest(a=Some(4)))) | ||
FlatTest.parseFrom(ft.toByteArray) must be(ft) | ||
} | ||
} |