Automated Code Change

PiperOrigin-RevId: 610364921
pull/15949/head
Protobuf Team Bot 9 months ago committed by Copybara-Service
parent ee0a41cae3
commit 2eb6e4f374
  1. 5
      src/google/protobuf/compiler/java/message_serialization_unittest.cc
  2. 12
      src/google/protobuf/compiler/java/plugin_unittest.cc

@ -13,7 +13,6 @@
#include "google/protobuf/testing/file.h"
#include "google/protobuf/testing/file.h"
#include <gmock/gmock.h>
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
@ -41,7 +40,7 @@ int CompileJavaProto(std::string proto_file_name) {
std::string proto_path = absl::StrCat(
"--proto_path=",
TestUtil::GetTestDataPath("google/protobuf/compiler/java"));
std::string java_out = absl::StrCat("--java_out=", TestTempDir());
std::string java_out = absl::StrCat("--java_out=", ::testing::TempDir());
const char* argv[] = {
"protoc",
@ -61,7 +60,7 @@ TEST(MessageSerializationTest, CollapseAdjacentExtensionRanges) {
ABSL_CHECK_OK(File::GetContents(
// Open-source codebase does not support file::JoinPath, so we manually
// concatenate instead.
absl::StrCat(TestTempDir(),
absl::StrCat(::testing::TempDir(),
"/TestMessageWithManyExtensionRanges.java"),
&java_source, true));

@ -12,7 +12,6 @@
#include "google/protobuf/testing/file.h"
#include "google/protobuf/testing/file.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "absl/log/absl_check.h"
#include "absl/strings/str_split.h"
@ -66,7 +65,7 @@ class TestGenerator : public CodeGenerator {
// compiling the output which is a bit more than I care to do for this test.
TEST(JavaPluginTest, PluginTest) {
ABSL_CHECK_OK(
File::SetContents(absl::StrCat(TestTempDir(), "/test.proto"),
File::SetContents(absl::StrCat(::testing::TempDir(), "/test.proto"),
"edition = \"2023\";\n"
"package foo;\n"
"option java_package = \"\";\n"
@ -88,9 +87,9 @@ TEST(JavaPluginTest, PluginTest) {
cli.RegisterGenerator("--java_out", &java_generator, "");
cli.RegisterGenerator("--test_out", &test_generator, "");
std::string proto_path = absl::StrCat("-I", TestTempDir());
std::string java_out = absl::StrCat("--java_out=", TestTempDir());
std::string test_out = absl::StrCat("--test_out=", TestTempDir());
std::string proto_path = absl::StrCat("-I", ::testing::TempDir());
std::string java_out = absl::StrCat("--java_out=", ::testing::TempDir());
std::string test_out = absl::StrCat("--test_out=", ::testing::TempDir());
const char* argv[] = {
"protoc", proto_path.c_str(), java_out.c_str(),
@ -102,7 +101,8 @@ TEST(JavaPluginTest, PluginTest) {
// expect
std::string output;
ABSL_CHECK_OK(File::GetContents(absl::StrCat(TestTempDir(), "/Test.java"),
ABSL_CHECK_OK(
File::GetContents(absl::StrCat(::testing::TempDir(), "/Test.java"),
&output, true));
std::vector<std::string> lines = absl::StrSplit(output, "\n");
bool found_generated_annotation = false;

Loading…
Cancel
Save