commonmarker 0.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of commonmarker might be problematic. Click here for more details.

Files changed (291) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +119 -0
  5. data/Rakefile +39 -0
  6. data/bin/commonmarker +41 -0
  7. data/commonmarker.gemspec +30 -0
  8. data/ext/commonmarker/cmark/CMakeLists.txt +25 -0
  9. data/ext/commonmarker/cmark/COPYING +192 -0
  10. data/ext/commonmarker/cmark/FindAsan.cmake +74 -0
  11. data/ext/commonmarker/cmark/Makefile +170 -0
  12. data/ext/commonmarker/cmark/Makefile.nmake +36 -0
  13. data/ext/commonmarker/cmark/README.md +169 -0
  14. data/ext/commonmarker/cmark/api_test/CMakeLists.txt +25 -0
  15. data/ext/commonmarker/cmark/api_test/cplusplus.cpp +15 -0
  16. data/ext/commonmarker/cmark/api_test/cplusplus.h +17 -0
  17. data/ext/commonmarker/cmark/api_test/harness.c +102 -0
  18. data/ext/commonmarker/cmark/api_test/harness.h +42 -0
  19. data/ext/commonmarker/cmark/api_test/main.c +700 -0
  20. data/ext/commonmarker/cmark/appveyor.yml +15 -0
  21. data/ext/commonmarker/cmark/bench/statistics.py +595 -0
  22. data/ext/commonmarker/cmark/bench/stats.py +19 -0
  23. data/ext/commonmarker/cmark/benchmarks.md +33 -0
  24. data/ext/commonmarker/cmark/build/CMakeCache.txt +362 -0
  25. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeCCompiler.cmake +63 -0
  26. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeCXXCompiler.cmake +64 -0
  27. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeDetermineCompilerABI_C.bin +0 -0
  28. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeDetermineCompilerABI_CXX.bin +0 -0
  29. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeSystem.cmake +15 -0
  30. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdC/CMakeCCompilerId.c +499 -0
  31. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdC/a.out +0 -0
  32. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +489 -0
  33. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdCXX/a.out +0 -0
  34. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  35. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +30 -0
  36. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +598 -0
  37. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +77 -0
  38. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile2 +268 -0
  39. data/ext/commonmarker/cmark/build/CMakeFiles/TargetDirectories.txt +4 -0
  40. data/ext/commonmarker/cmark/build/CMakeFiles/cmake.check_cache +1 -0
  41. data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.bin +0 -0
  42. data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.c +34 -0
  43. data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.cxx +405 -0
  44. data/ext/commonmarker/cmark/build/CMakeFiles/progress.marks +1 -0
  45. data/ext/commonmarker/cmark/build/CTestTestfile.cmake +10 -0
  46. data/ext/commonmarker/cmark/build/Makefile +237 -0
  47. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  48. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/C.includecache +92 -0
  49. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/CXX.includecache +36 -0
  50. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake +29 -0
  51. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +155 -0
  52. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake +12 -0
  53. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o +0 -0
  54. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/depend.internal +25 -0
  55. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/depend.make +25 -0
  56. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/flags.make +13 -0
  57. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/harness.c.o +0 -0
  58. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -0
  59. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/main.c.o +0 -0
  60. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/progress.make +4 -0
  61. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/progress.marks +1 -0
  62. data/ext/commonmarker/cmark/build/api_test/Makefile +277 -0
  63. data/ext/commonmarker/cmark/build/api_test/api_test +0 -0
  64. data/ext/commonmarker/cmark/build/api_test/cmake_install.cmake +29 -0
  65. data/ext/commonmarker/cmark/build/cmake_install.cmake +48 -0
  66. data/ext/commonmarker/cmark/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  67. data/ext/commonmarker/cmark/build/man/CMakeFiles/progress.marks +1 -0
  68. data/ext/commonmarker/cmark/build/man/Makefile +181 -0
  69. data/ext/commonmarker/cmark/build/man/cmake_install.cmake +37 -0
  70. data/ext/commonmarker/cmark/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  71. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/C.includecache +422 -0
  72. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/DependInfo.cmake +39 -0
  73. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/blocks.c.o +0 -0
  74. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/buffer.c.o +0 -0
  75. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/build.make +544 -0
  76. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmake_clean.cmake +27 -0
  77. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmark.c.o +0 -0
  78. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmark_ctype.c.o +0 -0
  79. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/commonmark.c.o +0 -0
  80. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/depend.internal +177 -0
  81. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/depend.make +177 -0
  82. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/flags.make +8 -0
  83. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/houdini_href_e.c.o +0 -0
  84. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/houdini_html_e.c.o +0 -0
  85. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/houdini_html_u.c.o +0 -0
  86. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/html.c.o +0 -0
  87. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/inlines.c.o +0 -0
  88. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/iterator.c.o +0 -0
  89. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/link.txt +1 -0
  90. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/main.c.o +0 -0
  91. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/man.c.o +0 -0
  92. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/node.c.o +0 -0
  93. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/progress.make +19 -0
  94. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/references.c.o +0 -0
  95. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/scanners.c.o +0 -0
  96. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/utf8.c.o +0 -0
  97. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/xml.c.o +0 -0
  98. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/C.includecache +394 -0
  99. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/DependInfo.cmake +44 -0
  100. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/blocks.c.o +0 -0
  101. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/buffer.c.o +0 -0
  102. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/build.make +522 -0
  103. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmake_clean.cmake +27 -0
  104. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmark.c.o +0 -0
  105. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmark_ctype.c.o +0 -0
  106. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/commonmark.c.o +0 -0
  107. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/depend.internal +169 -0
  108. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/depend.make +169 -0
  109. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/flags.make +8 -0
  110. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/houdini_href_e.c.o +0 -0
  111. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/houdini_html_e.c.o +0 -0
  112. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/houdini_html_u.c.o +0 -0
  113. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/html.c.o +0 -0
  114. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/inlines.c.o +0 -0
  115. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/iterator.c.o +0 -0
  116. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/link.txt +1 -0
  117. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/man.c.o +0 -0
  118. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/node.c.o +0 -0
  119. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/progress.make +18 -0
  120. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/references.c.o +0 -0
  121. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/scanners.c.o +0 -0
  122. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/utf8.c.o +0 -0
  123. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/xml.c.o +0 -0
  124. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/C.includecache +394 -0
  125. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/DependInfo.cmake +38 -0
  126. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/blocks.c.o +0 -0
  127. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/buffer.c.o +0 -0
  128. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/build.make +519 -0
  129. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmake_clean.cmake +26 -0
  130. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmake_clean_target.cmake +3 -0
  131. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark.c.o +0 -0
  132. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark_ctype.c.o +0 -0
  133. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/commonmark.c.o +0 -0
  134. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.internal +169 -0
  135. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.make +169 -0
  136. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/flags.make +8 -0
  137. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/houdini_href_e.c.o +0 -0
  138. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/houdini_html_e.c.o +0 -0
  139. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/houdini_html_u.c.o +0 -0
  140. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/html.c.o +0 -0
  141. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/inlines.c.o +0 -0
  142. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/iterator.c.o +0 -0
  143. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/link.txt +2 -0
  144. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/man.c.o +0 -0
  145. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/node.c.o +0 -0
  146. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/progress.make +18 -0
  147. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/references.c.o +0 -0
  148. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/scanners.c.o +0 -0
  149. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/utf8.c.o +0 -0
  150. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/xml.c.o +0 -0
  151. data/ext/commonmarker/cmark/build/src/CMakeFiles/progress.marks +1 -0
  152. data/ext/commonmarker/cmark/build/src/Makefile +814 -0
  153. data/ext/commonmarker/cmark/build/src/cmake_install.cmake +69 -0
  154. data/ext/commonmarker/cmark/build/src/cmark +0 -0
  155. data/ext/commonmarker/cmark/build/src/cmark_export.h +41 -0
  156. data/ext/commonmarker/cmark/build/src/cmark_version.h +7 -0
  157. data/ext/commonmarker/cmark/build/src/config.h +23 -0
  158. data/ext/commonmarker/cmark/build/src/libcmark.0.19.0.dylib +0 -0
  159. data/ext/commonmarker/cmark/build/src/libcmark.a +0 -0
  160. data/ext/commonmarker/cmark/build/src/libcmark.dylib +0 -0
  161. data/ext/commonmarker/cmark/build/src/libcmark.pc +10 -0
  162. data/ext/commonmarker/cmark/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  163. data/ext/commonmarker/cmark/build/testdir/CMakeFiles/progress.marks +1 -0
  164. data/ext/commonmarker/cmark/build/testdir/CTestTestfile.cmake +12 -0
  165. data/ext/commonmarker/cmark/build/testdir/Makefile +181 -0
  166. data/ext/commonmarker/cmark/build/testdir/cmake_install.cmake +29 -0
  167. data/ext/commonmarker/cmark/changelog.txt +153 -0
  168. data/ext/commonmarker/cmark/data/CaseFolding-3.2.0.txt +912 -0
  169. data/ext/commonmarker/cmark/man/CMakeLists.txt +8 -0
  170. data/ext/commonmarker/cmark/man/make_man_page.py +131 -0
  171. data/ext/commonmarker/cmark/man/man1/cmark.1 +54 -0
  172. data/ext/commonmarker/cmark/man/man3/cmark.3 +583 -0
  173. data/ext/commonmarker/cmark/nmake.bat +1 -0
  174. data/ext/commonmarker/cmark/src/CMakeLists.txt +166 -0
  175. data/ext/commonmarker/cmark/src/bench.h +27 -0
  176. data/ext/commonmarker/cmark/src/blocks.c +887 -0
  177. data/ext/commonmarker/cmark/src/buffer.c +381 -0
  178. data/ext/commonmarker/cmark/src/buffer.h +113 -0
  179. data/ext/commonmarker/cmark/src/case_fold_switch.inc +2637 -0
  180. data/ext/commonmarker/cmark/src/chunk.h +110 -0
  181. data/ext/commonmarker/cmark/src/cmark.c +24 -0
  182. data/ext/commonmarker/cmark/src/cmark.h +565 -0
  183. data/ext/commonmarker/cmark/src/cmark_ctype.c +53 -0
  184. data/ext/commonmarker/cmark/src/cmark_ctype.h +24 -0
  185. data/ext/commonmarker/cmark/src/cmark_version.h.in +7 -0
  186. data/ext/commonmarker/cmark/src/commonmark.c +607 -0
  187. data/ext/commonmarker/cmark/src/config.h.in +23 -0
  188. data/ext/commonmarker/cmark/src/debug.h +36 -0
  189. data/ext/commonmarker/cmark/src/houdini.h +52 -0
  190. data/ext/commonmarker/cmark/src/houdini_href_e.c +107 -0
  191. data/ext/commonmarker/cmark/src/houdini_html_e.c +81 -0
  192. data/ext/commonmarker/cmark/src/houdini_html_u.c +116 -0
  193. data/ext/commonmarker/cmark/src/html.c +322 -0
  194. data/ext/commonmarker/cmark/src/html_unescape.gperf +2130 -0
  195. data/ext/commonmarker/cmark/src/html_unescape.h +13375 -0
  196. data/ext/commonmarker/cmark/src/inlines.c +1147 -0
  197. data/ext/commonmarker/cmark/src/inlines.h +19 -0
  198. data/ext/commonmarker/cmark/src/iterator.c +148 -0
  199. data/ext/commonmarker/cmark/src/iterator.h +25 -0
  200. data/ext/commonmarker/cmark/src/libcmark.pc.in +10 -0
  201. data/ext/commonmarker/cmark/src/main.c +191 -0
  202. data/ext/commonmarker/cmark/src/man.c +287 -0
  203. data/ext/commonmarker/cmark/src/node.c +873 -0
  204. data/ext/commonmarker/cmark/src/node.h +82 -0
  205. data/ext/commonmarker/cmark/src/parser.h +29 -0
  206. data/ext/commonmarker/cmark/src/references.c +154 -0
  207. data/ext/commonmarker/cmark/src/references.h +37 -0
  208. data/ext/commonmarker/cmark/src/scanners.c +15291 -0
  209. data/ext/commonmarker/cmark/src/scanners.h +41 -0
  210. data/ext/commonmarker/cmark/src/scanners.re +247 -0
  211. data/ext/commonmarker/cmark/src/utf8.c +452 -0
  212. data/ext/commonmarker/cmark/src/utf8.h +22 -0
  213. data/ext/commonmarker/cmark/src/xml.c +170 -0
  214. data/ext/commonmarker/cmark/test/CMakeLists.txt +53 -0
  215. data/ext/commonmarker/cmark/test/afl_dictionary/asterisk +1 -0
  216. data/ext/commonmarker/cmark/test/afl_dictionary/attr_generic +1 -0
  217. data/ext/commonmarker/cmark/test/afl_dictionary/attr_href +1 -0
  218. data/ext/commonmarker/cmark/test/afl_dictionary/attr_xml_lang +1 -0
  219. data/ext/commonmarker/cmark/test/afl_dictionary/attr_xmlns +1 -0
  220. data/ext/commonmarker/cmark/test/afl_dictionary/backslash +1 -0
  221. data/ext/commonmarker/cmark/test/afl_dictionary/backtick +1 -0
  222. data/ext/commonmarker/cmark/test/afl_dictionary/colon +1 -0
  223. data/ext/commonmarker/cmark/test/afl_dictionary/dashes +1 -0
  224. data/ext/commonmarker/cmark/test/afl_dictionary/double_quote +1 -0
  225. data/ext/commonmarker/cmark/test/afl_dictionary/entity_builtin +1 -0
  226. data/ext/commonmarker/cmark/test/afl_dictionary/entity_decimal +1 -0
  227. data/ext/commonmarker/cmark/test/afl_dictionary/entity_external +1 -0
  228. data/ext/commonmarker/cmark/test/afl_dictionary/entity_hex +1 -0
  229. data/ext/commonmarker/cmark/test/afl_dictionary/equals +1 -0
  230. data/ext/commonmarker/cmark/test/afl_dictionary/exclamation +1 -0
  231. data/ext/commonmarker/cmark/test/afl_dictionary/greater_than +1 -0
  232. data/ext/commonmarker/cmark/test/afl_dictionary/hash +1 -0
  233. data/ext/commonmarker/cmark/test/afl_dictionary/hyphen +0 -0
  234. data/ext/commonmarker/cmark/test/afl_dictionary/indent +1 -0
  235. data/ext/commonmarker/cmark/test/afl_dictionary/left_bracket +1 -0
  236. data/ext/commonmarker/cmark/test/afl_dictionary/left_paren +1 -0
  237. data/ext/commonmarker/cmark/test/afl_dictionary/less_than +1 -0
  238. data/ext/commonmarker/cmark/test/afl_dictionary/plus +1 -0
  239. data/ext/commonmarker/cmark/test/afl_dictionary/right_bracket +1 -0
  240. data/ext/commonmarker/cmark/test/afl_dictionary/right_paren +1 -0
  241. data/ext/commonmarker/cmark/test/afl_dictionary/single_quote +1 -0
  242. data/ext/commonmarker/cmark/test/afl_dictionary/string_any +1 -0
  243. data/ext/commonmarker/cmark/test/afl_dictionary/string_brackets +1 -0
  244. data/ext/commonmarker/cmark/test/afl_dictionary/string_cdata +1 -0
  245. data/ext/commonmarker/cmark/test/afl_dictionary/string_dashes +1 -0
  246. data/ext/commonmarker/cmark/test/afl_dictionary/string_empty_dblquotes +1 -0
  247. data/ext/commonmarker/cmark/test/afl_dictionary/string_empty_quotes +1 -0
  248. data/ext/commonmarker/cmark/test/afl_dictionary/string_idrefs +1 -0
  249. data/ext/commonmarker/cmark/test/afl_dictionary/string_parentheses +1 -0
  250. data/ext/commonmarker/cmark/test/afl_dictionary/string_pcdata +1 -0
  251. data/ext/commonmarker/cmark/test/afl_dictionary/tag_cdata +1 -0
  252. data/ext/commonmarker/cmark/test/afl_dictionary/tag_close +1 -0
  253. data/ext/commonmarker/cmark/test/afl_dictionary/tag_doctype +1 -0
  254. data/ext/commonmarker/cmark/test/afl_dictionary/tag_element +1 -0
  255. data/ext/commonmarker/cmark/test/afl_dictionary/tag_entity +1 -0
  256. data/ext/commonmarker/cmark/test/afl_dictionary/tag_notation +1 -0
  257. data/ext/commonmarker/cmark/test/afl_dictionary/tag_open +1 -0
  258. data/ext/commonmarker/cmark/test/afl_dictionary/tag_open_close +1 -0
  259. data/ext/commonmarker/cmark/test/afl_dictionary/tag_open_exclamation +1 -0
  260. data/ext/commonmarker/cmark/test/afl_dictionary/tag_open_q +1 -0
  261. data/ext/commonmarker/cmark/test/afl_dictionary/tag_sq2_close +1 -0
  262. data/ext/commonmarker/cmark/test/afl_dictionary/tag_xml_q +1 -0
  263. data/ext/commonmarker/cmark/test/afl_dictionary/underscore +1 -0
  264. data/ext/commonmarker/cmark/test/afl_test_cases/test.md +36 -0
  265. data/ext/commonmarker/cmark/test/cmark.py +40 -0
  266. data/ext/commonmarker/cmark/test/normalize.py +179 -0
  267. data/ext/commonmarker/cmark/test/pathological_tests.py +63 -0
  268. data/ext/commonmarker/cmark/test/roundtrip.sh +2 -0
  269. data/ext/commonmarker/cmark/test/smart_punct.txt +96 -0
  270. data/ext/commonmarker/cmark/test/spec.txt +7505 -0
  271. data/ext/commonmarker/cmark/test/spec_tests.py +139 -0
  272. data/ext/commonmarker/cmark/toolchain-mingw32.cmake +17 -0
  273. data/ext/commonmarker/cmark/tools/mkcasefold.pl +22 -0
  274. data/ext/commonmarker/cmark/wrappers/wrapper.lua +239 -0
  275. data/ext/commonmarker/cmark/wrappers/wrapper.py +37 -0
  276. data/ext/commonmarker/cmark/wrappers/wrapper.rb +15 -0
  277. data/ext/commonmarker/cmark/wrappers/wrapper.rkt +190 -0
  278. data/ext/commonmarker/commonmarker.c +165 -0
  279. data/ext/commonmarker/commonmarker.h +11 -0
  280. data/ext/commonmarker/extconf.rb +18 -0
  281. data/lib/commonmarker/config.rb +20 -0
  282. data/lib/commonmarker/version.rb +3 -0
  283. data/lib/commonmarker.rb +588 -0
  284. data/test/benchmark.rb +30 -0
  285. data/test/spec_tests.json +4074 -0
  286. data/test/test_basics.rb +44 -0
  287. data/test/test_helper.rb +5 -0
  288. data/test/test_maliciousness.rb +9 -0
  289. data/test/test_pathological_inputs.rb +52 -0
  290. data/test/test_spec.rb +20 -0
  291. metadata +399 -0
@@ -0,0 +1,170 @@
1
+ SRCDIR=src
2
+ DATADIR=data
3
+ BUILDDIR?=build
4
+ GENERATOR?=Unix Makefiles
5
+ MINGW_BUILDDIR?=build-mingw
6
+ MINGW_INSTALLDIR?=windows
7
+ SPEC=test/spec.txt
8
+ SITE=_site
9
+ SPECVERSION=$(shell perl -ne 'print $$1 if /^version: *([0-9.]+)/' $(SPEC))
10
+ FUZZCHARS?=2000000 # for fuzztest
11
+ BENCHDIR=bench
12
+ BENCHFILE=$(BENCHDIR)/benchinput.md
13
+ ALLTESTS=alltests.md
14
+ NUMRUNS?=10
15
+ CMARK=$(BUILDDIR)/src/cmark
16
+ PROG?=$(CMARK)
17
+ BENCHINP?=README.md
18
+ VERSION?=$(SPECVERSION)
19
+ RELEASE?=CommonMark-$(VERSION)
20
+ INSTALL_PREFIX?=/usr/local
21
+
22
+ .PHONY: all cmake_build spec leakcheck clean fuzztest dingus upload test update-site upload-site debug asan mingw archive bench astyle update-spec afl
23
+
24
+ all: cmake_build man/man3/cmark.3
25
+
26
+ $(CMARK): cmake_build
27
+
28
+ cmake_build: $(BUILDDIR)
29
+ @make -j2 -C $(BUILDDIR)
30
+ @echo "Binaries can be found in $(BUILDDIR)/src"
31
+
32
+ $(BUILDDIR):
33
+ @cmake --version > /dev/null || (echo "You need cmake to build this program: http://www.cmake.org/download/" && exit 1)
34
+ mkdir -p $(BUILDDIR); \
35
+ cd $(BUILDDIR); \
36
+ cmake .. \
37
+ -G "$(GENERATOR)" \
38
+ -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
39
+ -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)
40
+
41
+ install: $(BUILDDIR)
42
+ make -C $(BUILDDIR) install
43
+
44
+ debug:
45
+ mkdir -p $(BUILDDIR); \
46
+ cd $(BUILDDIR); \
47
+ cmake .. -DCMAKE_BUILD_TYPE=Debug; \
48
+ make
49
+
50
+ asan:
51
+ mkdir -p $(BUILDDIR); \
52
+ cd $(BUILDDIR); \
53
+ cmake .. -DCMAKE_BUILD_TYPE=Asan; \
54
+ make
55
+
56
+ prof:
57
+ mkdir -p $(BUILDDIR); \
58
+ cd $(BUILDDIR); \
59
+ cmake .. -DCMAKE_BUILD_TYPE=Profile; \
60
+ make
61
+
62
+ afl:
63
+ @[ -n "$(AFL_PATH)" ] || { echo '$$AFL_PATH not set'; false; }
64
+ mkdir -p $(BUILDDIR)
65
+ cd $(BUILDDIR) && cmake .. -DCMAKE_C_COMPILER=$(AFL_PATH)/afl-gcc
66
+ make
67
+ $(AFL_PATH)/afl-fuzz \
68
+ -i test/afl_test_cases \
69
+ -o test/afl_results \
70
+ -x test/afl_dictionary \
71
+ -t 100 \
72
+ -m none \
73
+ $(CMARK)
74
+
75
+ mingw:
76
+ mkdir -p $(MINGW_BUILDDIR); \
77
+ cd $(MINGW_BUILDDIR); \
78
+ cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$(MINGW_INSTALLDIR) ;\
79
+ make && make install
80
+
81
+ man/man3/cmark.3: src/cmark.h | $(CMARK)
82
+ python man/make_man_page.py $< > $@ \
83
+
84
+ archive:
85
+ git archive --prefix=$(RELEASE)/ -o $(RELEASE).tar.gz HEAD
86
+ git archive --prefix=$(RELEASE)/ -o $(RELEASE).zip HEAD
87
+
88
+ clean:
89
+ rm -rf $(BUILDDIR) $(MINGW_BUILDDIR) $(MINGW_INSTALLDIR)
90
+
91
+ # We include html_unescape.h in the repository, so this shouldn't
92
+ # normally need to be generated.
93
+ $(SRCDIR)/html_unescape.h: $(SRCDIR)/html_unescape.gperf
94
+ gperf -L ANSI-C -I -t -N find_entity -H hash_entity -K entity -C -l \
95
+ -F ',{0}' --null-strings -m5 -P -Q entity_pool $< > $@
96
+
97
+ # We include case_fold_switch.inc in the repository, so this shouldn't
98
+ # normally need to be generated.
99
+ $(SRCDIR)/case_fold_switch.inc: $(DATADIR)/CaseFolding-3.2.0.txt
100
+ perl tools/mkcasefold.pl < $< > $@
101
+
102
+ # We include scanners.c in the repository, so this shouldn't
103
+ # normally need to be generated.
104
+ $(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
105
+ @case "$$(re2c -v)" in \
106
+ *\ 0.13.7*|*\ 0.14|*\ 0.14.1) \
107
+ echo "re2c versions 0.13.7 through 0.14.1 are known to produce buggy code."; \
108
+ echo "Try a version >= 0.14.2 or <= 0.13.6."; \
109
+ false; \
110
+ ;; \
111
+ esac
112
+ re2c --case-insensitive -b -i --no-generation-date -o $@ $<
113
+
114
+ update-spec:
115
+ curl 'https://raw.githubusercontent.com/jgm/CommonMark/master/spec.txt'\
116
+ > $(SPEC)
117
+
118
+ test: $(SPEC) cmake_build
119
+ make -C $(BUILDDIR) test || (cat $(BUILDDIR)/Testing/Temporary/LastTest.log && exit 1)
120
+
121
+ roundtrip_test: $(SPEC) cmake_build
122
+ python3 test/spec_tests.py --spec $< --prog test/roundtrip.sh
123
+
124
+ $(ALLTESTS): $(SPEC)
125
+ python3 test/spec_tests.py --spec $< --dump-tests | python3 -c 'import json; import sys; tests = json.loads(sys.stdin.read()); print("\n".join([test["markdown"] for test in tests]))' > $@
126
+
127
+ leakcheck: $(ALLTESTS)
128
+ rc=0; \
129
+ for format in html man xml commonmark; do \
130
+ for opts in "" "--smart" "--normalize"; do \
131
+ echo "cmark -t $$format $$opts" ; \
132
+ cat $< | valgrind -q --leak-check=full --dsymutil=yes --error-exitcode=1 $(PROG) -t $$format $$opts >/dev/null || rc=1; \
133
+ done; \
134
+ done; \
135
+ exit $$rc
136
+
137
+ fuzztest:
138
+ { for i in `seq 1 10`; do \
139
+ cat /dev/urandom | head -c $(FUZZCHARS) | iconv -f latin1 -t utf-8 | tee fuzz-$$i.txt | \
140
+ /usr/bin/env time -p $(PROG) >/dev/null && rm fuzz-$$i.txt ; \
141
+ done } 2>&1 | grep 'user\|abnormally'
142
+
143
+ progit:
144
+ git clone https://github.com/progit/progit.git
145
+
146
+ $(BENCHFILE): progit
147
+ echo "" > $@
148
+ for lang in ar az be ca cs de en eo es es-ni fa fi fr hi hu id it ja ko mk nl no-nb pl pt-br ro ru sr th tr uk vi zh zh-tw; do \
149
+ cat progit/$$lang/*/*.markdown >> $@; \
150
+ done
151
+
152
+ bench: $(BENCHFILE)
153
+ { sudo renice 99 $$$$; \
154
+ for x in `seq 1 $(NUMRUNS)` ; do \
155
+ /usr/bin/env time -p $(PROG) </dev/null >/dev/null ; \
156
+ /usr/bin/env time -p $(PROG) $< >/dev/null ; \
157
+ done \
158
+ } 2>&1 | grep 'real' | awk '{print $$2}' | python3 'bench/stats.py'
159
+
160
+ astyle:
161
+ astyle --style=linux -t -p -r 'src/*.c' --exclude=scanners.c
162
+ astyle --style=linux -t -p -r 'src/*.h' --exclude=html_unescape.h
163
+
164
+ operf: $(CMARK)
165
+ operf $< < $(BENCHINP) > /dev/null
166
+
167
+ distclean: clean
168
+ -rm -rf *.dSYM
169
+ -rm -f README.html
170
+ -rm -rf $(BENCHFILE) $(ALLTESTS) progit
@@ -0,0 +1,36 @@
1
+ SRCDIR=src
2
+ DATADIR=data
3
+ BUILDDIR=build
4
+ INSTALLDIR=windows
5
+ SPEC=test/spec.txt
6
+ PROG=$(BUILDDIR)\src\cmark.exe
7
+ GENERATOR=NMake Makefiles
8
+
9
+ all: $(BUILDDIR)
10
+ @cd $(BUILDDIR) && $(MAKE) /nologo && cd ..
11
+
12
+ $(BUILDDIR):
13
+ @-mkdir $(BUILDDIR) 2> nul
14
+ cd $(BUILDDIR) && \
15
+ cmake \
16
+ -G "$(GENERATOR)" \
17
+ -D CMAKE_BUILD_TYPE=$(BUILD_TYPE) \
18
+ -D CMAKE_INSTALL_PREFIX=$(INSTALLDIR) \
19
+ .. && \
20
+ cd ..
21
+
22
+ install: all
23
+ @cd $(BUILDDIR) && $(MAKE) /nologo install && cd ..
24
+
25
+ clean:
26
+ -rmdir /s /q $(BUILDDIR) $(MINGW_INSTALLDIR) 2> nul
27
+
28
+ $(SRCDIR)\case_fold_switch.inc: $(DATADIR)\CaseFolding-3.2.0.txt
29
+ perl mkcasefold.pl < $? > $@
30
+
31
+ test: $(SPEC) all
32
+ @cd $(BUILDDIR) && $(MAKE) /nologo test ARGS="-V" && cd ..
33
+
34
+ distclean: clean
35
+ del /q src\scanners.c 2> nul
36
+ del /q spec.md spec.html 2> nul
@@ -0,0 +1,169 @@
1
+ cmark
2
+ =====
3
+
4
+ [![Build Status]](https://travis-ci.org/jgm/cmark)
5
+ [![Windows Build Status]](https://ci.appveyor.com/project/jgm/cmark)
6
+
7
+ `cmark` is the C reference implementation of [CommonMark], a
8
+ rationalized version of Markdown syntax with a [spec][the spec].
9
+ (For the JavaScript reference implementation, see
10
+ [commonmark.js].)
11
+
12
+ It provides a shared library (`libcmark`) with functions for parsing
13
+ CommonMark documents to an abstract syntax tree (AST), manipulating
14
+ the AST, and rendering the document to HTML, groff man,
15
+ CommonMark, or an XML representation of the AST. It also provides a
16
+ command-line program (`cmark`) for parsing and rendering CommonMark
17
+ documents.
18
+
19
+ Advantages of this library:
20
+
21
+ - **Portable.** The library and program are written in standard
22
+ C99 and have no external dependencies. It has been tested with
23
+ MSVC, gcc, tcc, and clang.
24
+
25
+ - **Fast.** Performance is on par with the fastest existing
26
+ Markdown parser, [sundown]: see the [benchmarks].
27
+
28
+ - **Accurate.** The library passes all CommonMark conformance tests.
29
+
30
+ - **Standardized.** The library can be expected to parse CommonMark
31
+ the same way as any other conforming parser. So, for example,
32
+ you can use `commonmark.js` on the client to preview content that
33
+ will be rendered on the server using `cmark`.
34
+
35
+ - **Robust.** The library has been extensively fuzz-tested using
36
+ american fuzzy lop. The test suite includes pathological cases
37
+ that bring many other Markdown parsers to a crawl (for example,
38
+ thousands-deep nested bracketed text or block quotes).
39
+
40
+ - **Flexible.** CommonMark input is parsed to an AST which can be
41
+ manipulated programatically prior to rendering.
42
+
43
+ - **Multiple renderers.** Output in HTML, groff man, CommonMark,
44
+ and a custom XML format is supported. And it is easy to write new
45
+ renderers to support other formats.
46
+
47
+ - **Free.** BSD2-licensed.
48
+
49
+ It is easy to use `libcmark` in python, lua, ruby, and other dynamic
50
+ languages: see the `wrappers/` subdirectory for some simple examples.
51
+
52
+ There are also libraries that wrap `libcmark` for
53
+ [go](https://github.com/rhinoman/go-commonmark),
54
+ [Haskell](http://hackage.haskell.org/package/cmark),
55
+ and [Perl](https://metacpan.org/release/CommonMark).
56
+
57
+ Installing
58
+ ----------
59
+
60
+ Building the C program (`cmark`) and shared library (`libcmark`)
61
+ requires [cmake]. If you modify `scanners.re`, then you will also
62
+ need [re2c], which is used to generate `scanners.c` from
63
+ `scanners.re`. We have included a pre-generated `scanners.c` in
64
+ the repository to reduce build dependencies.
65
+
66
+ If you have GNU make, you can simply `make`, `make test`, and `make
67
+ install`. This calls [cmake] to create a `Makefile` in the `build`
68
+ directory, then uses that `Makefile` to create the executable and
69
+ library. The binaries can be found in `build/src`. The default
70
+ installation prefix is `/usr/local`. To change the installation
71
+ prefix, pass the `INSTALL_PREFIX` variable if you run `make` for the
72
+ first time: `make INSTALL_PREFIX=path`.
73
+
74
+ For a more portable method, you can use [cmake] manually. [cmake] knows
75
+ how to create build environments for many build systems. For example,
76
+ on FreeBSD:
77
+
78
+ mkdir build
79
+ cd build
80
+ cmake .. # optionally: -DCMAKE_INSTALL_PREFIX=path
81
+ make # executable will be created as build/src/cmark
82
+ make test
83
+ make install
84
+
85
+ Or, to create Xcode project files on OSX:
86
+
87
+ mkdir build
88
+ cd build
89
+ cmake -G Xcode ..
90
+ open cmark.xcodeproj
91
+
92
+ The GNU Makefile also provides a few other targets for developers.
93
+ To run a benchmark:
94
+
95
+ make bench
96
+
97
+ To run a "fuzz test" against ten long randomly generated inputs:
98
+
99
+ make fuzztest
100
+
101
+ To run a test for memory leaks using `valgrind`:
102
+
103
+ make leakcheck
104
+
105
+ To reformat source code using `astyle`:
106
+
107
+ make astyle
108
+
109
+ To make a release tarball and zip archive:
110
+
111
+ make archive
112
+
113
+ Installing (Windows)
114
+ --------------------
115
+
116
+ To compile with MSVC and NMAKE:
117
+
118
+ nmake
119
+
120
+ You can cross-compile a Windows binary and dll on linux if you have the
121
+ `mingw32` compiler:
122
+
123
+ make mingw
124
+
125
+ The binaries will be in `build-mingw/windows/bin`.
126
+
127
+ Usage
128
+ -----
129
+
130
+ Instructions for the use of the command line program and library can
131
+ be found in the man pages in the `man` subdirectory.
132
+
133
+ **A note on security:**
134
+ This library does not attempt to sanitize link attributes or
135
+ raw HTML. If you use it in applications that accept
136
+ untrusted user input, you must run the output through an HTML
137
+ sanitizer to protect against
138
+ [XSS attacks](http://en.wikipedia.org/wiki/Cross-site_scripting).
139
+
140
+ Contributing
141
+ ------------
142
+
143
+ There is a [forum for discussing
144
+ CommonMark](http://talk.commonmark.org); you should use it instead of
145
+ github issues for questions and possibly open-ended discussions.
146
+ Use the [github issue tracker](http://github.com/jgm/CommonMark/issues)
147
+ only for simple, clear, actionable issues.
148
+
149
+ Authors
150
+ -------
151
+
152
+ John MacFarlane wrote the original library and program.
153
+ The block parsing algorithm was worked out together with David
154
+ Greenspan. Vicent Marti optimized the C implementation for
155
+ performance, increasing its speed tenfold. Kārlis Gaņģis helped
156
+ work out a better parsing algorithm for links and emphasis,
157
+ eliminating several worst-case performance issues.
158
+ Nick Wellnhofer contributed many improvements, including
159
+ most of the C library's API and its test harness.
160
+
161
+ [sundown]: https://github.com/vmg/sundown
162
+ [benchmarks]: benchmarks.md
163
+ [the spec]: http://spec.commonmark.org
164
+ [CommonMark]: http://commonmark.org
165
+ [cmake]: http://www.cmake.org/download/
166
+ [re2c]: http://re2c.org
167
+ [commonmark.js]: https://github.com/jgm/commonmark.js
168
+ [Build Status]: https://img.shields.io/travis/jgm/cmark/master.svg?style=flat
169
+ [Windows Build Status]: https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true
@@ -0,0 +1,25 @@
1
+ add_executable(api_test
2
+ cplusplus.cpp
3
+ harness.c
4
+ harness.h
5
+ main.c
6
+ )
7
+ include_directories(
8
+ ${PROJECT_SOURCE_DIR}/src
9
+ ${PROJECT_BINARY_DIR}/src
10
+ )
11
+ target_link_libraries(api_test libcmark)
12
+
13
+ # Compiler flags
14
+ if(MSVC)
15
+ # Force to always compile with W4
16
+ if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
17
+ string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
18
+ else()
19
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
20
+ endif()
21
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127 /wd4244 /wd4267 /wd4706 /wd4800 /D_CRT_SECURE_NO_WARNINGS")
22
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /TP")
23
+ elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
24
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99 -pedantic")
25
+ endif()
@@ -0,0 +1,15 @@
1
+ #include <cstdlib>
2
+
3
+ #include "cmark.h"
4
+ #include "cplusplus.h"
5
+ #include "harness.h"
6
+
7
+ void
8
+ test_cplusplus(test_batch_runner *runner)
9
+ {
10
+ static const char md[] = "paragraph\n";
11
+ char *html = cmark_markdown_to_html(md, sizeof(md) - 1, CMARK_OPT_DEFAULT);
12
+ STR_EQ(runner, html, "<p>paragraph</p>\n", "libcmark works with C++");
13
+ free(html);
14
+ }
15
+
@@ -0,0 +1,17 @@
1
+ #ifndef CMARK_API_TEST_CPLUSPLUS_H
2
+ #define CMARK_API_TEST_CPLUSPLUS_H
3
+
4
+ #include "harness.h"
5
+
6
+ #ifdef __cplusplus
7
+ extern "C" {
8
+ #endif
9
+
10
+ void
11
+ test_cplusplus(test_batch_runner *runner);
12
+
13
+ #ifdef __cplusplus
14
+ }
15
+ #endif
16
+
17
+ #endif
@@ -0,0 +1,102 @@
1
+ #include <stdarg.h>
2
+ #include <stdio.h>
3
+ #include <stdlib.h>
4
+ #include <string.h>
5
+
6
+ #include "harness.h"
7
+
8
+ test_batch_runner*
9
+ test_batch_runner_new()
10
+ {
11
+ return (test_batch_runner *)calloc(1, sizeof(test_batch_runner));
12
+ }
13
+
14
+ static void
15
+ test_result(test_batch_runner *runner, int cond, const char *msg, va_list ap)
16
+ {
17
+ ++runner->test_num;
18
+
19
+ if (cond) {
20
+ ++runner->num_passed;
21
+ }
22
+ else {
23
+ fprintf(stderr, "FAILED test %d: ", runner->test_num);
24
+ vfprintf(stderr, msg, ap);
25
+ fprintf(stderr, "\n");
26
+ ++runner->num_failed;
27
+ }
28
+ }
29
+
30
+ void
31
+ SKIP(test_batch_runner *runner, int num_tests)
32
+ {
33
+ runner->test_num += num_tests;
34
+ runner->num_skipped += num_tests;
35
+ }
36
+
37
+ void
38
+ OK(test_batch_runner *runner, int cond, const char *msg, ...)
39
+ {
40
+ va_list ap;
41
+ va_start(ap, msg);
42
+ test_result(runner, cond, msg, ap);
43
+ va_end(ap);
44
+ }
45
+
46
+ void
47
+ INT_EQ(test_batch_runner *runner, int got, int expected, const char *msg, ...)
48
+ {
49
+ int cond = got == expected;
50
+
51
+ va_list ap;
52
+ va_start(ap, msg);
53
+ test_result(runner, cond, msg, ap);
54
+ va_end(ap);
55
+
56
+ if (!cond) {
57
+ fprintf(stderr, " Got: %d\n", got);
58
+ fprintf(stderr, " Expected: %d\n", expected);
59
+ }
60
+ }
61
+
62
+ void
63
+ STR_EQ(test_batch_runner *runner, const char *got, const char *expected,
64
+ const char *msg, ...)
65
+ {
66
+ int cond = strcmp(got, expected) == 0;
67
+
68
+ va_list ap;
69
+ va_start(ap, msg);
70
+ test_result(runner, cond, msg, ap);
71
+ va_end(ap);
72
+
73
+ if (!cond) {
74
+ fprintf(stderr, " Got: \"%s\"\n", got);
75
+ fprintf(stderr, " Expected: \"%s\"\n", expected);
76
+ }
77
+ }
78
+
79
+ int
80
+ test_ok(test_batch_runner *runner)
81
+ {
82
+ return runner->num_failed == 0;
83
+ }
84
+
85
+ void
86
+ test_print_summary(test_batch_runner *runner)
87
+ {
88
+ int num_passed = runner->num_passed;
89
+ int num_skipped = runner->num_skipped;
90
+ int num_failed = runner->num_failed;
91
+
92
+ fprintf(stderr, "%d tests passed, %d failed, %d skipped\n",
93
+ num_passed, num_failed, num_skipped);
94
+
95
+ if (test_ok(runner)) {
96
+ fprintf(stderr, "PASS\n");
97
+ }
98
+ else {
99
+ fprintf(stderr, "FAIL\n");
100
+ }
101
+ }
102
+
@@ -0,0 +1,42 @@
1
+ #ifndef CMARK_API_TEST_HARNESS_H
2
+ #define CMARK_API_TEST_HARNESS_H
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ typedef struct {
9
+ int test_num;
10
+ int num_passed;
11
+ int num_failed;
12
+ int num_skipped;
13
+ } test_batch_runner;
14
+
15
+ test_batch_runner*
16
+ test_batch_runner_new();
17
+
18
+ void
19
+ SKIP(test_batch_runner *runner, int num_tests);
20
+
21
+ void
22
+ OK(test_batch_runner *runner, int cond, const char *msg, ...);
23
+
24
+ void
25
+ INT_EQ(test_batch_runner *runner, int got, int expected, const char *msg, ...);
26
+
27
+ void
28
+ STR_EQ(test_batch_runner *runner, const char *got, const char *expected,
29
+ const char *msg, ...);
30
+
31
+ int
32
+ test_ok(test_batch_runner *runner);
33
+
34
+ void
35
+ test_print_summary(test_batch_runner *runner);
36
+
37
+ #ifdef __cplusplus
38
+ }
39
+ #endif
40
+
41
+ #endif
42
+