PROTOBUF_SYNC_PIPER
pull/8617/head
Deanna Garcia 4 years ago
parent 380e352b0b
commit 094d18944e
  1. 36
      java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt
  2. 36
      java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt
  3. 36
      java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt
  4. 2
      java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto
  5. 2
      java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto
  6. 34
      java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto
  7. 12
      src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
  8. 4
      src/google/protobuf/compiler/cpp/cpp_helpers.h

@ -47,11 +47,11 @@ import com.google.protobuf.UnittestLite.TestEmptyMessageWithExtensionsLite
import com.google.protobuf.copy
import com.google.protobuf.foreignMessageLite
import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.EvilNamesProto2
import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypes
import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypesProto2
import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.Interface
import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesKt
import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2Kt
import com.google.protobuf.kotlin.generator.evilNamesProto2
import com.google.protobuf.kotlin.generator.hardKeywordsAllTypes
import com.google.protobuf.kotlin.generator.hardKeywordsAllTypesProto2
import com.google.protobuf.kotlin.generator.interface_
import com.google.protobuf.optionalGroupExtensionLite
import com.google.protobuf.repeatedGroupExtensionLite
@ -948,18 +948,18 @@ class Proto2LiteTest {
@Test
fun testHardKeywordGettersAndSetters() {
hardKeywordsAllTypes {
hardKeywordsAllTypesProto2 {
as_ = 1
assertThat(as_).isEqualTo(1)
in_ = "foo"
assertThat(in_).isEqualTo("foo")
break_ = HardKeywordsAllTypes.NestedEnum.FOO
assertThat(break_).isEqualTo(HardKeywordsAllTypes.NestedEnum.FOO)
break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO
assertThat(break_).isEqualTo(HardKeywordsAllTypesProto2.NestedEnum.FOO)
do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
assertThat(do_).isEqualTo(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 })
do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
assertThat(do_).isEqualTo(HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 })
continue_[1] = 1
assertThat(continue_[1]).isEqualTo(1)
@ -970,34 +970,34 @@ class Proto2LiteTest {
for_ += "foo"
assertThat(for_).isEqualTo(listOf("foo"))
fun_ += HardKeywordsAllTypes.NestedEnum.FOO
assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypes.NestedEnum.FOO))
fun_ += HardKeywordsAllTypesProto2.NestedEnum.FOO
assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypesProto2.NestedEnum.FOO))
if_ += HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }))
if_ += HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }))
}
}
@Test
fun testHardKeywordHazzers() {
hardKeywordsAllTypes {
hardKeywordsAllTypesProto2 {
as_ = 1
assertThat(hasAs_()).isTrue()
in_ = "foo"
assertThat(hasIn_()).isTrue()
break_ = HardKeywordsAllTypes.NestedEnum.FOO
break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO
assertThat(hasBreak_()).isTrue()
do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
assertThat(hasDo_()).isTrue()
}
}
@Test
fun testHardKeywordClears() {
hardKeywordsAllTypes {
hardKeywordsAllTypesProto2 {
as_ = 1
clearAs_()
assertThat(hasAs_()).isFalse()
@ -1006,11 +1006,11 @@ class Proto2LiteTest {
clearIn_()
assertThat(hasIn_()).isFalse()
break_ = HardKeywordsAllTypes.NestedEnum.FOO
break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO
clearBreak_()
assertThat(hasBreak_()).isFalse()
do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
clearDo_()
assertThat(hasDo_()).isFalse()
}

@ -34,11 +34,11 @@ import com.google.common.truth.Truth.assertThat
import com.google.protobuf.TestUtil
import com.google.protobuf.TestUtil.toBytes
import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.EvilNamesProto2
import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypes
import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypesProto2
import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.Interface
import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesKt
import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2Kt
import com.google.protobuf.kotlin.generator.evilNamesProto2
import com.google.protobuf.kotlin.generator.hardKeywordsAllTypes
import com.google.protobuf.kotlin.generator.hardKeywordsAllTypesProto2
import com.google.protobuf.kotlin.generator.interface_
import com.google.protobuf.test.UnittestImport.ImportEnum
import com.google.protobuf.test.UnittestImport.ImportMessage
@ -940,18 +940,18 @@ class Proto2Test {
@Test
fun testHardKeywordGettersAndSetters() {
hardKeywordsAllTypes {
hardKeywordsAllTypesProto2 {
as_ = 1
assertThat(as_).isEqualTo(1)
in_ = "foo"
assertThat(in_).isEqualTo("foo")
break_ = HardKeywordsAllTypes.NestedEnum.FOO
assertThat(break_).isEqualTo(HardKeywordsAllTypes.NestedEnum.FOO)
break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO
assertThat(break_).isEqualTo(HardKeywordsAllTypesProto2.NestedEnum.FOO)
do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
assertThat(do_).isEqualTo(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 })
do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
assertThat(do_).isEqualTo(HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 })
continue_[1] = 1
assertThat(continue_[1]).isEqualTo(1)
@ -962,34 +962,34 @@ class Proto2Test {
for_ += "foo"
assertThat(for_).isEqualTo(listOf("foo"))
fun_ += HardKeywordsAllTypes.NestedEnum.FOO
assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypes.NestedEnum.FOO))
fun_ += HardKeywordsAllTypesProto2.NestedEnum.FOO
assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypesProto2.NestedEnum.FOO))
if_ += HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }))
if_ += HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }))
}
}
@Test
fun testHardKeywordHazzers() {
hardKeywordsAllTypes {
hardKeywordsAllTypesProto2 {
as_ = 1
assertThat(hasAs_()).isTrue()
in_ = "foo"
assertThat(hasIn_()).isTrue()
break_ = HardKeywordsAllTypes.NestedEnum.FOO
break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO
assertThat(hasBreak_()).isTrue()
do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
assertThat(hasDo_()).isTrue()
}
}
@Test
fun testHardKeywordClears() {
hardKeywordsAllTypes {
hardKeywordsAllTypesProto2 {
as_ = 1
clearAs_()
assertThat(hasAs_()).isFalse()
@ -998,11 +998,11 @@ class Proto2Test {
clearIn_()
assertThat(hasIn_()).isFalse()
break_ = HardKeywordsAllTypes.NestedEnum.FOO
break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO
clearBreak_()
assertThat(hasBreak_()).isFalse()
do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
clearDo_()
assertThat(hasDo_()).isFalse()
}

@ -33,11 +33,11 @@ package com.google.protobuf.kotlin
import com.google.common.truth.Truth.assertThat
import com.google.protobuf.kotlin.generator.EvilNamesProto3OuterClass.Class
import com.google.protobuf.kotlin.generator.EvilNamesProto3OuterClass.EvilNamesProto3
import com.google.protobuf.kotlin.generator.EvilNamesProto3OuterClass.HardKeywordsAllTypes
import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesKt
import com.google.protobuf.kotlin.generator.EvilNamesProto3OuterClass.HardKeywordsAllTypesProto3
import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto3Kt
import com.google.protobuf.kotlin.generator.class_
import com.google.protobuf.kotlin.generator.evilNamesProto3
import com.google.protobuf.kotlin.generator.hardKeywordsAllTypes
import com.google.protobuf.kotlin.generator.hardKeywordsAllTypesProto3
import proto3_unittest.TestAllTypesKt
import proto3_unittest.TestAllTypesKt.nestedMessage
import proto3_unittest.UnittestProto3.TestAllTypes
@ -280,18 +280,18 @@ class Proto3Test {
@Test
fun testHardKeywordGettersAndSetters() {
hardKeywordsAllTypes {
hardKeywordsAllTypesProto3 {
as_ = 1
assertThat(as_).isEqualTo(1)
in_ = "foo"
assertThat(in_).isEqualTo("foo")
break_ = HardKeywordsAllTypes.NestedEnum.FOO
assertThat(break_).isEqualTo(HardKeywordsAllTypes.NestedEnum.FOO)
break_ = HardKeywordsAllTypesProto3.NestedEnum.FOO
assertThat(break_).isEqualTo(HardKeywordsAllTypesProto3.NestedEnum.FOO)
do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
assertThat(do_).isEqualTo(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 })
do_ = HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 }
assertThat(do_).isEqualTo(HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 })
continue_[1] = 1
assertThat(continue_[1]).isEqualTo(1)
@ -302,34 +302,34 @@ class Proto3Test {
for_ += "foo"
assertThat(for_).isEqualTo(listOf("foo"))
fun_ += HardKeywordsAllTypes.NestedEnum.FOO
assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypes.NestedEnum.FOO))
fun_ += HardKeywordsAllTypesProto3.NestedEnum.FOO
assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypesProto3.NestedEnum.FOO))
if_ += HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }))
if_ += HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 }
assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 }))
}
}
@Test
fun testHardKeywordHazzers() {
hardKeywordsAllTypes {
hardKeywordsAllTypesProto3 {
as_ = 1
assertThat(hasAs_()).isTrue()
in_ = "foo"
assertThat(hasIn_()).isTrue()
break_ = HardKeywordsAllTypes.NestedEnum.FOO
break_ = HardKeywordsAllTypesProto3.NestedEnum.FOO
assertThat(hasBreak_()).isTrue()
do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
do_ = HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 }
assertThat(hasDo_()).isTrue()
}
}
@Test
fun testHardKeywordClears() {
hardKeywordsAllTypes {
hardKeywordsAllTypesProto3 {
as_ = 1
clearAs_()
assertThat(hasAs_()).isFalse()
@ -338,11 +338,11 @@ class Proto3Test {
clearIn_()
assertThat(hasIn_()).isFalse()
break_ = HardKeywordsAllTypes.NestedEnum.FOO
break_ = HardKeywordsAllTypesProto3.NestedEnum.FOO
clearBreak_()
assertThat(hasBreak_()).isFalse()
do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
do_ = HardKeywordsAllTypesProto3Kt.nestedMessage { while_ = 1 }
clearDo_()
assertThat(hasDo_()).isFalse()
}

@ -68,7 +68,7 @@ message EvilNamesProto2 {
optional string by = 25;
}
message HardKeywordsAllTypes {
message HardKeywordsAllTypesProto2 {
message NestedMessage {
optional int32 while = 1;
}

@ -81,7 +81,7 @@ message EvilNamesProto3 {
}
}
message HardKeywordsAllTypes {
message HardKeywordsAllTypesProto3 {
message NestedMessage {
optional int32 while = 1;
}

@ -1,8 +1,38 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto2";
package example_extensible_message;
package protobuf.kotlin.test;
option java_package = "example_extensible_message";
option java_package = "com.google.protobuf.kotlin.test";
option java_multiple_files = true;
message ExampleExtensibleMessage {

@ -137,14 +137,10 @@ TEST(BootstrapTest, GeneratedFilesMatch) {
// of the data to compare to.
std::map<std::string, std::string> vpath_map;
std::map<std::string, std::string> rpath_map;
rpath_map
["third_party/protobuf_legacy_opensource/src/google/protobuf/"
"test_messages_proto2"] =
"net/proto2/z_generated_example/test_messages_proto2";
rpath_map
["third_party/protobuf_legacy_opensource/src/google/protobuf/"
"test_messages_proto3"] =
"net/proto2/z_generated_example/test_messages_proto3";
rpath_map["third_party/protobuf/src/google/protobuf/test_messages_proto2"] =
"net/proto2/z_generated_example/test_messages_proto2";
rpath_map["third_party/protobuf/src/google/protobuf/test_messages_proto3"] =
"net/proto2/z_generated_example/test_messages_proto3";
rpath_map["net/proto2/internal/proto2_weak"] =
"net/proto2/z_generated_example/proto2_weak";

@ -866,9 +866,7 @@ inline OneOfRangeImpl OneOfRange(const Descriptor* desc) { return {desc}; }
PROTOC_EXPORT std::string StripProto(const std::string& filename);
inline bool EnableMessageOwnedArena(const Descriptor* desc) {
return false;
}
inline bool EnableMessageOwnedArena(const Descriptor* desc) { return false; }
} // namespace cpp
} // namespace compiler

Loading…
Cancel
Save