aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc')
-rw-r--r--src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc b/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
index 1b04cb32..1aabe8aa 100644
--- a/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
+++ b/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
@@ -45,22 +45,8 @@ namespace compiler {
namespace ruby {
namespace {
-string FindRubyTestDir(const string& file) {
- // Inspired by TestSourceDir() in src/google/protobuf/testing/googletest.cc.
-#ifndef GOOGLE_THIRD_PARTY_PROTOBUF
- string prefix = ".";
- while (!File::Exists(prefix + "/src/google/protobuf/compiler/ruby" + file)) {
- if (!File::Exists(prefix)) {
- GOOGLE_LOG(FATAL)
- << "Could not find Ruby test directory. Please run tests from "
- "somewhere within the protobuf source package.";
- }
- prefix += "/..";
- }
- return prefix + "/src/google/protobuf/compiler/ruby";
-#else
- return "third_party/protobuf/src/google/protobuf/compiler/ruby";
-#endif // GOOGLE_THIRD_PARTY_PROTOBUF
+string FindRubyTestDir() {
+ return TestSourceDir() + "/google/protobuf/compiler/ruby";
}
// This test is a simple golden-file test over the output of the Ruby code
@@ -71,7 +57,7 @@ string FindRubyTestDir(const string& file) {
// extensions to the point where we can do this test in a more automated way.
TEST(RubyGeneratorTest, GeneratorTest) {
- string ruby_tests = FindRubyTestDir("/ruby_generated_code.proto");
+ string ruby_tests = FindRubyTestDir();
google::protobuf::compiler::CommandLineInterface cli;
cli.SetInputsAreProtoPathRelative(true);
@@ -105,12 +91,12 @@ TEST(RubyGeneratorTest, GeneratorTest) {
// Load the generated output and compare to the expected result.
string output;
GOOGLE_CHECK_OK(File::GetContents(
- TestTempDir() + "/ruby_generated_code.rb",
+ TestTempDir() + "/ruby_generated_code_pb.rb",
&output,
true));
string expected_output;
GOOGLE_CHECK_OK(File::GetContents(
- ruby_tests + "/ruby_generated_code.rb",
+ ruby_tests + "/ruby_generated_code_pb.rb",
&expected_output,
true));
EXPECT_EQ(expected_output, output);