blob: 4c9d748548e876b6219544533bcbb9a103ab7ddc [file] [log] [blame]
Marcel Hlopkoa1ba8d22023-04-14 02:21:11 -07001// Protocol Buffers - Google's data interchange format
Hong Shin4f20efb2023-07-10 07:35:36 -07002// Copyright 2023 Google LLC. All rights reserved.
Marcel Hlopkoa1ba8d22023-04-14 02:21:11 -07003//
Joshua Haberman67ee3b92023-09-08 17:13:25 -07004// 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 Hlopkoa1ba8d22023-04-14 02:21:11 -07007
Alyssa Haroldsen1eab5a02024-01-08 18:50:28 -08008//! Tests covering proto packages.
Marcel Hlopkoa1ba8d22023-04-14 02:21:11 -07009
10#[test]
Alyssa Haroldsen1eab5a02024-01-08 18:50:28 -080011fn test_message_packages() {
Marcel Hlopko3ced8182023-07-20 00:30:29 -070012 // empty package, message declared in the first .proto source
Alyssa Haroldsen1eab5a02024-01-08 18:50:28 -080013 let _: no_package_proto::MsgWithoutPackage;
Marcel Hlopko3ced8182023-07-20 00:30:29 -070014 // empty package, message declared in other .proto source
Alyssa Haroldsen1eab5a02024-01-08 18:50:28 -080015 let _: no_package_proto::OtherMsgWithoutPackage;
Marcel Hlopko3ced8182023-07-20 00:30:29 -070016 // empty package, import public of a message
Alyssa Haroldsen1eab5a02024-01-08 18:50:28 -080017 let _: no_package_proto::ImportedMsgWithoutPackage;
Marcel Hlopkoa1ba8d22023-04-14 02:21:11 -070018
Marcel Hlopko3ced8182023-07-20 00:30:29 -070019 // package, message declared in the first .proto source
Marcel Hlopkoc1d174f2024-01-19 09:30:32 -080020 let _: package_proto::MsgWithPackage;
Marcel Hlopko3ced8182023-07-20 00:30:29 -070021 // package, message declared in the other .proto source with the same package
Marcel Hlopkoc1d174f2024-01-19 09:30:32 -080022 let _: package_proto::OtherMsgWithPackage;
Marcel Hlopko3ced8182023-07-20 00:30:29 -070023 // package, message declared in the other .proto source with a different package
Marcel Hlopkoc1d174f2024-01-19 09:30:32 -080024 let _: package_proto::OtherMsgInDifferentPackage;
Marcel Hlopko3ced8182023-07-20 00:30:29 -070025 // package, import public of a message
Marcel Hlopkoc1d174f2024-01-19 09:30:32 -080026 let _: package_proto::ImportedMsgWithPackage;
Alyssa Haroldsen1eab5a02024-01-08 18:50:28 -080027}
28
29#[test]
30fn 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 Hlopkoc1d174f2024-01-19 09:30:32 -080039 let _: package_proto::EnumWithPackage;
Alyssa Haroldsen1eab5a02024-01-08 18:50:28 -080040 // package, enum declared in the other .proto source with the same package
Marcel Hlopkoc1d174f2024-01-19 09:30:32 -080041 let _: package_proto::OtherEnumWithPackage;
Alyssa Haroldsen1eab5a02024-01-08 18:50:28 -080042 // package, enum declared in the other .proto source with a different package
Marcel Hlopkoc1d174f2024-01-19 09:30:32 -080043 let _: package_proto::OtherEnumInDifferentPackage;
Alyssa Haroldsen1eab5a02024-01-08 18:50:28 -080044 // package, import public of a enum
Marcel Hlopkoc1d174f2024-01-19 09:30:32 -080045 let _: package_proto::ImportedEnumWithPackage;
Marcel Hlopkoa1ba8d22023-04-14 02:21:11 -070046}