Skip to content

Clean up Plugins example code for SetPointerPlugin #47

Open
@keith-at-spacee

Description

@keith-at-spacee

I'm having a problem compiling AllTests.cpp after adding the setup code which seems to be recommended in Plugin Manual re: SetPointerPlugin . My AllTests.cpp looks like this:

#include "CppUTest/CommandLineTestRunner.h"

int main(int ac, char** av)
{
    TestRegistry* r = TestRegistry::getCurrentRegistry();
    SetPointerPlugin ps("PointerStore");
    r->installPlugin(&ps);

    return CommandLineTestRunner::RunAllTests(ac, av);
}

but when I compile it (gcc:10), I get an error:

$ make ./test-obj/1/2/tests/AllTests.o
compiling AllTests.cpp
tests/AllTests.cpp: In function ‘int main(int, char**)’:
tests/AllTests.cpp:11:34: error: incomplete type ‘TestRegistry’ used in nested name specifier
   11 |  TestRegistry* r = TestRegistry::getCurrentRegistry();
      |                                  ^~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
make: *** [/home/keith/e2_studio/Ranger/CppUTest/build/MakefileWorker.mk:511: test-obj/1/2/tests/AllTests.o] Error 1

After searching for SetPointerPlugin in the CppUTest source files, in function int CommandLineTestRunner::runAllTestsMain() the SetPointerPlugin is installed in the registry by default, with no extra setup code being needed in main(). So it seems that the setup code shown for installing it should be removed from Plugin Manual re: SetPointerPlugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions