Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Eran Pe'er
    @eranpeer
    There is a new open issue (#21) asking for "Support stub for output parameter". Any suggestions for API?
    Miles Rout
    @milesrout
    How does this header possibly work. Mocking in C++?
    broun7
    @broun7
    hi Im new to the framework, does FakeIt support stubbing non-virtual methods?
    Eran Pe'er
    @eranpeer
    No, fakeit can only handle virtual methods. This is because fakeit hacks the virtual table and can only manipulate the methods found there.
    broun7
    @broun7
    Thanks for the response!! One more thing, is I see from GIT home that multiple inheritance is not supported.
    does this mean classes deriving from multiple classes cannot be mocked or just a subset of features from multiple inheritance isnt supported?
    Eran Pe'er
    @eranpeer
    As far as I remember RTTI may not work correctly. Other features should work just fine. But let me make a dee
    Let me check and I will give you a better answer.
    broun7
    @broun7
    Also, I have a legacy C++ application that does not make use of C++11. Now since the FakeIt uses C++11 features, could you please tell me how to compile my gtest with the fakeit.hpp header. Since mine is a legacy application compiling the gtest fails to recognize the symbols in the fakeit.hpp header.
    The GIT page says FakeIt is compatible with C++ projects as well, but Im unable to figure out how to include the header into my project. thanks.
    broun7
    @broun7
    related stack overflow question: http://tiny/paujkb98/stacques3364incl
    not sure if previous link wrks, http://tinyurl.com/nknvxz6
    Eran Pe'er
    @eranpeer
    Well, I checked. It is more than just the RTTI. FakeIt can't handle mocking of classes with multiple inheritance.
    In some cases, for example with MSVS, you can compile the test project with c++11 and leave the production project/dll with c++.
    broun7
    @broun7
    Hmm, multiple inheritance might be a blocker for us! But thanks for getting back.
    XzoRit
    @XzoRit

    Hi, I am currently working my way through the quickstart guide to get a feel for your library. Very interesting so far.
    In the chapter Argument Matching the given examples do not compile
    I guess instead of

    When(Method(mock,foo).Using(Gt(1)).Return(1);

    it should be

    When(Method(mock,foo).Using(Gt(1))).Return(1);
    Bruno Castro
    @brunohkbx
    Hello everyone
    Could someone answer my question?
    eranpeer/FakeIt#91
    Thanks
    marlon2501marshall
    @marlon2501marshall

    Hello eranpeer.
    Recently I've read about your framework at github and I thought it could be really useful on my projects.
    For now, I'm trying to compile your example from the Quickstart page, but I'm having a problem on it: the g++ compiler gives

    fakeit.hpp:9297:9: error: expected constructor, destructor, or type conversion before(’ token
         When(call)
             ^
    main.cpp:15:1: note: in expansion of macro ‘When’
     When(Method(mock,foo)).Return(1);

    when trying to compile this source:

    #include <string>
    #include "catch.hpp"
    #include "fakeit.hpp"
    
    using namespace std;
    using namespace fakeit;
    
    struct SomeInterface {
        virtual int foo(int) = 0;
        virtual int bar(string) = 0;
    };
    
    Mock<SomeInterface> mock;
    
    When(Method(mock,foo)).Return(1);

    Could you please help me with this? I apologize if the solution to the problem is something obvious that I should've known before writing this question.

    vvvlc
    @vvvlc

    Hi
    I opened eranpeer/FakeIt#134 for supporting

    #include <string>
    
    #include "tpunit++.hpp"
    #include "fakeit.hpp"
    
    using namespace fakeit;
    
    struct OperatorBoolTests : tpunit::TestFixture {
    
        OperatorBoolTests() :
        tpunit::TestFixture(
        TEST(OperatorBoolTests::enum_class_arg)
        )
        {
        }
    
        struct SomeInterface {
            virtual operator bool() = 0;
        };
    
        void enum_class_arg() {
            Mock<SomeInterface> mock;
            //When(Method(mock, operator())).AlwaysReturn(true);
            When(OverloadedMethod(mock, operator(), bool(void))).AlwaysReturn(true);
    
            mock.get().operator bool();
            //Verify(OverloadedMethodMethod(mock, operator(), bool(void))).Exactly(1);
        }
    
    } __OperatorBoolTests;

    I get compilation error

    In member function ‘void OperatorBoolTests::enum_class_arg()’:
    cc1plus: error: ‘operator()’ is not a member of ‘std::remove_reference<OperatorBoolTests::SomeInterface&>::type {aka OperatorBoolTests::SomeInterface}’

    Thx for help

    fschuh
    @fschuh
    Hi eranpeer! Fakeit looks like a really nice way to do mocking in C++.
    I have two questions: does it work without RTTI? And does it require exceptions to be enabled?
    Thomas Piekarski
    @tpiekarski
    Hello, is there a nuget package for FakeIt available at nuget.org or elsewhere? I see a build script for a nuget package in the repository, but can not find the package at nuget.