Skip to content

Commit

Permalink
Switch to open source status matchers
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 669005518
  • Loading branch information
jcking authored and copybara-github committed Aug 29, 2024
1 parent 043ea2a commit d7fa8c9
Show file tree
Hide file tree
Showing 180 changed files with 552 additions and 801 deletions.
4 changes: 2 additions & 2 deletions base/ast_internal/ast_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
namespace cel::ast_internal {
namespace {

using testing::Pointee;
using testing::Truly;
using ::testing::Pointee;
using ::testing::Truly;

TEST(AstImpl, RawExprCtor) {
// arrange
Expand Down
4 changes: 2 additions & 2 deletions base/operators_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
namespace cel {
namespace {

using testing::Eq;
using testing::Optional;
using ::testing::Eq;
using ::testing::Optional;

template <typename Op, typename OpId>
void TestOperator(Op op, OpId id, absl::string_view name,
Expand Down
4 changes: 2 additions & 2 deletions codelab/exercise1_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
namespace google::api::expr::codelab {
namespace {

using cel::internal::IsOkAndHolds;
using cel::internal::StatusIs;
using ::absl_testing::IsOkAndHolds;
using ::absl_testing::StatusIs;

TEST(Exercise1, PrintHelloWorld) {
EXPECT_THAT(ParseAndEvaluate("'Hello, World!'"),
Expand Down
6 changes: 3 additions & 3 deletions codelab/exercise2_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
namespace google::api::expr::codelab {
namespace {

using ::absl_testing::IsOkAndHolds;
using ::absl_testing::StatusIs;
using ::google::rpc::context::AttributeContext;
using ::google::protobuf::TextFormat;
using testing::HasSubstr;
using cel::internal::IsOkAndHolds;
using cel::internal::StatusIs;
using ::testing::HasSubstr;

TEST(Exercise2Var, Simple) {
EXPECT_THAT(ParseAndEvaluate("bool_var", false), IsOkAndHolds(false));
Expand Down
4 changes: 2 additions & 2 deletions codelab/exercise3_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
namespace google::api::expr::codelab {
namespace {

using ::absl_testing::IsOkAndHolds;
using ::absl_testing::StatusIs;
using ::google::rpc::context::AttributeContext;
using cel::internal::IsOkAndHolds;
using cel::internal::StatusIs;

// Helper for a simple CelExpression with no context.
absl::StatusOr<bool> TruthTableTest(absl::string_view statement) {
Expand Down
4 changes: 2 additions & 2 deletions codelab/solutions/exercise3_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
namespace google::api::expr::codelab {
namespace {

using ::absl_testing::IsOkAndHolds;
using ::absl_testing::StatusIs;
using ::google::rpc::context::AttributeContext;
using cel::internal::IsOkAndHolds;
using cel::internal::StatusIs;

// Helper for a simple CelExpression with no context.
absl::StatusOr<bool> TruthTableTest(absl::string_view statement) {
Expand Down
1 change: 1 addition & 0 deletions common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ cc_library(
":value_kind",
"//internal:testing",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:status_matchers",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/time",
"@com_google_absl//absl/types:optional",
Expand Down
2 changes: 1 addition & 1 deletion common/allocator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace cel {
namespace {

using testing::NotNull;
using ::testing::NotNull;

TEST(AllocatorKind, AbslStringify) {
EXPECT_EQ(absl::StrCat(AllocatorKind::kArena), "ARENA");
Expand Down
16 changes: 8 additions & 8 deletions common/arena_string_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
namespace cel {
namespace {

using testing::Eq;
using testing::Ge;
using testing::Gt;
using testing::IsEmpty;
using testing::Le;
using testing::Lt;
using testing::Ne;
using testing::SizeIs;
using ::testing::Eq;
using ::testing::Ge;
using ::testing::Gt;
using ::testing::IsEmpty;
using ::testing::Le;
using ::testing::Lt;
using ::testing::Ne;
using ::testing::SizeIs;

TEST(ArenaString, Default) {
ArenaString string;
Expand Down
8 changes: 4 additions & 4 deletions common/ast_rewrite_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ namespace {
using ::cel::ast_internal::AstImpl;
using ::cel::extensions::CreateAstFromParsedExpr;
using ::cel::extensions::internal::ConvertProtoExprToNative;
using testing::_;
using testing::ElementsAre;
using testing::InSequence;
using testing::Ref;
using ::testing::_;
using ::testing::ElementsAre;
using ::testing::InSequence;
using ::testing::Ref;

class MockAstRewriter : public AstRewriter {
public:
Expand Down
4 changes: 2 additions & 2 deletions common/ast_traverse_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace cel::ast_internal {

namespace {

using testing::_;
using testing::Ref;
using ::testing::_;
using ::testing::Ref;

class MockAstVisitor : public AstVisitor {
public:
Expand Down
8 changes: 4 additions & 4 deletions common/casting_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
namespace cel {
namespace {

using testing::_;
using testing::Eq;
using testing::Ne;
using testing::Ref;
using ::testing::_;
using ::testing::Eq;
using ::testing::Ne;
using ::testing::Ref;

enum class AncestryKind {
kParent,
Expand Down
6 changes: 3 additions & 3 deletions common/constant_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
namespace cel {
namespace {

using testing::IsEmpty;
using testing::IsFalse;
using testing::IsTrue;
using ::testing::IsEmpty;
using ::testing::IsFalse;
using ::testing::IsTrue;

TEST(Constant, NullValue) {
Constant const_expr;
Expand Down
2 changes: 1 addition & 1 deletion common/data_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace cel {
namespace {

using testing::IsNull;
using ::testing::IsNull;

class DataTest final : public Data {
public:
Expand Down
8 changes: 4 additions & 4 deletions common/decl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
namespace cel {
namespace {

using testing::ElementsAre;
using testing::IsEmpty;
using testing::UnorderedElementsAre;
using cel::internal::StatusIs;
using ::absl_testing::StatusIs;
using ::testing::ElementsAre;
using ::testing::IsEmpty;
using ::testing::UnorderedElementsAre;

TEST(VariableDecl, Name) {
VariableDecl variable_decl;
Expand Down
14 changes: 7 additions & 7 deletions common/expr_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
namespace cel {
namespace {

using testing::_;
using testing::Eq;
using testing::IsEmpty;
using testing::IsFalse;
using testing::IsTrue;
using testing::SizeIs;
using testing::VariantWith;
using ::testing::_;
using ::testing::Eq;
using ::testing::IsEmpty;
using ::testing::IsFalse;
using ::testing::IsTrue;
using ::testing::SizeIs;
using ::testing::VariantWith;

Expr MakeUnspecifiedExpr(ExprId id) {
Expr expr;
Expand Down
12 changes: 6 additions & 6 deletions common/internal/byte_string_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ struct ByteStringViewTestFriend {

namespace {

using testing::Eq;
using testing::IsEmpty;
using testing::Not;
using testing::Optional;
using testing::SizeIs;
using testing::TestWithParam;
using ::testing::Eq;
using ::testing::IsEmpty;
using ::testing::Not;
using ::testing::Optional;
using ::testing::SizeIs;
using ::testing::TestWithParam;

TEST(ByteStringKind, Ostream) {
{
Expand Down
4 changes: 2 additions & 2 deletions common/internal/reference_count_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
namespace cel::common_internal {
namespace {

using testing::NotNull;
using testing::WhenDynamicCastTo;
using ::testing::NotNull;
using ::testing::WhenDynamicCastTo;

class Object : public virtual ReferenceCountFromThis {
public:
Expand Down
8 changes: 4 additions & 4 deletions common/internal/shared_byte_string_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
namespace cel::common_internal {
namespace {

using testing::Eq;
using testing::IsEmpty;
using testing::Ne;
using testing::Not;
using ::testing::Eq;
using ::testing::IsEmpty;
using ::testing::Ne;
using ::testing::Not;

class OwningObject final : public ReferenceCounted {
public:
Expand Down
12 changes: 6 additions & 6 deletions common/json_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
namespace cel::internal {
namespace {

using testing::ElementsAre;
using testing::Eq;
using testing::IsFalse;
using testing::IsTrue;
using testing::UnorderedElementsAre;
using testing::VariantWith;
using ::testing::ElementsAre;
using ::testing::Eq;
using ::testing::IsFalse;
using ::testing::IsTrue;
using ::testing::UnorderedElementsAre;
using ::testing::VariantWith;

TEST(Json, DefaultConstructor) {
EXPECT_THAT(Json(), VariantWith<JsonNull>(Eq(kJsonNull)));
Expand Down
4 changes: 2 additions & 2 deletions common/legacy_type_reflector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
namespace cel {
namespace {

using ::absl_testing::IsOkAndHolds;
using ::absl_testing::StatusIs;
using ::cel::common_internal::LegacyValueManager;
using ::cel::interop_internal::TestOnly_IsLegacyListBuilder;
using ::cel::interop_internal::TestOnly_IsLegacyMapBuilder;
using cel::internal::IsOkAndHolds;
using cel::internal::StatusIs;

class TypeReflectorLegacyTest
: public common_internal::ThreadCompatibleValueTest<> {};
Expand Down
14 changes: 7 additions & 7 deletions common/memory_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ namespace {

// NOLINTBEGIN(bugprone-use-after-move)

using testing::_;
using testing::IsFalse;
using testing::IsNull;
using testing::IsTrue;
using testing::NotNull;
using testing::TestParamInfo;
using testing::TestWithParam;
using ::testing::_;
using ::testing::IsFalse;
using ::testing::IsNull;
using ::testing::IsTrue;
using ::testing::NotNull;
using ::testing::TestParamInfo;
using ::testing::TestWithParam;

TEST(MemoryManagement, ostream) {
{
Expand Down
6 changes: 3 additions & 3 deletions common/native_type_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
namespace cel {
namespace {

using testing::IsEmpty;
using testing::Not;
using testing::SizeIs;
using ::testing::IsEmpty;
using ::testing::Not;
using ::testing::SizeIs;

struct Type1 {};

Expand Down
10 changes: 5 additions & 5 deletions common/reference_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
namespace cel {
namespace {

using testing::_;
using testing::ElementsAre;
using testing::Eq;
using testing::IsEmpty;
using testing::VariantWith;
using ::testing::_;
using ::testing::ElementsAre;
using ::testing::Eq;
using ::testing::IsEmpty;
using ::testing::VariantWith;

TEST(VariableReference, Value) {
VariableReference variable_reference;
Expand Down
8 changes: 4 additions & 4 deletions common/source_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
namespace cel {
namespace {

using testing::ElementsAre;
using testing::Eq;
using testing::Ne;
using testing::Optional;
using ::testing::ElementsAre;
using ::testing::Eq;
using ::testing::Ne;
using ::testing::Optional;

TEST(SourceRange, Default) {
SourceRange range;
Expand Down
8 changes: 4 additions & 4 deletions common/type_reflector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
namespace cel {
namespace {

using testing::Optional;
using cel::internal::IsOk;
using cel::internal::IsOkAndHolds;
using cel::internal::StatusIs;
using ::absl_testing::IsOk;
using ::absl_testing::IsOkAndHolds;
using ::absl_testing::StatusIs;
using ::testing::Optional;

using TypeReflectorTest = common_internal::ThreadCompatibleValueTest<>;

Expand Down
8 changes: 4 additions & 4 deletions common/type_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ namespace cel {
namespace {

using ::cel::internal::GetTestingDescriptorPool;
using testing::An;
using testing::ElementsAre;
using testing::IsEmpty;
using testing::Optional;
using ::testing::An;
using ::testing::ElementsAre;
using ::testing::IsEmpty;
using ::testing::Optional;

TEST(Type, Default) {
EXPECT_EQ(Type(), DynType());
Expand Down
4 changes: 2 additions & 2 deletions common/types/basic_struct_type_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
namespace cel::common_internal {
namespace {

using testing::Eq;
using testing::IsEmpty;
using ::testing::Eq;
using ::testing::IsEmpty;

TEST(BasicStructType, Kind) {
EXPECT_EQ(BasicStructType::kind(), TypeKind::kStruct);
Expand Down
Loading

0 comments on commit d7fa8c9

Please sign in to comment.