Commit dda7ab03 authored by toc007's avatar toc007 Committed by Paul Yang

Ruby nested msg caps (#5564)

* Ruby nested msg caps

* nested types tests added

* test cases added for RubifyConstant

* extracted NestedMessage to TestNestedMessage

* removed nested tests with leading underscore

* extracted testLowercase to toplevel testLowercaseNested
parent 0c957915
...@@ -69,6 +69,11 @@ enum TestEnum { ...@@ -69,6 +69,11 @@ enum TestEnum {
C = 3; C = 3;
} }
message testLowercaseNested {
message lowercase{}
}
message TestUnknown { message TestUnknown {
TestUnknown optional_unknown = 11; TestUnknown optional_unknown = 11;
repeated TestUnknown repeated_unknown = 31; repeated TestUnknown repeated_unknown = 31;
......
...@@ -15,6 +15,8 @@ class GeneratedCodeTest < Test::Unit::TestCase ...@@ -15,6 +15,8 @@ class GeneratedCodeTest < Test::Unit::TestCase
# successfully creates message definitions and classes, not to test every # successfully creates message definitions and classes, not to test every
# aspect of the extension (basic.rb is for that). # aspect of the extension (basic.rb is for that).
A::B::C::TestMessage.new A::B::C::TestMessage.new
A::B::C::TestMessage::NestedMessage.new
A::B::C::TestLowercaseNested::Lowercase.new
FooBar::TestImportedMessage.new FooBar::TestImportedMessage.new
A::B::TestRubyPackageMessage.new A::B::TestRubyPackageMessage.new
end end
......
...@@ -389,7 +389,7 @@ void GenerateMessageAssignment( ...@@ -389,7 +389,7 @@ void GenerateMessageAssignment(
"lookup(\"$full_name$\").msgclass\n", "lookup(\"$full_name$\").msgclass\n",
"full_name", message->full_name()); "full_name", message->full_name());
std::string nested_prefix = prefix + message->name() + "::"; std::string nested_prefix = prefix + RubifyConstant(message->name()) + "::";
for (int i = 0; i < message->nested_type_count(); i++) { for (int i = 0; i < message->nested_type_count(); i++) {
GenerateMessageAssignment(nested_prefix, message->nested_type(i), printer); GenerateMessageAssignment(nested_prefix, message->nested_type(i), printer);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment