gordonwatts / cppunit.nuget

Build a CppUnit nuget package
1 stars 0 forks source link

Doesn't work in vs2013. #1

Open wickedmuc opened 10 years ago

wickedmuc commented 10 years ago

Admittedly, the example file works, but that's because it only relies of functions directly included. The nuget package needs to include cppunit.lib, no? and it doesn't.

Here is a test case:

#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/TestListener.h>
#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/Outputter.h>
#include <cppunit/XmlOutputter.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>

class BlaTest : public CppUnit::TestFixture {

        CPPUNIT_TEST_SUITE( BlaTest );
        CPPUNIT_TEST( test );
        CPPUNIT_TEST_SUITE_END();

    public:

        BlaTest() {}
        virtual ~BlaTest() {}

        virtual void test()
        {
    }

    };

CPPUNIT_TEST_SUITE_REGISTRATION( BlaTest );

int main( int argc, char **argv ) 
{

    bool wasSuccessful = false;
 #ifdef BREAKS
    std::auto_ptr<CppUnit::TestListener> listener( new CppUnit::BriefTestProgressListener );

    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
    runner.addTest( registry.makeTest() );

    // Shows a message as each test starts
    if( listener.get() != NULL )
    {
        runner.eventManager().addListener( listener.get() );
    }

    wasSuccessful = runner.run( "", false );
    return !wasSuccessful;
#else
    CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

  // Adds the test to the list of test to run
  CppUnit::TextUi::TestRunner runner;
  runner.addTest( suite );

  // Run the test.
  bool wasSucessful = runner.run();

  // Return error code 1 if the one of test failed.
  return wasSucessful ? 0 : 1;
#endif
}
gordonwatts commented 10 years ago

Yikes! Thanks, I'll check that. I was actually using this on a much more complex build, so I thought I had it.

gordonwatts commented 10 years ago

Failure due to silent fail in the coapp tools: https://github.com/coapp/coapp.powershell/issues/80.

gordonwatts commented 10 years ago

Fixed and pushed to nuget. Please let me know if this resolves it! Thanks so much for the careful file upload - that made things much easier!