aboutsummaryrefslogtreecommitdiffhomepage
path: root/ruby/tests/generated_code_test.rb
diff options
context:
space:
mode:
authorGravatar Chris Fallin <cfallin@google.com>2015-01-14 15:44:46 -0800
committerGravatar Chris Fallin <cfallin@google.com>2015-01-14 15:44:46 -0800
commit3f3820d8f8b5c0b67aadc25ad5a2e728b6a3fe79 (patch)
tree53afc636c0dfe600a05bc65531023886436b1af3 /ruby/tests/generated_code_test.rb
parent7c4bbf07a5eee1fd4f5c2d60be32b95c35b0ed1d (diff)
Two tests for Ruby code generator:
- A golden-file test that ensures protoc produces known-valid output. - A Ruby test that loads that golden file and ensures it actually works with the extension. This split strategy allows us to test end-to-end without needing to integrate the Ruby gem build system and the protoc build system. This is desirable because we do not want a gem build/install to depend on building protoc, and we do not want building protoc to depend on building and testing the gem.
Diffstat (limited to 'ruby/tests/generated_code_test.rb')
-rw-r--r--ruby/tests/generated_code_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/ruby/tests/generated_code_test.rb b/ruby/tests/generated_code_test.rb
new file mode 100644
index 00000000..daef357a
--- /dev/null
+++ b/ruby/tests/generated_code_test.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/ruby
+
+# generated_code.rb is in the same directory as this test.
+$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
+
+require 'generated_code'
+require 'test/unit'
+
+class GeneratedCodeTest < Test::Unit::TestCase
+ def test_generated_msg
+ # just test that we can instantiate the message. The purpose of this test
+ # is to ensure that the output of the code generator is valid Ruby and
+ # successfully creates message definitions and classes, not to test every
+ # aspect of the extension (basic.rb is for that).
+ m = A::B::C::TestMessage.new()
+ end
+end