Automated Code Change

PiperOrigin-RevId: 610367636
pull/15948/head
Protobuf Team Bot 9 months ago committed by Copybara-Service
parent 2eb6e4f374
commit 0e8bb1954d
  1. 5
      src/google/protobuf/compiler/cpp/metadata_test.cc
  2. 9
      src/google/protobuf/compiler/cpp/plugin_unittest.cc

@ -13,7 +13,6 @@
#include "google/protobuf/compiler/command_line_interface.h" #include "google/protobuf/compiler/command_line_interface.h"
#include "google/protobuf/descriptor.pb.h" #include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.pb.h" #include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "absl/log/absl_check.h" #include "absl/log/absl_check.h"
#include "google/protobuf/compiler/annotation_test_util.h" #include "google/protobuf/compiler/annotation_test_util.h"
@ -45,7 +44,7 @@ class CppMetadataTest : public ::testing::Test {
"--cpp_out=annotate_headers=true," "--cpp_out=annotate_headers=true,"
"annotation_pragma_name=pragma_name," "annotation_pragma_name=pragma_name,"
"annotation_guard_name=guard_name:", "annotation_guard_name=guard_name:",
TestTempDir()); ::testing::TempDir());
const bool result = atu::RunProtoCompiler(filename, cpp_out, &cli, file); const bool result = atu::RunProtoCompiler(filename, cpp_out, &cli, file);
@ -54,7 +53,7 @@ class CppMetadataTest : public ::testing::Test {
} }
std::string output_base = std::string output_base =
absl::StrCat(TestTempDir(), "/", StripProto(filename)); absl::StrCat(::testing::TempDir(), "/", StripProto(filename));
if (pb_cc != nullptr) { if (pb_cc != nullptr) {
ABSL_CHECK_OK(File::GetContents(absl::StrCat(output_base, ".pb.cc"), ABSL_CHECK_OK(File::GetContents(absl::StrCat(output_base, ".pb.cc"),

@ -17,7 +17,6 @@
#include "google/protobuf/testing/file.h" #include "google/protobuf/testing/file.h"
#include "google/protobuf/compiler/cpp/generator.h" #include "google/protobuf/compiler/cpp/generator.h"
#include "google/protobuf/compiler/command_line_interface.h" #include "google/protobuf/compiler/command_line_interface.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "absl/log/absl_check.h" #include "absl/log/absl_check.h"
#include "google/protobuf/io/printer.h" #include "google/protobuf/io/printer.h"
@ -150,7 +149,7 @@ class TestGenerator : public CodeGenerator {
// compiling the output which is a bit more than I care to do for this test. // compiling the output which is a bit more than I care to do for this test.
TEST(CppPluginTest, PluginTest) { TEST(CppPluginTest, PluginTest) {
ABSL_CHECK_OK( ABSL_CHECK_OK(
File::SetContents(absl::StrCat(TestTempDir(), "/test.proto"), File::SetContents(absl::StrCat(::testing::TempDir(), "/test.proto"),
"syntax = \"proto2\";\n" "syntax = \"proto2\";\n"
"package foo;\n" "package foo;\n"
"\n" "\n"
@ -197,9 +196,9 @@ TEST(CppPluginTest, PluginTest) {
cli.RegisterGenerator("--cpp_out", &cpp_generator, ""); cli.RegisterGenerator("--cpp_out", &cpp_generator, "");
cli.RegisterGenerator("--test_out", &test_generator, ""); cli.RegisterGenerator("--test_out", &test_generator, "");
std::string proto_path = absl::StrCat("-I", TestTempDir()); std::string proto_path = absl::StrCat("-I", ::testing::TempDir());
std::string cpp_out = absl::StrCat("--cpp_out=", TestTempDir()); std::string cpp_out = absl::StrCat("--cpp_out=", ::testing::TempDir());
std::string test_out = absl::StrCat("--test_out=", TestTempDir()); std::string test_out = absl::StrCat("--test_out=", ::testing::TempDir());
const char* argv[] = {"protoc", proto_path.c_str(), cpp_out.c_str(), const char* argv[] = {"protoc", proto_path.c_str(), cpp_out.c_str(),
test_out.c_str(), "test.proto"}; test_out.c_str(), "test.proto"};

Loading…
Cancel
Save