aboutsummaryrefslogtreecommitdiff
path: root/tests/options/options.proto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/options/options.proto')
-rw-r--r--tests/options/options.proto31
1 files changed, 28 insertions, 3 deletions
diff --git a/tests/options/options.proto b/tests/options/options.proto
index b5badcf..c6ca5e2 100644
--- a/tests/options/options.proto
+++ b/tests/options/options.proto
@@ -2,6 +2,8 @@
* options.expected lists the patterns that are searched for in the output.
*/
+syntax = "proto2";
+
import "nanopb.proto";
// File level options
@@ -22,12 +24,15 @@ message Message2
// Field level options
message Message3
{
+ option (nanopb_msgopt).msgid = 103;
required string fieldsize = 1 [(nanopb).max_size = 40];
+ required string fieldlen = 2 [(nanopb).max_length = 40];
}
// Forced callback field
message Message4
{
+ option (nanopb_msgopt).msgid = 104;
required int32 int32_callback = 1 [(nanopb).type = FT_CALLBACK];
}
@@ -47,6 +52,7 @@ message EnumTest
// Short enum names inside message
message Message5
{
+ option (nanopb_msgopt).msgid = 105;
enum Enum2
{
option (nanopb_enumopt).long_names = false;
@@ -63,11 +69,30 @@ message my_packed_struct
}
// Message with ignored field
-// Note: doesn't really test if the field is missing in the output,
-// but atleast tests that the output compiles.
message Message6
{
required int32 field1 = 1;
- optional int32 field2 = 2 [(nanopb).type = FT_IGNORE];
+ optional int32 skipped_field = 2 [(nanopb).type = FT_IGNORE];
+}
+
+// Message that is skipped
+message SkippedMessage
+{
+ option (nanopb_msgopt).skip_message = true;
+ required int32 foo = 1;
+}
+
+// Message with oneof field
+message OneofMessage
+{
+ oneof foo {
+ int32 bar = 1;
+ }
+}
+
+// Proto3-style optional field in proto2 file
+message Proto3Field
+{
+ optional int32 proto3field = 1 [(nanopb).proto3 = true];
}