Home | History | Annotate | Download | only in test

Lines Matching refs:Action

56 using testing::Action;
341 Action<MyFunction> action = MakeAction(new MyActionImpl);
343 // When exercising the Perform() method of Action<F>, we must pass
348 EXPECT_EQ(5, action.Perform(make_tuple(true, 5)));
351 // Tests that Action<F> can be contructed from a pointer to
354 Action<MyFunction> action(new MyActionImpl);
357 // Tests that Action<F> delegates actual work to ActionInterface<F>.
359 const Action<MyFunction> action(new MyActionImpl);
361 EXPECT_EQ(5, action.Perform(make_tuple(true, 5)));
362 EXPECT_EQ(0, action.Perform(make_tuple(false, 1)));
365 // Tests that Action<F> can be copied.
367 Action<MyFunction> a1(new MyActionImpl);
368 Action<MyFunction> a2(a1); // Tests the copy constructor.
374 // a2 should work like the action it was copied from.
384 // a2 should work like the action it was copied from.
389 // Tests that an Action<From> object can be converted to a
390 // compatible Action<To> object.
406 const Action<bool(int)> a1(new IsNotZero); // NOLINT
407 const Action<int(char)> a2 = Action<int(char)>(a1); // NOLINT
415 // Implements a polymorphic action that returns the second of the
420 // polymorphic action whose Perform() method template is either
426 // Implements a polymorphic action that can be used in a nullary
435 // polymorphic action whose Perform() method template is either
453 // Tests that MakePolymorphicAction() turns a polymorphic action
454 // implementation class into a polymorphic action.
456 Action<int(bool, int, double)> a1 = ReturnSecondArgument(); // NOLINT
463 Action<int()> a1 = ReturnZeroFromNullaryFunction();
466 Action<void*()> a2 = ReturnZeroFromNullaryFunction();
470 // Tests that Return() works as an action for void-returning
473 const Action<void(int)> ret = Return(); // NOLINT
479 Action<int()> ret = Return(1); // NOLINT
488 Action<const char*()> a1 = Return("Hello");
491 Action<std::string()> a2 = Return("world");
508 Action<Base*()> ret = Return(&base);
516 // when the action is cast to Action<T(...)> rather than when the action is
538 Action<ToType()> action(Return(x));
542 action.Perform(tuple<>());
543 EXPECT_FALSE(converted) << "Action must NOT convert its argument "
557 Action<DestinationType()> action(Return(s));
562 const Action<int*()> a1 = ReturnNull();
565 const Action<const char*(bool)> a2 = ReturnNull(); // NOLINT
572 const Action<const int&(bool)> ret = ReturnRef(n); // NOLINT
581 Action<Base&()> a = ReturnRef(base);
591 const Action<const int&()> ret = ReturnRefOfCopy(n);
605 Action<Base&()> a = ReturnRefOfCopy(base);
612 // Tests that DoDefault() does the default action for the mock method.
647 // Tests that using DoDefault() inside a composite action leads to a
678 // Tests that DoDefault() does the action specified by ON_CALL().
701 Action<MyFunction> a = SetArgPointee<1>(2);
722 Action<MyFunction> a = SetArgPointee<0>("hi");
738 Action<MyFunction> a = SetArgPointee<0>(L"world");
746 Action<MyStringFunction> a2 = SetArgPointee<0>(L"world");
759 Action<MyFunction> a = SetArgPointee<1>(hi);
778 Action<MyFunction> a = SetArgPointee<1>(hi);
788 Action<MyStringFunction> a2 = SetArgPointee<1>(world);
805 Action<void(bool, TestMessage*)> a = SetArgPointee<1>(*msg);
807 // s.t. the action works even when the original proto_buffer has
809 // action.
827 Action<void(bool, ::ProtocolMessage*)> a = SetArgPointee<1>(*msg);
829 // s.t. the action works even when the original proto_buffer has
831 // action.
852 Action<void(bool, FooMessage*)> a = SetArgPointee<1>(*msg);
854 // proto2_buffer s.t. the action works even when the original
856 // before using the action.
877 Action<void(bool, ::proto2::Message*)> a = SetArgPointee<1>(*msg);
879 // proto2_buffer s.t. the action works even when the original
881 // before using the action.
898 Action<MyFunction> a = SetArgumentPointee<1>(2);
924 Action<void(bool, TestMessage*)> a = SetArgumentPointee<1>(*msg);
926 // s.t. the action works even when the original proto_buffer has
928 // action.
946 Action<void(bool, ::ProtocolMessage*)> a = SetArgumentPointee<1>(*msg);
948 // s.t. the action works even when the original proto_buffer has
950 // action.
971 Action<void(bool, FooMessage*)> a = SetArgumentPointee<1>(*msg);
973 // proto2_buffer s.t. the action works even when the original
975 // before using the action.
996 Action<void(bool, ::proto2::Message*)> a = SetArgumentPointee<1>(*msg);
998 // proto2_buffer s.t. the action works even when the original
1000 // before using the action.
1097 // As an action that takes one argument.
1098 Action<int(int)> a = InvokeWithoutArgs(Nullary); // NOLINT
1101 // As an action that takes two arguments.
1102 Action<int(int, double)> a2 = InvokeWithoutArgs(Nullary); // NOLINT
1105 // As an action that returns void.
1106 Action<void(int)> a3 = InvokeWithoutArgs(VoidNullary); // NOLINT
1114 // As an action that takes no argument.
1115 Action<int()> a = InvokeWithoutArgs(NullaryFunctor()); // NOLINT
1118 // As an action that takes three arguments.
1119 Action<int(int, double, char)> a2 = // NOLINT
1123 // As an action that returns void.
1124 Action<void()> a3 = InvokeWithoutArgs(VoidNullaryFunctor());
1133 Action<int(bool, char)> a = // NOLINT
1138 // Tests using IgnoreResult() on a polymorphic action.
1140 Action<void(int)> a = IgnoreResult(Return(5)); // NOLINT
1144 // Tests using IgnoreResult() on a monomorphic action.
1153 Action<void()> a = IgnoreResult(Invoke(ReturnOne));
1158 // Tests using IgnoreResult() on an action that returns a class type.
1167 Action<void(int)> a = IgnoreResult(Invoke(ReturnMyClass)); // NOLINT
1174 Action<void(int)> a = Assign(&x, 5);
1181 Action<void(void)> a = Assign(&x, "Hello, world");
1188 Action<void(int)> a = Assign(&x, 5);
1202 Action<int(void)> a = SetErrnoAndReturn(ENOTTY, -5);
1209 Action<int*(void)> a = SetErrnoAndReturn(ENOTTY, &x);
1215 Action<double()> a = SetErrnoAndReturn(EINVAL, 5);