Marcel Hlopko | a1ba8d2 | 2023-04-14 02:21:11 -0700 | [diff] [blame] | 1 | // Protocol Buffers - Google's data interchange format |
Hong Shin | 4f20efb | 2023-07-10 07:35:36 -0700 | [diff] [blame] | 2 | // Copyright 2023 Google LLC. All rights reserved. |
Marcel Hlopko | a1ba8d2 | 2023-04-14 02:21:11 -0700 | [diff] [blame] | 3 | // |
Joshua Haberman | 67ee3b9 | 2023-09-08 17:13:25 -0700 | [diff] [blame] | 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file or at |
| 6 | // https://developers.google.com/open-source/licenses/bsd |
Marcel Hlopko | a1ba8d2 | 2023-04-14 02:21:11 -0700 | [diff] [blame] | 7 | |
Alyssa Haroldsen | 1eab5a0 | 2024-01-08 18:50:28 -0800 | [diff] [blame] | 8 | //! Tests covering proto packages. |
Marcel Hlopko | a1ba8d2 | 2023-04-14 02:21:11 -0700 | [diff] [blame] | 9 | |
| 10 | #[test] |
Alyssa Haroldsen | 1eab5a0 | 2024-01-08 18:50:28 -0800 | [diff] [blame] | 11 | fn test_message_packages() { |
Marcel Hlopko | 3ced818 | 2023-07-20 00:30:29 -0700 | [diff] [blame] | 12 | // empty package, message declared in the first .proto source |
Alyssa Haroldsen | 1eab5a0 | 2024-01-08 18:50:28 -0800 | [diff] [blame] | 13 | let _: no_package_proto::MsgWithoutPackage; |
Marcel Hlopko | 3ced818 | 2023-07-20 00:30:29 -0700 | [diff] [blame] | 14 | // empty package, message declared in other .proto source |
Alyssa Haroldsen | 1eab5a0 | 2024-01-08 18:50:28 -0800 | [diff] [blame] | 15 | let _: no_package_proto::OtherMsgWithoutPackage; |
Marcel Hlopko | 3ced818 | 2023-07-20 00:30:29 -0700 | [diff] [blame] | 16 | // empty package, import public of a message |
Alyssa Haroldsen | 1eab5a0 | 2024-01-08 18:50:28 -0800 | [diff] [blame] | 17 | let _: no_package_proto::ImportedMsgWithoutPackage; |
Marcel Hlopko | a1ba8d2 | 2023-04-14 02:21:11 -0700 | [diff] [blame] | 18 | |
Marcel Hlopko | 3ced818 | 2023-07-20 00:30:29 -0700 | [diff] [blame] | 19 | // package, message declared in the first .proto source |
Marcel Hlopko | c1d174f | 2024-01-19 09:30:32 -0800 | [diff] [blame] | 20 | let _: package_proto::MsgWithPackage; |
Marcel Hlopko | 3ced818 | 2023-07-20 00:30:29 -0700 | [diff] [blame] | 21 | // package, message declared in the other .proto source with the same package |
Marcel Hlopko | c1d174f | 2024-01-19 09:30:32 -0800 | [diff] [blame] | 22 | let _: package_proto::OtherMsgWithPackage; |
Marcel Hlopko | 3ced818 | 2023-07-20 00:30:29 -0700 | [diff] [blame] | 23 | // package, message declared in the other .proto source with a different package |
Marcel Hlopko | c1d174f | 2024-01-19 09:30:32 -0800 | [diff] [blame] | 24 | let _: package_proto::OtherMsgInDifferentPackage; |
Marcel Hlopko | 3ced818 | 2023-07-20 00:30:29 -0700 | [diff] [blame] | 25 | // package, import public of a message |
Marcel Hlopko | c1d174f | 2024-01-19 09:30:32 -0800 | [diff] [blame] | 26 | let _: package_proto::ImportedMsgWithPackage; |
Alyssa Haroldsen | 1eab5a0 | 2024-01-08 18:50:28 -0800 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | #[test] |
| 30 | fn test_enum_packages() { |
| 31 | // empty package, enum declared in the first .proto source |
| 32 | let _: no_package_proto::EnumWithoutPackage; |
| 33 | // empty package, enum declared in other .proto source |
| 34 | let _: no_package_proto::OtherEnumWithoutPackage; |
| 35 | // empty package, import public of a enum |
| 36 | let _: no_package_proto::ImportedEnumWithoutPackage; |
| 37 | |
| 38 | // package, enum declared in the first .proto source |
Marcel Hlopko | c1d174f | 2024-01-19 09:30:32 -0800 | [diff] [blame] | 39 | let _: package_proto::EnumWithPackage; |
Alyssa Haroldsen | 1eab5a0 | 2024-01-08 18:50:28 -0800 | [diff] [blame] | 40 | // package, enum declared in the other .proto source with the same package |
Marcel Hlopko | c1d174f | 2024-01-19 09:30:32 -0800 | [diff] [blame] | 41 | let _: package_proto::OtherEnumWithPackage; |
Alyssa Haroldsen | 1eab5a0 | 2024-01-08 18:50:28 -0800 | [diff] [blame] | 42 | // package, enum declared in the other .proto source with a different package |
Marcel Hlopko | c1d174f | 2024-01-19 09:30:32 -0800 | [diff] [blame] | 43 | let _: package_proto::OtherEnumInDifferentPackage; |
Alyssa Haroldsen | 1eab5a0 | 2024-01-08 18:50:28 -0800 | [diff] [blame] | 44 | // package, import public of a enum |
Marcel Hlopko | c1d174f | 2024-01-19 09:30:32 -0800 | [diff] [blame] | 45 | let _: package_proto::ImportedEnumWithPackage; |
Marcel Hlopko | a1ba8d2 | 2023-04-14 02:21:11 -0700 | [diff] [blame] | 46 | } |