jao-skel-cppunit.el 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ;;; jao-skel-cppunit.el -*- lexical-binding: t; -*-
  2. ;; Copyright (C) 2004, 2005, 2022 Jose Antonio Ortega Ruiz
  3. ;; Author: Jose A Ortega Ruiz <jao@gnu.org>
  4. ;; Keywords: tools
  5. ;; This file is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation; either version 2, or (at your option)
  8. ;; any later version.
  9. ;; This file is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with GNU Emacs; see the file COPYING. If not, write to
  15. ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  16. ;; Boston, MA 02111-1307, USA.
  17. ;;; Commentary:
  18. ;; Skeletons creating cppunit classes.
  19. ;;; Code:
  20. (require 'jao-skel)
  21. (define-skeleton jao-cppunit-main
  22. "Insert CPPUNIT main function"
  23. nil
  24. "#include <cppunit/extensions/TestFactoryRegistry.h>" > \n
  25. "#include <cppunit/ui/text/TestRunner.h>" > \n \n
  26. "int" > \n
  27. "main(int argc, char* argv[])" > \n
  28. "{" > \n
  29. "CppUnit::TextUi::TestRunner runner;" > \n
  30. "CppUnit::TestFactoryRegistry& registry =" > \n
  31. "CppUnit::TestFactoryRegistry::getRegistry();" > \n \n
  32. "runner.addTest(registry.makeTest());" > \n \n
  33. "return !runner.run(\"\", false);" > \n
  34. "}" > \n)
  35. (define-skeleton jao-cppunit-class
  36. "Create a CPPUNIT class definition preamble"
  37. nil
  38. >
  39. "CPPUNIT_TEST_SUITE(" (jao-skel-basename) ");"
  40. > \n
  41. "CPPUNIT_TEST(test);"
  42. > \n
  43. "CPPUNIT_TEST_SUITE_END();"
  44. > \n \n
  45. "private:"
  46. > \n \n
  47. "void test();"
  48. > \n \n
  49. "private:"
  50. > \n \n
  51. "void set_up();"
  52. > \n
  53. "void tear_down();"
  54. > \n)
  55. (define-skeleton jao-cppunit-classdef
  56. "Create a CPPUNIT class implementation preamble"
  57. nil
  58. >
  59. "CPPUNIT_TEST_SUITE_REGISTRATION(" (jao-skel-basename) ");"
  60. > \n \n
  61. "void"
  62. > \n
  63. (jao-skel-basename) "::set_up()"
  64. > \n
  65. "{"
  66. > \n
  67. "}"
  68. > \n \n
  69. "void"
  70. > \n
  71. (jao-skel-basename) "::tear_down()"
  72. > \n
  73. "{"
  74. > \n
  75. "}"
  76. > \n)
  77. (provide 'jao-skel-cppunit)