Skip to content

Commit

Permalink
Add edition_message_unittest.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 606717431
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Feb 13, 2024
1 parent d49dacc commit 0c715b5
Show file tree
Hide file tree
Showing 5 changed files with 2,004 additions and 23 deletions.
32 changes: 32 additions & 0 deletions src/google/protobuf/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ filegroup(
filegroup(
name = "test_proto_editions_srcs",
srcs = [
"edition_unittest.proto",
"map_proto3_unittest.proto",
"unittest_arena.proto",
"unittest_drop_unknown_fields.proto",
Expand Down Expand Up @@ -1508,6 +1509,37 @@ cc_test(
],
)

cc_test(
name = "edition_message_unittest",
srcs = [
"edition_message_unittest.cc",
"message_unittest.inc",
],
data = [":testdata"],
deps = [
":arena",
":cc_test_protos",
":internal_visibility",
":port",
":protobuf",
":protobuf_lite",
":test_util",
":test_util2",
"//src/google/protobuf/io",
"//src/google/protobuf/io:io_win32",
"//src/google/protobuf/stubs",
"//src/google/protobuf/testing",
"//src/google/protobuf/testing:file",
"//src/google/protobuf/util:differencer",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:scoped_mock_log",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:cord",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "no_field_presence_test",
srcs = ["no_field_presence_test.cc"],
Expand Down
37 changes: 37 additions & 0 deletions src/google/protobuf/edition_message_unittest.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
//
// This test is meant to verify the interaction of the most common and
// representative edition features. Each new edition feature must have its own
// unit test and we'll selectively accept new features when we believe doing so
// improves test coverage in a meaningful way.
//
// Note that new features that break the backward compatibility poses challenges
// to shared unit tests infrastructure this test uses. It may force us to split
// the shared tests. Keep the shared unit tests (message_unittest.inc)
// representative without sacrificing test coverage.

#include <gtest/gtest.h>
#include "absl/log/absl_check.h"
#include "google/protobuf/arena.h"
#include "google/protobuf/edition_unittest.pb.h"
#include "google/protobuf/explicitly_constructed.h"
#include "google/protobuf/has_bits.h"
#include "google/protobuf/internal_visibility.h"
#include "google/protobuf/unittest_import.pb.h"

#define MESSAGE_TEST_NAME EditionMessageTest
#define MESSAGE_FACTORY_TEST_NAME EditionMessageFactoryTest
#define UNITTEST_PACKAGE_NAME "edition_unittest"
#define UNITTEST ::edition_unittest
#define UNITTEST_IMPORT ::protobuf_unittest_import

// Must include after the above macros.
// clang-format off
#include "google/protobuf/test_util.inc"
#include "google/protobuf/message_unittest.inc"
// clang-format on
Loading

0 comments on commit 0c715b5

Please sign in to comment.