diff options
author | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2008-12-02 20:08:45 +0000 |
---|---|---|
committer | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2008-12-02 20:08:45 +0000 |
commit | 1ea526879c523a7d5a50478734adbab93b018e0d (patch) | |
tree | edc36a78398aa1a36970796cbc4f97191b39ba80 | |
parent | 2f669cbe75c054851234b7789342a5650ef951a5 (diff) | |
download | protobuf-1ea526879c523a7d5a50478734adbab93b018e0d.tar.gz protobuf-1ea526879c523a7d5a50478734adbab93b018e0d.tar.bz2 protobuf-1ea526879c523a7d5a50478734adbab93b018e0d.zip |
Add full-system test for custom enum value options. (Previously, only a
parsing test in parser_unittest.cc existed.)
-rw-r--r-- | src/google/protobuf/descriptor_unittest.cc | 3 | ||||
-rw-r--r-- | src/google/protobuf/unittest_custom_options.proto | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index 3a2b52bd..f4e60b3a 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -1554,6 +1554,9 @@ TEST(CustomOptions, OptionLocations) { field->options().GetExtension(protobuf_unittest::field_opt2)); EXPECT_EQ(-789, enm->options().GetExtension(protobuf_unittest::enum_opt1)); + EXPECT_EQ(123, + enm->value(1)->options().GetExtension( + protobuf_unittest::enum_value_opt1)); EXPECT_EQ(GOOGLE_LONGLONG(-9876543210), service->options().GetExtension(protobuf_unittest::service_opt1)); EXPECT_EQ(protobuf_unittest::METHODOPT1_VAL2, diff --git a/src/google/protobuf/unittest_custom_options.proto b/src/google/protobuf/unittest_custom_options.proto index 157b10a0..88f6f1f7 100644 --- a/src/google/protobuf/unittest_custom_options.proto +++ b/src/google/protobuf/unittest_custom_options.proto @@ -66,7 +66,9 @@ extend google.protobuf.EnumOptions { optional sfixed32 enum_opt1 = 7753576; } -// TODO(benjy): Test options on enum values when the parser supports them. +extend google.protobuf.EnumValueOptions { + optional int32 enum_value_opt1 = 1560678; +} extend google.protobuf.ServiceOptions { optional sint64 service_opt1 = 7887650; @@ -95,7 +97,7 @@ message TestMessageWithCustomOptions { option (enum_opt1) = -789; ANENUM_VAL1 = 1; - ANENUM_VAL2 = 2; + ANENUM_VAL2 = 2 [(enum_value_opt1) = 123]; } } |