aboutsummaryrefslogtreecommitdiffhomepage
path: root/ruby
diff options
context:
space:
mode:
authorGravatar Paul Yang <TeBoring@users.noreply.github.com>2018-05-17 17:11:06 -0700
committerGravatar GitHub <noreply@github.com>2018-05-17 17:11:06 -0700
commit9ccc3e536c4d83a79f82843894793fb850e6d4e4 (patch)
tree2d6170278b6ec354ca36d5f0b8142cce467023fe /ruby
parent036947f63087a48558e46bccfb6c99122a494266 (diff)
Adopt ruby_package in ruby generated code. (#4627)
* Adopt ruby_package in ruby generated code. * Add test for ruby_package
Diffstat (limited to 'ruby')
-rw-r--r--ruby/Rakefile5
-rw-r--r--ruby/tests/generated_code_test.rb2
-rw-r--r--ruby/tests/test_ruby_package.proto7
3 files changed, 14 insertions, 0 deletions
diff --git a/ruby/Rakefile b/ruby/Rakefile
index ff09cebb..013bc99a 100644
--- a/ruby/Rakefile
+++ b/ruby/Rakefile
@@ -87,6 +87,7 @@ end
# Proto for tests.
genproto_output << "tests/generated_code.rb"
genproto_output << "tests/test_import.rb"
+genproto_output << "tests/test_ruby_package.rb"
file "tests/generated_code.rb" => "tests/generated_code.proto" do |file_task|
sh "../src/protoc --ruby_out=. tests/generated_code.proto"
end
@@ -95,6 +96,10 @@ file "tests/test_import.rb" => "tests/test_import.proto" do |file_task|
sh "../src/protoc --ruby_out=. tests/test_import.proto"
end
+file "tests/test_ruby_package.rb" => "tests/test_ruby_package.proto" do |file_task|
+ sh "../src/protoc --ruby_out=. tests/test_ruby_package.proto"
+end
+
task :genproto => genproto_output
task :clean do
diff --git a/ruby/tests/generated_code_test.rb b/ruby/tests/generated_code_test.rb
index b92b0462..431d681b 100644
--- a/ruby/tests/generated_code_test.rb
+++ b/ruby/tests/generated_code_test.rb
@@ -5,6 +5,7 @@ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
require 'generated_code_pb'
require 'test_import_pb'
+require 'test_ruby_package_pb'
require 'test/unit'
class GeneratedCodeTest < Test::Unit::TestCase
@@ -15,5 +16,6 @@ class GeneratedCodeTest < Test::Unit::TestCase
# aspect of the extension (basic.rb is for that).
m = A::B::C::TestMessage.new()
m2 = FooBar::TestImportedMessage.new()
+ m3 = A::B::TestRubyPackageMessage.new()
end
end
diff --git a/ruby/tests/test_ruby_package.proto b/ruby/tests/test_ruby_package.proto
new file mode 100644
index 00000000..b8725620
--- /dev/null
+++ b/ruby/tests/test_ruby_package.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+package foo_bar;
+
+option ruby_package = "A.B";
+
+message TestRubyPackageMessage {}