You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
807 B

  1. #include <gtest/gtest.h>
  2. #include <apt-pkg/error.h>
  3. #include <apt-pkg/cmndline.h>
  4. bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *) {return false;}
  5. std::vector<CommandLine::DispatchWithHelp> GetCommands() {return {};}
  6. int main(int argc, char **argv) {
  7. ::testing::InitGoogleTest(&argc, argv);
  8. int result = RUN_ALL_TESTS();
  9. if (_error->empty() == false)
  10. {
  11. std::cerr << "The test generated the following global messages:" << std::endl;
  12. _error->DumpErrors(std::cerr);
  13. // messages on the stack can't be right, error out
  14. // even if we have no idea where this message came from
  15. if (result == 0)
  16. {
  17. std::cerr << "All tests successful, but messages were generated, so still a failure!" << std::endl;
  18. return 29;
  19. }
  20. }
  21. return result;
  22. }