Herbie Ong | cddf819 | 2018-11-28 18:25:20 -0800 | [diff] [blame^] | 1 | // Copyright 2018 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // Test Protobuf definitions with proto3 syntax. |
| 6 | syntax = "proto3"; |
| 7 | |
| 8 | package pb3; |
| 9 | option go_package = "github.com/golang/protobuf/v2/encoding/textpb/testprotos/pb3"; |
| 10 | |
| 11 | // Scalars contains scalar field types. |
| 12 | message Scalars { |
| 13 | bool s_bool = 1; |
| 14 | |
| 15 | int32 s_int32 = 2; |
| 16 | int64 s_int64 = 3; |
| 17 | uint32 s_uint32 = 4; |
| 18 | uint64 s_uint64 = 5; |
| 19 | sint32 s_sint32 = 6; |
| 20 | sint64 s_sint64 = 7; |
| 21 | fixed32 s_fixed32 = 8; |
| 22 | fixed64 s_fixed64 = 9; |
| 23 | sfixed32 s_sfixed32 = 10; |
| 24 | sfixed64 s_sfixed64 = 11; |
| 25 | |
| 26 | float s_float = 20; |
| 27 | double s_double = 21; |
| 28 | |
| 29 | bytes s_bytes = 14; |
| 30 | string s_string = 13; |
| 31 | } |
| 32 | |
| 33 | enum Enum { |
| 34 | ZERO = 0; |
| 35 | ONE = 1; |
| 36 | TWO = 2; |
| 37 | TEN = 10; |
| 38 | } |
| 39 | |
| 40 | // Message contains enum fields. |
| 41 | message Enums { |
| 42 | Enum s_enum = 1; |
| 43 | repeated Enum rpt_enum = 2; |
| 44 | |
| 45 | enum NestedEnum { |
| 46 | CERO = 0; |
| 47 | UNO = 1; |
| 48 | DOS = 2; |
| 49 | DIEZ = 10; |
| 50 | } |
| 51 | NestedEnum s_nested_enum = 3; |
| 52 | repeated NestedEnum rpt_nested_enum = 4; |
| 53 | } |
| 54 | |
| 55 | // Message contains message and group fields. |
| 56 | message Nests { |
| 57 | Nested s_nested = 1; |
| 58 | repeated Nested rpt_nested = 2; |
| 59 | } |
| 60 | |
| 61 | // Message type used as submessage. |
| 62 | message Nested { |
| 63 | string s_string = 1; |
| 64 | Nested s_nested = 2; |
| 65 | } |