cairo 1.6.1-x86-mswin32 → 1.7.0-x86-mswin32

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

Potentially problematic release.


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

Files changed (410) hide show
  1. data/ChangeLog +285 -0
  2. data/NEWS +33 -0
  3. data/README +15 -4
  4. data/Rakefile +3 -0
  5. data/cairo/bin/libcairo-2.dll +0 -0
  6. data/cairo/bin/libpng12-0.dll +0 -0
  7. data/cairo/include/{libpng13/png.h → png.h} +285 -135
  8. data/cairo/include/{libpng13/pngconf.h → pngconf.h} +116 -72
  9. data/cairo/lib/cairo.lib +0 -0
  10. data/cairo/lib/libcairo.dll.a +0 -0
  11. data/cairo/lib/libpng.def +361 -371
  12. data/cairo/lib/libpng.lib +0 -0
  13. data/cairo/lib/libpng12.dll.a +0 -0
  14. data/cairo/lib/pkgconfig/cairo-pdf.pc +1 -1
  15. data/cairo/lib/pkgconfig/cairo-png.pc +2 -2
  16. data/cairo/lib/pkgconfig/cairo-ps.pc +1 -1
  17. data/cairo/lib/pkgconfig/cairo-svg.pc +1 -1
  18. data/cairo/lib/pkgconfig/cairo-win32-font.pc +1 -1
  19. data/cairo/lib/pkgconfig/cairo-win32.pc +1 -1
  20. data/cairo/lib/pkgconfig/cairo.pc +2 -2
  21. data/cairo/lib/pkgconfig/libpng.pc +10 -14
  22. data/cairo/lib/pkgconfig/libpng12.pc +10 -0
  23. data/cairo/make/{cairo-1.6.4-1.sh → cairo-1.6.4-2.sh} +3 -3
  24. data/cairo/make/libpng-1.2.29.sh +35 -0
  25. data/cairo/manifest/cairo-1.6.4-2.mft +6 -0
  26. data/cairo/manifest/{cairo-dev-1.6.4-1.mft → cairo-dev-1.6.4-2.mft} +2 -2
  27. data/cairo/manifest/libpng-1.2.29.mft +2 -0
  28. data/cairo/manifest/libpng-dev-1.2.29.mft +12 -0
  29. data/cairo/share/doc/{cairo-1.6.4-1 → cairo-1.6.4-2}/COPYING +0 -0
  30. data/cairo/share/doc/{cairo-1.6.4-1 → cairo-1.6.4-2}/COPYING-LGPL-2.1 +0 -0
  31. data/cairo/share/doc/{cairo-1.6.4-1 → cairo-1.6.4-2}/COPYING-MPL-1.1 +0 -0
  32. data/cairo/share/man/man3/libpng.3 +3680 -0
  33. data/cairo/share/man/man3/libpngpf.3 +274 -0
  34. data/cairo/share/man/man5/png.5 +74 -0
  35. data/doc/en/cairo-antialias.html +0 -3
  36. data/doc/en/cairo-clip-not-representable-error.html +0 -3
  37. data/doc/en/cairo-color-base.html +0 -3
  38. data/doc/en/cairo-color-cmyk.html +0 -3
  39. data/doc/en/cairo-color-hsv.html +0 -3
  40. data/doc/en/cairo-color-rgb.html +0 -3
  41. data/doc/en/cairo-color-x11.html +0 -3
  42. data/doc/en/cairo-color.html +0 -3
  43. data/doc/en/cairo-content.html +0 -3
  44. data/doc/en/cairo-context-blur.html +0 -3
  45. data/doc/en/cairo-context-circle.html +0 -3
  46. data/doc/en/cairo-context-color.html +0 -3
  47. data/doc/en/cairo-context-path.html +0 -3
  48. data/doc/en/cairo-context-rectangle.html +0 -3
  49. data/doc/en/cairo-context-triangle.html +0 -3
  50. data/doc/en/cairo-context.html +119 -102
  51. data/doc/en/cairo-error.html +0 -3
  52. data/doc/en/cairo-extend.html +0 -3
  53. data/doc/en/cairo-file-not-found.html +0 -3
  54. data/doc/en/cairo-fill-rule.html +0 -3
  55. data/doc/en/cairo-filter.html +0 -3
  56. data/doc/en/cairo-font-extents.html +67 -12
  57. data/doc/en/cairo-font-face.html +0 -3
  58. data/doc/en/cairo-font-options.html +26 -14
  59. data/doc/en/cairo-font-slant.html +0 -3
  60. data/doc/en/cairo-font-type-mismatch.html +47 -0
  61. data/doc/en/cairo-font-weight.html +0 -3
  62. data/doc/en/cairo-format.html +0 -3
  63. data/doc/en/cairo-glyph.html +0 -3
  64. data/doc/en/cairo-gradient-pattern.html +0 -3
  65. data/doc/en/cairo-hint-metrics.html +0 -3
  66. data/doc/en/cairo-hint-style.html +0 -3
  67. data/doc/en/cairo-image-surface.html +0 -3
  68. data/doc/en/cairo-invalid-clusters.html +47 -0
  69. data/doc/en/cairo-invalid-content-error.html +0 -3
  70. data/doc/en/cairo-invalid-dash-error.html +0 -3
  71. data/doc/en/cairo-invalid-dsc-comment-error.html +0 -3
  72. data/doc/en/cairo-invalid-format-error.html +0 -3
  73. data/doc/en/cairo-invalid-index-error.html +0 -3
  74. data/doc/en/cairo-invalid-matrix-error.html +0 -3
  75. data/doc/en/cairo-invalid-path-data-error.html +0 -3
  76. data/doc/en/cairo-invalid-pop-group-error.html +0 -3
  77. data/doc/en/cairo-invalid-restore-error.html +0 -3
  78. data/doc/en/cairo-invalid-slant.html +47 -0
  79. data/doc/en/cairo-invalid-status-error.html +0 -3
  80. data/doc/en/cairo-invalid-stride-error.html +0 -3
  81. data/doc/en/cairo-invalid-string-error.html +0 -3
  82. data/doc/en/cairo-invalid-visual-error.html +0 -3
  83. data/doc/en/cairo-invalid-weight.html +47 -0
  84. data/doc/en/cairo-lcd-filter.html +39 -0
  85. data/doc/en/cairo-line-cap.html +0 -3
  86. data/doc/en/cairo-line-join.html +0 -3
  87. data/doc/en/cairo-linear-pattern.html +0 -3
  88. data/doc/en/cairo-matrix.html +43 -41
  89. data/doc/en/cairo-negative-count.html +47 -0
  90. data/doc/en/cairo-no-current-point-error.html +0 -3
  91. data/doc/en/cairo-null-pointer-error.html +0 -3
  92. data/doc/en/cairo-operator.html +0 -3
  93. data/doc/en/cairo-paper-parse-error.html +0 -3
  94. data/doc/en/cairo-paper-unknown-paper-name.html +0 -3
  95. data/doc/en/cairo-paper-unknown-unit.html +0 -3
  96. data/doc/en/cairo-paper-unrecognized-paper-description.html +0 -3
  97. data/doc/en/cairo-paper.html +0 -3
  98. data/doc/en/cairo-path-close-path.html +0 -3
  99. data/doc/en/cairo-path-curve-to.html +0 -3
  100. data/doc/en/cairo-path-data-type.html +0 -3
  101. data/doc/en/cairo-path-data.html +0 -3
  102. data/doc/en/cairo-path-line-to.html +0 -3
  103. data/doc/en/cairo-path-move-to.html +0 -3
  104. data/doc/en/cairo-path.html +0 -3
  105. data/doc/en/cairo-pattern-type-mismatch-error.html +0 -3
  106. data/doc/en/cairo-pattern.html +0 -3
  107. data/doc/en/cairo-pdf-surface.html +0 -3
  108. data/doc/en/cairo-point.html +0 -3
  109. data/doc/en/cairo-ps-level.html +0 -3
  110. data/doc/en/cairo-ps-surface.html +0 -3
  111. data/doc/en/cairo-quartz-image-surface.html +0 -3
  112. data/doc/en/cairo-quartz-surface.html +0 -3
  113. data/doc/en/cairo-radial-pattern.html +0 -3
  114. data/doc/en/cairo-read-error.html +0 -3
  115. data/doc/en/cairo-rectangle.html +0 -3
  116. data/doc/en/cairo-scaled-font.html +13 -6
  117. data/doc/en/cairo-solid-pattern.html +0 -3
  118. data/doc/en/cairo-subpixel-order.html +0 -3
  119. data/doc/en/cairo-surface-finished-error.html +0 -3
  120. data/doc/en/cairo-surface-pattern.html +0 -3
  121. data/doc/en/cairo-surface-type-mismatch-error.html +0 -3
  122. data/doc/en/cairo-surface.html +22 -15
  123. data/doc/en/cairo-svg-surface.html +0 -3
  124. data/doc/en/cairo-svg-version.html +0 -3
  125. data/doc/en/cairo-temp-file-error.html +0 -3
  126. data/doc/en/cairo-text-cluster.html +84 -0
  127. data/doc/en/cairo-text-extents.html +78 -13
  128. data/doc/en/cairo-toy-font-face.html +67 -0
  129. data/doc/en/cairo-user-font-error.html +47 -0
  130. data/doc/en/cairo-user-font-face-text-to-glyphs-data.html +94 -0
  131. data/doc/en/cairo-user-font-face.html +72 -0
  132. data/doc/en/cairo-user-font-immutable.html +47 -0
  133. data/doc/en/cairo-win32-printing-surface.html +0 -3
  134. data/doc/en/cairo-win32-surface.html +0 -3
  135. data/doc/en/cairo-write-error.html +0 -3
  136. data/doc/en/cairo.html +92 -80
  137. data/doc/en/index.html +327 -240
  138. data/doc/ja/cairo-clip-not-representable-error.html +1 -1
  139. data/doc/ja/cairo-color-base.html +1 -1
  140. data/doc/ja/cairo-color-cmyk.html +9 -9
  141. data/doc/ja/cairo-color-hsv.html +8 -8
  142. data/doc/ja/cairo-color-rgb.html +9 -9
  143. data/doc/ja/cairo-color.html +8 -8
  144. data/doc/ja/cairo-context-circle.html +1 -1
  145. data/doc/ja/cairo-context-color.html +1 -1
  146. data/doc/ja/cairo-context-path.html +2 -2
  147. data/doc/ja/cairo-context.html +435 -342
  148. data/doc/ja/cairo-font-extents.html +69 -15
  149. data/doc/ja/cairo-font-face.html +3 -3
  150. data/doc/ja/cairo-font-options.html +37 -12
  151. data/doc/ja/cairo-font-slant.html +1 -1
  152. data/doc/ja/cairo-font-type-mismatch.html +52 -0
  153. data/doc/ja/cairo-glyph.html +5 -5
  154. data/doc/ja/cairo-gradient-pattern.html +6 -6
  155. data/doc/ja/cairo-image-surface.html +8 -8
  156. data/doc/ja/cairo-invalid-clusters.html +55 -0
  157. data/doc/ja/cairo-invalid-restore-error.html +1 -1
  158. data/doc/ja/cairo-invalid-slant.html +57 -0
  159. data/doc/ja/cairo-invalid-weight.html +57 -0
  160. data/doc/ja/cairo-lcd-filter.html +63 -0
  161. data/doc/ja/cairo-line-join.html +1 -1
  162. data/doc/ja/cairo-linear-pattern.html +2 -2
  163. data/doc/ja/cairo-matrix.html +35 -24
  164. data/doc/ja/cairo-negative-count.html +52 -0
  165. data/doc/ja/cairo-paper-unknown-paper-name.html +2 -2
  166. data/doc/ja/cairo-paper-unknown-unit.html +2 -2
  167. data/doc/ja/cairo-paper-unrecognized-paper-description.html +1 -1
  168. data/doc/ja/cairo-paper.html +12 -12
  169. data/doc/ja/cairo-path-close-path.html +1 -1
  170. data/doc/ja/cairo-path-curve-to.html +1 -1
  171. data/doc/ja/cairo-path-data.html +8 -8
  172. data/doc/ja/cairo-path-line-to.html +1 -1
  173. data/doc/ja/cairo-path-move-to.html +1 -1
  174. data/doc/ja/cairo-path.html +21 -21
  175. data/doc/ja/cairo-pattern.html +4 -4
  176. data/doc/ja/cairo-pdf-surface.html +2 -2
  177. data/doc/ja/cairo-point.html +5 -5
  178. data/doc/ja/cairo-ps-level.html +2 -2
  179. data/doc/ja/cairo-ps-surface.html +6 -6
  180. data/doc/ja/cairo-quartz-image-surface.html +2 -2
  181. data/doc/ja/cairo-quartz-surface.html +3 -3
  182. data/doc/ja/cairo-radial-pattern.html +2 -2
  183. data/doc/ja/cairo-rectangle.html +5 -5
  184. data/doc/ja/cairo-scaled-font.html +53 -17
  185. data/doc/ja/cairo-solid-pattern.html +3 -3
  186. data/doc/ja/cairo-surface-pattern.html +2 -2
  187. data/doc/ja/cairo-surface.html +58 -36
  188. data/doc/ja/cairo-svg-surface.html +4 -4
  189. data/doc/ja/cairo-svg-version.html +2 -2
  190. data/doc/ja/cairo-text-cluster.html +102 -0
  191. data/doc/ja/cairo-text-extents.html +84 -22
  192. data/doc/ja/cairo-toy-font-face.html +107 -0
  193. data/doc/ja/cairo-user-font-error.html +55 -0
  194. data/doc/ja/cairo-user-font-face-text-to-glyphs-data.html +155 -0
  195. data/doc/ja/cairo-user-font-face.html +268 -0
  196. data/doc/ja/cairo-user-font-immutable.html +54 -0
  197. data/doc/ja/cairo-win32-printing-surface.html +3 -3
  198. data/doc/ja/cairo-win32-surface.html +4 -4
  199. data/doc/ja/cairo.html +110 -77
  200. data/doc/ja/index.html +292 -205
  201. data/extconf.rb +3 -1
  202. data/misc/update-colors.rb +0 -0
  203. data/pkg-config.rb +54 -28
  204. data/samples/agg/aa_test.rb +0 -0
  205. data/samples/blur.rb +0 -0
  206. data/samples/png.rb +0 -0
  207. data/samples/scalable.rb +0 -0
  208. data/samples/text-on-path.rb +0 -0
  209. data/samples/text2.rb +0 -0
  210. data/src/cairo.def +8 -0
  211. data/src/cairo.so +0 -0
  212. data/src/lib/cairo.rb +12 -7
  213. data/src/lib/cairo/constants.rb +1 -0
  214. data/src/libruby-cairo.a +0 -0
  215. data/src/rb_cairo.c +25 -3
  216. data/src/rb_cairo.h +29 -18
  217. data/src/rb_cairo_constants.c +39 -10
  218. data/src/rb_cairo_context.c +156 -15
  219. data/src/rb_cairo_exception.c +143 -3
  220. data/src/rb_cairo_font_extents.c +81 -6
  221. data/src/rb_cairo_font_face.c +646 -4
  222. data/src/rb_cairo_font_options.c +24 -2
  223. data/src/rb_cairo_glyph.c +5 -3
  224. data/src/rb_cairo_matrix.c +17 -1
  225. data/src/rb_cairo_pattern.c +4 -4
  226. data/src/rb_cairo_private.c +169 -5
  227. data/src/rb_cairo_private.h +45 -3
  228. data/src/rb_cairo_scaled_font.c +61 -3
  229. data/src/rb_cairo_surface.c +174 -59
  230. data/src/rb_cairo_text_cluster.c +151 -0
  231. data/src/rb_cairo_text_extents.c +85 -2
  232. data/test-unit/Rakefile +30 -0
  233. data/test-unit/bin/testrb +5 -0
  234. data/test-unit/lib/test/unit.rb +280 -0
  235. data/test-unit/lib/test/unit/assertionfailederror.rb +14 -0
  236. data/test-unit/lib/test/unit/assertions.rb +722 -0
  237. data/test-unit/lib/test/unit/attribute.rb +125 -0
  238. data/test-unit/lib/test/unit/autorunner.rb +254 -0
  239. data/test-unit/lib/test/unit/collector.rb +43 -0
  240. data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
  241. data/test-unit/lib/test/unit/collector/dir.rb +108 -0
  242. data/test-unit/lib/test/unit/collector/load.rb +135 -0
  243. data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
  244. data/test-unit/lib/test/unit/color.rb +61 -0
  245. data/test-unit/lib/test/unit/diff.rb +524 -0
  246. data/test-unit/lib/test/unit/error.rb +124 -0
  247. data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
  248. data/test-unit/lib/test/unit/failure.rb +110 -0
  249. data/test-unit/lib/test/unit/fixture.rb +185 -0
  250. data/test-unit/lib/test/unit/notification.rb +125 -0
  251. data/test-unit/lib/test/unit/omission.rb +143 -0
  252. data/test-unit/lib/test/unit/pending.rb +146 -0
  253. data/test-unit/lib/test/unit/priority.rb +146 -0
  254. data/test-unit/lib/test/unit/runner/console.rb +46 -0
  255. data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
  256. data/test-unit/lib/test/unit/testcase.rb +281 -0
  257. data/test-unit/lib/test/unit/testresult.rb +89 -0
  258. data/test-unit/lib/test/unit/testsuite.rb +110 -0
  259. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
  260. data/test-unit/lib/test/unit/ui/console/testrunner.rb +195 -0
  261. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +49 -0
  262. data/test-unit/lib/test/unit/ui/testrunner.rb +20 -0
  263. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
  264. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
  265. data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
  266. data/test-unit/lib/test/unit/util/observable.rb +90 -0
  267. data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
  268. data/test-unit/lib/test/unit/version.rb +7 -0
  269. data/test-unit/sample/adder.rb +13 -0
  270. data/test-unit/sample/subtracter.rb +12 -0
  271. data/test-unit/sample/tc_adder.rb +18 -0
  272. data/test-unit/sample/tc_subtracter.rb +18 -0
  273. data/test-unit/sample/ts_examples.rb +7 -0
  274. data/test-unit/test/collector/test_descendant.rb +135 -0
  275. data/test-unit/test/collector/test_dir.rb +406 -0
  276. data/test-unit/test/collector/test_load.rb +333 -0
  277. data/test-unit/test/collector/test_objectspace.rb +98 -0
  278. data/test-unit/test/run-test.rb +13 -0
  279. data/test-unit/test/test_assertions.rb +693 -0
  280. data/test-unit/test/test_attribute.rb +86 -0
  281. data/test-unit/test/test_color.rb +37 -0
  282. data/test-unit/test/test_diff.rb +477 -0
  283. data/test-unit/test/test_emacs_runner.rb +60 -0
  284. data/test-unit/test/test_error.rb +26 -0
  285. data/test-unit/test/test_failure.rb +33 -0
  286. data/test-unit/test/test_fixture.rb +252 -0
  287. data/test-unit/test/test_notification.rb +33 -0
  288. data/test-unit/test/test_omission.rb +81 -0
  289. data/test-unit/test/test_pending.rb +70 -0
  290. data/test-unit/test/test_priority.rb +89 -0
  291. data/test-unit/test/test_testcase.rb +430 -0
  292. data/test-unit/test/test_testresult.rb +113 -0
  293. data/test-unit/test/test_testsuite.rb +129 -0
  294. data/test-unit/test/testunit_test_util.rb +14 -0
  295. data/test-unit/test/ui/test_testrunmediator.rb +20 -0
  296. data/test-unit/test/util/test_backtracefilter.rb +41 -0
  297. data/test-unit/test/util/test_observable.rb +102 -0
  298. data/test-unit/test/util/test_procwrapper.rb +36 -0
  299. data/test/cairo-test-utils.rb +18 -0
  300. data/test/run-test.rb +14 -1
  301. data/test/test_constants.rb +19 -0
  302. data/test/test_context.rb +117 -0
  303. data/test/test_exception.rb +27 -0
  304. data/test/test_font_extents.rb +36 -0
  305. data/test/test_font_face.rb +244 -0
  306. data/test/test_font_options.rb +32 -0
  307. data/test/test_pkg_config.rb +3 -2
  308. data/test/test_scaled_font.rb +34 -0
  309. data/test/test_surface.rb +41 -0
  310. data/test/test_text_cluster.rb +32 -0
  311. data/test/test_text_extents.rb +40 -0
  312. data/test/test_text_to_glyphs_data.rb +47 -0
  313. metadata +129 -109
  314. data/cairo/bin/libpng13.dll +0 -0
  315. data/cairo/lib/libpng13.dll.a +0 -0
  316. data/cairo/lib/pkgconfig/libpng13.pc +0 -14
  317. data/cairo/manifest/cairo-1.6.4-1.mft +0 -6
  318. data/cairo/manifest/libpng-dev-1.2.8.mft +0 -7
  319. data/doc/en/cairo-antialias.rd +0 -16
  320. data/doc/en/cairo-clip-not-representable-error.rd +0 -17
  321. data/doc/en/cairo-color-base.rd +0 -38
  322. data/doc/en/cairo-color-cmyk.rd +0 -107
  323. data/doc/en/cairo-color-hsv.rd +0 -91
  324. data/doc/en/cairo-color-rgb.rd +0 -95
  325. data/doc/en/cairo-color-x11.rd +0 -151
  326. data/doc/en/cairo-color.rd +0 -213
  327. data/doc/en/cairo-content.rd +0 -15
  328. data/doc/en/cairo-context-blur.rd +0 -15
  329. data/doc/en/cairo-context-circle.rd +0 -15
  330. data/doc/en/cairo-context-color.rd +0 -15
  331. data/doc/en/cairo-context-path.rd +0 -19
  332. data/doc/en/cairo-context-rectangle.rd +0 -15
  333. data/doc/en/cairo-context-triangle.rd +0 -15
  334. data/doc/en/cairo-context.rd +0 -491
  335. data/doc/en/cairo-error.rd +0 -16
  336. data/doc/en/cairo-extend.rd +0 -16
  337. data/doc/en/cairo-file-not-found.rd +0 -17
  338. data/doc/en/cairo-fill-rule.rd +0 -14
  339. data/doc/en/cairo-filter.rd +0 -18
  340. data/doc/en/cairo-font-extents.rd +0 -40
  341. data/doc/en/cairo-font-face.rd +0 -14
  342. data/doc/en/cairo-font-options.rd +0 -94
  343. data/doc/en/cairo-font-slant.rd +0 -15
  344. data/doc/en/cairo-font-weight.rd +0 -14
  345. data/doc/en/cairo-format.rd +0 -22
  346. data/doc/en/cairo-glyph.rd +0 -62
  347. data/doc/en/cairo-gradient-pattern.rd +0 -41
  348. data/doc/en/cairo-hint-metrics.rd +0 -15
  349. data/doc/en/cairo-hint-style.rd +0 -17
  350. data/doc/en/cairo-image-surface.rd +0 -47
  351. data/doc/en/cairo-invalid-content-error.rd +0 -17
  352. data/doc/en/cairo-invalid-dash-error.rd +0 -17
  353. data/doc/en/cairo-invalid-dsc-comment-error.rd +0 -17
  354. data/doc/en/cairo-invalid-format-error.rd +0 -17
  355. data/doc/en/cairo-invalid-index-error.rd +0 -17
  356. data/doc/en/cairo-invalid-matrix-error.rd +0 -17
  357. data/doc/en/cairo-invalid-path-data-error.rd +0 -17
  358. data/doc/en/cairo-invalid-pop-group-error.rd +0 -17
  359. data/doc/en/cairo-invalid-restore-error.rd +0 -17
  360. data/doc/en/cairo-invalid-status-error.rd +0 -17
  361. data/doc/en/cairo-invalid-stride-error.rd +0 -17
  362. data/doc/en/cairo-invalid-string-error.rd +0 -17
  363. data/doc/en/cairo-invalid-visual-error.rd +0 -17
  364. data/doc/en/cairo-line-cap.rd +0 -15
  365. data/doc/en/cairo-line-join.rd +0 -15
  366. data/doc/en/cairo-linear-pattern.rd +0 -28
  367. data/doc/en/cairo-matrix.rd +0 -186
  368. data/doc/en/cairo-no-current-point-error.rd +0 -17
  369. data/doc/en/cairo-null-pointer-error.rd +0 -17
  370. data/doc/en/cairo-operator.rd +0 -26
  371. data/doc/en/cairo-paper-parse-error.rd +0 -17
  372. data/doc/en/cairo-paper-unknown-paper-name.rd +0 -30
  373. data/doc/en/cairo-paper-unknown-unit.rd +0 -30
  374. data/doc/en/cairo-paper-unrecognized-paper-description.rd +0 -30
  375. data/doc/en/cairo-paper.rd +0 -141
  376. data/doc/en/cairo-path-close-path.rd +0 -21
  377. data/doc/en/cairo-path-curve-to.rd +0 -21
  378. data/doc/en/cairo-path-data-type.rd +0 -16
  379. data/doc/en/cairo-path-data.rd +0 -62
  380. data/doc/en/cairo-path-line-to.rd +0 -21
  381. data/doc/en/cairo-path-move-to.rd +0 -21
  382. data/doc/en/cairo-path.rd +0 -109
  383. data/doc/en/cairo-pattern-type-mismatch-error.rd +0 -17
  384. data/doc/en/cairo-pattern.rd +0 -62
  385. data/doc/en/cairo-pdf-surface.rd +0 -27
  386. data/doc/en/cairo-point.rd +0 -42
  387. data/doc/en/cairo-ps-level.rd +0 -24
  388. data/doc/en/cairo-ps-surface.rd +0 -55
  389. data/doc/en/cairo-quartz-image-surface.rd +0 -27
  390. data/doc/en/cairo-quartz-surface.rd +0 -27
  391. data/doc/en/cairo-radial-pattern.rd +0 -28
  392. data/doc/en/cairo-read-error.rd +0 -17
  393. data/doc/en/cairo-rectangle.rd +0 -54
  394. data/doc/en/cairo-scaled-font.rd +0 -50
  395. data/doc/en/cairo-solid-pattern.rd +0 -31
  396. data/doc/en/cairo-subpixel-order.rd +0 -17
  397. data/doc/en/cairo-surface-finished-error.rd +0 -17
  398. data/doc/en/cairo-surface-pattern.rd +0 -27
  399. data/doc/en/cairo-surface-type-mismatch-error.rd +0 -17
  400. data/doc/en/cairo-surface.rd +0 -72
  401. data/doc/en/cairo-svg-surface.rd +0 -44
  402. data/doc/en/cairo-svg-version.rd +0 -24
  403. data/doc/en/cairo-temp-file-error.rd +0 -17
  404. data/doc/en/cairo-text-extents.rd +0 -44
  405. data/doc/en/cairo-win32-printing-surface.rd +0 -27
  406. data/doc/en/cairo-win32-surface.rd +0 -31
  407. data/doc/en/cairo-write-error.rd +0 -17
  408. data/doc/en/cairo.rd +0 -95
  409. data/doc/en/index.rd +0 -1051
  410. data/samples/agg/aa_demo.rb +0 -47
@@ -0,0 +1,333 @@
1
+ require 'tmpdir'
2
+ require 'pathname'
3
+
4
+ require 'test/unit'
5
+ require 'test/unit/collector/load'
6
+
7
+ class TestUnitCollectorLoad < Test::Unit::TestCase
8
+ def setup
9
+ @previous_descendants = Test::Unit::TestCase::DESCENDANTS.dup
10
+ Test::Unit::TestCase::DESCENDANTS.clear
11
+
12
+ @temporary_test_cases_module_name = "TempTestCases"
13
+ ::Object.const_set(@temporary_test_cases_module_name, Module.new)
14
+
15
+ @test_dir = Pathname(Dir.tmpdir) + "test-unit"
16
+ @test_dir.rmtree if @test_dir.exist?
17
+ @test_dir.mkpath
18
+ end
19
+
20
+ setup
21
+ def setup_top_level_test_cases
22
+ @test_case1 = @test_dir + "test_case1.rb"
23
+ @test_case2 = @test_dir + "test_case2.rb"
24
+ @no_load_test_case3 = @test_dir + "case3.rb"
25
+
26
+ @test_case1.open("w") do |test_case|
27
+ test_case.puts(<<-EOT)
28
+ module #{@temporary_test_cases_module_name}
29
+ class TestCase1 < Test::Unit::TestCase
30
+ def test1_1
31
+ end
32
+
33
+ def test1_2
34
+ end
35
+ end
36
+ end
37
+ EOT
38
+ end
39
+
40
+ @test_case2.open("w") do |test_case|
41
+ test_case.puts(<<-EOT)
42
+ module #{@temporary_test_cases_module_name}
43
+ class TestCase2 < Test::Unit::TestCase
44
+ def test2
45
+ end
46
+ end
47
+ end
48
+ EOT
49
+ end
50
+
51
+ @no_load_test_case3.open("w") do |test_case|
52
+ test_case.puts(<<-EOT)
53
+ module #{@temporary_test_cases_module_name}
54
+ class NoLoadTestCase3 < Test::Unit::TestCase
55
+ def test3
56
+ end
57
+ end
58
+ end
59
+ EOT
60
+ end
61
+ end
62
+
63
+ setup
64
+ def setup_sub_level_test_cases
65
+ @sub_test_dir = @test_dir + "sub"
66
+ @sub_test_dir.mkpath
67
+
68
+ @sub_test_case4 = @sub_test_dir + "test_case4.rb"
69
+ @no_load_sub_test_case5 = @sub_test_dir + "case5.rb"
70
+ @sub_test_case6 = @sub_test_dir + "test_case6.rb"
71
+
72
+ @sub_test_case4.open("w") do |test_case|
73
+ test_case.puts(<<-EOT)
74
+ module #{@temporary_test_cases_module_name}
75
+ class SubTestCase4 < Test::Unit::TestCase
76
+ def test4_1
77
+ end
78
+
79
+ def test4_2
80
+ end
81
+ end
82
+ end
83
+ EOT
84
+ end
85
+
86
+ @no_load_sub_test_case5.open("w") do |test_case|
87
+ test_case.puts(<<-EOT)
88
+ module #{@temporary_test_cases_module_name}
89
+ class NoLoadSubTestCase5 < Test::Unit::TestCase
90
+ def test5_1
91
+ end
92
+
93
+ def test5_2
94
+ end
95
+ end
96
+ end
97
+ EOT
98
+ end
99
+
100
+ @sub_test_case6.open("w") do |test_case|
101
+ test_case.puts(<<-EOT)
102
+ module #{@temporary_test_cases_module_name}
103
+ class SubTestCase6 < Test::Unit::TestCase
104
+ def test6
105
+ end
106
+ end
107
+ end
108
+ EOT
109
+ end
110
+ end
111
+
112
+ setup
113
+ def setup_sub_level_test_cases2
114
+ @sub2_test_dir = @test_dir + "sub2"
115
+ @sub2_test_dir.mkpath
116
+
117
+ @no_load_sub2_test_case7 = @sub2_test_dir + "case7.rb"
118
+ @sub2_test_case8 = @sub2_test_dir + "test_case8.rb"
119
+ @sub2_test_case9 = @sub2_test_dir + "test_case9.rb"
120
+
121
+ @no_load_sub2_test_case7.open("w") do |test_case|
122
+ test_case.puts(<<-EOT)
123
+ module #{@temporary_test_cases_module_name}
124
+ class NoLoadSub2TestCase7 < Test::Unit::TestCase
125
+ def test7_1
126
+ end
127
+
128
+ def test7_2
129
+ end
130
+ end
131
+ end
132
+ EOT
133
+ end
134
+
135
+ @sub2_test_case8.open("w") do |test_case|
136
+ test_case.puts(<<-EOT)
137
+ module #{@temporary_test_cases_module_name}
138
+ class Sub2TestCase8 < Test::Unit::TestCase
139
+ def test8_1
140
+ end
141
+
142
+ def test8_2
143
+ end
144
+ end
145
+ end
146
+ EOT
147
+ end
148
+
149
+ @sub2_test_case9.open("w") do |test_case|
150
+ test_case.puts(<<-EOT)
151
+ module #{@temporary_test_cases_module_name}
152
+ class Sub2TestCase9 < Test::Unit::TestCase
153
+ def test9
154
+ end
155
+ end
156
+ end
157
+ EOT
158
+ end
159
+ end
160
+
161
+ setup
162
+ def setup_svn_test_cases
163
+ @svn_test_dir = @test_dir + ".svn"
164
+ @svn_test_dir.mkpath
165
+
166
+ @svn_test_case10 = @svn_test_dir + "test_case10.rb"
167
+
168
+ @svn_test_case10.open("w") do |test_case|
169
+ test_case.puts(<<-EOT)
170
+ module #{@temporary_test_cases_module_name}
171
+ class SvnTestCase10 < Test::Unit::TestCase
172
+ def test7
173
+ end
174
+ end
175
+ end
176
+ EOT
177
+ end
178
+ end
179
+
180
+ setup
181
+ def setup_sub_cvs_test_cases
182
+ @sub_cvs_test_dir = @sub_test_dir + "CVS"
183
+ @sub_cvs_test_dir.mkpath
184
+
185
+ @sub_cvs_test_case11 = @sub_cvs_test_dir + "test_case11.rb"
186
+
187
+ @sub_cvs_test_case11.open("w") do |test_case|
188
+ test_case.puts(<<-EOT)
189
+ module #{@temporary_test_cases_module_name}
190
+ class SubCVSTestCase11 < Test::Unit::TestCase
191
+ def test11
192
+ end
193
+ end
194
+ end
195
+ EOT
196
+ end
197
+ end
198
+
199
+ def teardown
200
+ @test_dir.rmtree if @test_dir.exist?
201
+ ::Object.send(:remove_const, @temporary_test_cases_module_name)
202
+ Test::Unit::TestCase::DESCENDANTS.replace(@previous_descendants)
203
+ end
204
+
205
+ def test_simple_collect
206
+ assert_collect([:suite, {:name => @sub_test_dir.basename.to_s},
207
+ [:suite, {:name => _test_case_name("SubTestCase4")},
208
+ [:test, {:name => "test4_1"}],
209
+ [:test, {:name => "test4_2"}]],
210
+ [:suite, {:name => _test_case_name("SubTestCase6")},
211
+ [:test, {:name => "test6"}]]],
212
+ @sub_test_dir.to_s)
213
+ end
214
+
215
+ def test_multilevel_collect
216
+ assert_collect([:suite, {:name => "."},
217
+ [:suite, {:name => _test_case_name("TestCase1")},
218
+ [:test, {:name => "test1_1"}],
219
+ [:test, {:name => "test1_2"}]],
220
+ [:suite, {:name => _test_case_name("TestCase2")},
221
+ [:test, {:name => "test2"}]],
222
+ [:suite, {:name => @sub_test_dir.basename.to_s},
223
+ [:suite, {:name => _test_case_name("SubTestCase4")},
224
+ [:test, {:name => "test4_1"}],
225
+ [:test, {:name => "test4_2"}]],
226
+ [:suite, {:name => _test_case_name("SubTestCase6")},
227
+ [:test, {:name => "test6"}]]],
228
+ [:suite, {:name => @sub2_test_dir.basename.to_s},
229
+ [:suite, {:name => _test_case_name("Sub2TestCase8")},
230
+ [:test, {:name => "test8_1"}],
231
+ [:test, {:name => "test8_2"}]],
232
+ [:suite, {:name => _test_case_name("Sub2TestCase9")},
233
+ [:test, {:name => "test9"}]]]])
234
+ end
235
+
236
+ def test_collect_file
237
+ assert_collect([:suite, {:name => @test_case1.basename.to_s},
238
+ [:suite, {:name => _test_case_name("TestCase1")},
239
+ [:test, {:name => "test1_1"}],
240
+ [:test, {:name => "test1_2"}]]],
241
+ @test_case1.to_s)
242
+
243
+ assert_collect([:suite, {:name => @no_load_sub_test_case5.basename.to_s},
244
+ [:suite, {:name => _test_case_name("NoLoadSubTestCase5")},
245
+ [:test, {:name => "test5_1"}],
246
+ [:test, {:name => "test5_2"}]]],
247
+ @no_load_sub_test_case5.to_s)
248
+ end
249
+
250
+ def test_nil_pattern
251
+ assert_collect([:suite, {:name => @sub_test_dir.basename.to_s},
252
+ [:suite, {:name => _test_case_name("NoLoadSubTestCase5")},
253
+ [:test, {:name => "test5_1"}],
254
+ [:test, {:name => "test5_2"}]],
255
+ [:suite, {:name => _test_case_name("SubTestCase4")},
256
+ [:test, {:name => "test4_1"}],
257
+ [:test, {:name => "test4_2"}]],
258
+ [:suite, {:name => _test_case_name("SubTestCase6")},
259
+ [:test, {:name => "test6"}]]],
260
+ @sub_test_dir.to_s) do |collector|
261
+ collector.patterns.clear
262
+ end
263
+ end
264
+
265
+ def test_filtering
266
+ assert_collect([:suite, {:name => "."},
267
+ [:suite, {:name => _test_case_name("TestCase1")},
268
+ [:test, {:name => "test1_1"}],
269
+ [:test, {:name => "test1_2"}]]]) do |collector|
270
+ collector.filter = Proc.new do |test|
271
+ not /\Atest1/.match(test.method_name).nil?
272
+ end
273
+ end
274
+ end
275
+
276
+ def test_collect_multi
277
+ test_dirs = [@sub_test_dir.to_s, @sub2_test_dir.to_s]
278
+ assert_collect([:suite, {:name => "[#{test_dirs.join(', ')}]"},
279
+ [:suite, {:name => @sub_test_dir.basename.to_s},
280
+ [:suite, {:name => _test_case_name("SubTestCase4")},
281
+ [:test, {:name => "test4_1"}],
282
+ [:test, {:name => "test4_2"}]],
283
+ [:suite, {:name => _test_case_name("SubTestCase6")},
284
+ [:test, {:name => "test6"}]]],
285
+ [:suite, {:name => @sub2_test_dir.basename.to_s},
286
+ [:suite, {:name => _test_case_name("Sub2TestCase8")},
287
+ [:test, {:name => "test8_1"}],
288
+ [:test, {:name => "test8_2"}]],
289
+ [:suite, {:name => _test_case_name("Sub2TestCase9")},
290
+ [:test, {:name => "test9"}]]]],
291
+ *test_dirs)
292
+ end
293
+
294
+ private
295
+ def assert_collect(expected, *collect_args)
296
+ keep_required_files do
297
+ Dir.chdir(@test_dir.to_s) do
298
+ collector = Test::Unit::Collector::Load.new
299
+ yield(collector) if block_given?
300
+ actual = inspect_test_object(collector.send(:collect, *collect_args))
301
+ assert_equal(expected, actual)
302
+ end
303
+ end
304
+ end
305
+
306
+ def keep_required_files
307
+ required_files = $".dup
308
+ yield
309
+ ensure
310
+ $".replace(required_files)
311
+ end
312
+
313
+ def _test_case_name(test_case_class_name)
314
+ "#{@temporary_test_cases_module_name}::#{test_case_class_name}"
315
+ end
316
+
317
+ def inspect_test_object(test_object)
318
+ return nil if test_object.nil?
319
+ case test_object
320
+ when Test::Unit::TestSuite
321
+ sub_tests = test_object.tests.collect do |test|
322
+ inspect_test_object(test)
323
+ end.sort_by do |type, attributes, *children|
324
+ attributes[:name]
325
+ end
326
+ [:suite, {:name => test_object.name}, *sub_tests]
327
+ when Test::Unit::TestCase
328
+ [:test, {:name => test_object.method_name}]
329
+ else
330
+ raise "unexpected test object: #{test_object.inspect}"
331
+ end
332
+ end
333
+ end
@@ -0,0 +1,98 @@
1
+ # Author:: Nathaniel Talbott.
2
+ # Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
3
+ # License:: Ruby license.
4
+
5
+ require 'test/unit'
6
+ require 'test/unit/collector/objectspace'
7
+
8
+ module Test
9
+ module Unit
10
+ module Collector
11
+ class TC_ObjectSpace < TestCase
12
+ def setup
13
+ @tc1 = Class.new(TestCase) do
14
+ def self.name
15
+ "tc_1"
16
+ end
17
+ def test_1
18
+ end
19
+ def test_2
20
+ end
21
+ end
22
+
23
+ @tc2 = Class.new(TestCase) do
24
+ def self.name
25
+ "tc_2"
26
+ end
27
+ def test_0
28
+ end
29
+ end
30
+
31
+ @no_tc = Class.new do
32
+ def test_4
33
+ end
34
+ end
35
+
36
+ @object_space = {Class => [@tc1, @tc2, @no_tc], String => ['']}
37
+ def @object_space.each_object(type)
38
+ self[type].each{|item| yield(item) }
39
+ end
40
+
41
+ @c = ObjectSpace.new(@object_space)
42
+ end
43
+
44
+ def full_suite(name=ObjectSpace::NAME)
45
+ expected = TestSuite.new(name)
46
+ expected << (TestSuite.new(@tc1.name) << @tc1.new('test_1') << @tc1.new('test_2'))
47
+ expected << (TestSuite.new(@tc2.name) << @tc2.new('test_0'))
48
+ end
49
+
50
+ def empty_suite
51
+ TestSuite.new(ObjectSpace::NAME)
52
+ end
53
+
54
+ def test_basic_collection
55
+ assert_equal(full_suite("name"), @c.collect("name"))
56
+
57
+ @c.filter = []
58
+ assert_equal(full_suite("name"), @c.collect("name"))
59
+ end
60
+
61
+ def test_filtered_collection
62
+ @c.filter = proc{false}
63
+ assert_equal(empty_suite, @c.collect)
64
+
65
+ @c.filter = proc{true}
66
+ assert_equal(full_suite, @c.collect)
67
+
68
+ @c.filter = proc{nil}
69
+ assert_equal(full_suite, @c.collect)
70
+
71
+ @c.filter = [proc{false}, proc{true}]
72
+ assert_equal(empty_suite, @c.collect)
73
+
74
+ @c.filter = [proc{true}, proc{false}]
75
+ assert_equal(full_suite, @c.collect)
76
+
77
+ @c.filter = [proc{nil}, proc{false}]
78
+ assert_equal(empty_suite, @c.collect)
79
+
80
+ @c.filter = [proc{nil}, proc{true}]
81
+ assert_equal(full_suite, @c.collect)
82
+
83
+ expected = TestSuite.new(ObjectSpace::NAME)
84
+ expected << (TestSuite.new(@tc1.name) << @tc1.new('test_1'))
85
+ expected << (TestSuite.new(@tc2.name) << @tc2.new('test_0'))
86
+ @c.filter = proc{|test| ['test_1', 'test_0'].include?(test.method_name)}
87
+ assert_equal(expected, @c.collect)
88
+
89
+ expected = TestSuite.new(ObjectSpace::NAME)
90
+ expected << (TestSuite.new(@tc1.name) << @tc1.new('test_1'))
91
+ expected << (TestSuite.new(@tc2.name) << @tc2.new('test_0'))
92
+ @c.filter = [proc{|t| t.method_name == 'test_1' ? true : nil}, proc{|t| t.method_name == 'test_0' ? true : nil}, proc{false}]
93
+ assert_equal(expected, @c.collect)
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $VERBOSE = true
4
+
5
+ base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
6
+ lib_dir = File.join(base_dir, "lib")
7
+ test_dir = File.join(base_dir, "test")
8
+
9
+ $LOAD_PATH.unshift(lib_dir)
10
+
11
+ require 'test/unit'
12
+
13
+ exit Test::Unit::AutoRunner.run(true, test_dir)
@@ -0,0 +1,693 @@
1
+ # Author:: Nathaniel Talbott.
2
+ # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
3
+ # License:: Ruby license.
4
+
5
+ require 'test/unit'
6
+
7
+ module Test
8
+ module Unit
9
+ class TC_Assertions < TestCase
10
+ def check(value, message="")
11
+ add_assertion
12
+ raise AssertionFailedError.new(message) unless value
13
+ end
14
+
15
+ def check_assertions(expect_fail, expected_message="",
16
+ return_value_expected=false)
17
+ @actual_assertion_count = 0
18
+ failed = true
19
+ actual_message = nil
20
+ @catch_assertions = true
21
+ return_value = nil
22
+ begin
23
+ return_value = yield
24
+ failed = false
25
+ rescue AssertionFailedError => error
26
+ actual_message = error.message
27
+ end
28
+ @catch_assertions = false
29
+
30
+ if expect_fail
31
+ message = "Should have failed, but didn't"
32
+ else
33
+ message = "Should not have failed, but did with message\n" +
34
+ "<#{actual_message}>"
35
+ end
36
+ check(expect_fail == failed, message)
37
+
38
+ message = "Should have made one assertion but made\n" +
39
+ "<#{@actual_assertion_count}>"
40
+ check(1 == @actual_assertion_count, message)
41
+
42
+ if expect_fail
43
+ case expected_message
44
+ when String
45
+ check(actual_message == expected_message,
46
+ "Should have the correct message.\n" +
47
+ "<#{expected_message.inspect}> expected but was\n" +
48
+ "<#{actual_message.inspect}>")
49
+ when Regexp
50
+ check(actual_message =~ expected_message,
51
+ "The message should match correctly.\n" +
52
+ "</#{expected_message.source}/> expected to match\n" +
53
+ "<#{actual_message.inspect}>")
54
+ else
55
+ check(false,
56
+ "Incorrect expected message type in assert_nothing_failed")
57
+ end
58
+ else
59
+ if return_value_expected
60
+ check(!return_value.nil?, "Should return a value")
61
+ else
62
+ check(return_value.nil?,
63
+ "Should not return a value but returned <#{return_value}>")
64
+ end
65
+ end
66
+
67
+ return_value
68
+ end
69
+
70
+ def check_nothing_fails(return_value_expected=false, &proc)
71
+ check_assertions(false, "", return_value_expected, &proc)
72
+ end
73
+
74
+ def check_fails(expected_message="", &proc)
75
+ check_assertions(true, expected_message, &proc)
76
+ end
77
+
78
+ def inspect_tag(tag)
79
+ begin
80
+ throw tag
81
+ rescue NameError
82
+ tag.to_s.inspect
83
+ rescue ArgumentError
84
+ tag.inspect
85
+ end
86
+ end
87
+
88
+ def test_assert_block
89
+ check_nothing_fails {
90
+ assert_block {true}
91
+ }
92
+ check_nothing_fails {
93
+ assert_block("successful assert_block") {true}
94
+ }
95
+ check_nothing_fails {
96
+ assert_block("successful assert_block") {true}
97
+ }
98
+ check_fails("assert_block failed.") {
99
+ assert_block {false}
100
+ }
101
+ check_fails("failed assert_block") {
102
+ assert_block("failed assert_block") {false}
103
+ }
104
+ end
105
+
106
+ def test_assert
107
+ check_nothing_fails{assert("a")}
108
+ check_nothing_fails{assert(true)}
109
+ check_nothing_fails{assert(true, "successful assert")}
110
+ check_fails("<nil> is not true."){assert(nil)}
111
+ check_fails("<false> is not true."){assert(false)}
112
+ check_fails("failed assert.\n<false> is not true."){assert(false, "failed assert")}
113
+ end
114
+
115
+ def test_assert_equal
116
+ check_nothing_fails {
117
+ assert_equal("string1", "string1")
118
+ }
119
+ check_nothing_fails {
120
+ assert_equal( "string1", "string1", "successful assert_equal")
121
+ }
122
+ check_nothing_fails {
123
+ assert_equal("string1", "string1", "successful assert_equal")
124
+ }
125
+
126
+ message = <<-EOM.chomp
127
+ <"string1"> expected but was
128
+ <"string2">.
129
+
130
+ diff:
131
+ - string1
132
+ ? ^
133
+ + string2
134
+ ? ^
135
+ EOM
136
+ check_fails(message) {
137
+ assert_equal("string1", "string2")
138
+ }
139
+
140
+ message = <<-EOM.chomp
141
+ failed assert_equal.
142
+ <"string1"> expected but was
143
+ <"string2">.
144
+
145
+ diff:
146
+ - string1
147
+ ? ^
148
+ + string2
149
+ ? ^
150
+ EOM
151
+ check_fails(message) {
152
+ assert_equal("string1", "string2", "failed assert_equal")
153
+ }
154
+
155
+ message = <<-EOM.chomp
156
+ <"111111"> expected but was
157
+ <111111>.
158
+
159
+ diff:
160
+ - "111111"
161
+ ? - -
162
+ + 111111
163
+ EOM
164
+ check_fails(message) do
165
+ assert_equal("111111", 111111)
166
+ end
167
+ end
168
+
169
+ def test_assert_equal_for_too_small_difference
170
+ message = <<-EOM.chomp
171
+ <1> expected but was
172
+ <2>.
173
+ EOM
174
+ check_fails(message) do
175
+ assert_equal(1, 2)
176
+ end
177
+ end
178
+
179
+ def test_assert_equal_for_same_inspected_objects
180
+ now = Time.now
181
+ now_without_usec = Time.at(now.to_i)
182
+ message = <<-EOM.chomp
183
+ <#{now.inspect}> expected but was
184
+ <#{now.inspect}>.
185
+ EOM
186
+ check_fails(message) do
187
+ assert_equal(now, now_without_usec)
188
+ end
189
+ end
190
+
191
+ def test_assert_equal_with_multi_lines_result
192
+ message = <<-EOM.chomp
193
+ <#{"a\nb".inspect}> expected but was
194
+ <#{"x".inspect}>.
195
+
196
+ diff:
197
+ + x
198
+ - a
199
+ - b
200
+ EOM
201
+ check_fails(message) do
202
+ assert_equal("a\nb", "x")
203
+ end
204
+ end
205
+
206
+ def test_assert_raise
207
+ return_value = nil
208
+ check_nothing_fails(true) {
209
+ return_value = assert_raise(RuntimeError) {
210
+ raise "Error"
211
+ }
212
+ }
213
+ check(return_value.kind_of?(Exception), "Should have returned the exception from a successful assert_raise")
214
+ check(return_value.message == "Error", "Should have returned the correct exception from a successful assert_raise")
215
+ check_nothing_fails(true) {
216
+ assert_raise(ArgumentError, "successful assert_raise") {
217
+ raise ArgumentError.new("Error")
218
+ }
219
+ }
220
+ check_nothing_fails(true) {
221
+ assert_raise(RuntimeError) {
222
+ raise "Error"
223
+ }
224
+ }
225
+ check_nothing_fails(true) {
226
+ assert_raise(RuntimeError, "successful assert_raise") {
227
+ raise "Error"
228
+ }
229
+ }
230
+ check_fails("<RuntimeError> exception expected but none was thrown.") {
231
+ assert_raise(RuntimeError) {
232
+ 1 + 1
233
+ }
234
+ }
235
+ check_fails(%r{\Afailed assert_raise.\n<ArgumentError> exception expected but was\nClass: <RuntimeError>\nMessage: <"Error">\n---Backtrace---\n.+\n---------------\Z}m) {
236
+ assert_raise(ArgumentError, "failed assert_raise") {
237
+ raise "Error"
238
+ }
239
+ }
240
+ check_fails("Should expect a class of exception, Object.\n<false> is not true.") {
241
+ assert_nothing_raised(Object) {
242
+ 1 + 1
243
+ }
244
+ }
245
+
246
+ exceptions = [ArgumentError, TypeError]
247
+ modules = [Math, Comparable]
248
+ rescues = exceptions + modules
249
+ exceptions.each do |exc|
250
+ check_nothing_fails(true) {
251
+ return_value = assert_raise(*rescues) {
252
+ raise exc, "Error"
253
+ }
254
+ }
255
+ check(return_value.instance_of?(exc), "Should have returned #{exc} but was #{return_value.class}")
256
+ check(return_value.message == "Error", "Should have returned the correct exception from a successful assert_raise")
257
+ end
258
+ modules.each do |mod|
259
+ check_nothing_fails(true) {
260
+ return_value = assert_raise(*rescues) {
261
+ raise Exception.new("Error").extend(mod)
262
+ }
263
+ }
264
+ check(mod === return_value, "Should have returned #{mod}")
265
+ check(return_value.message == "Error", "Should have returned the correct exception from a successful assert_raise")
266
+ end
267
+ check_fails("<[ArgumentError, TypeError, Math, Comparable]> exception expected but none was thrown.") {
268
+ assert_raise(*rescues) {
269
+ 1 + 1
270
+ }
271
+ }
272
+ check_fails(%r{\Afailed assert_raise.
273
+ <\[ArgumentError, TypeError\]> exception expected but was
274
+ Class: <RuntimeError>
275
+ Message: <"Error">
276
+ ---Backtrace---
277
+ .+
278
+ ---------------\Z}m) {
279
+ assert_raise(ArgumentError, TypeError, "failed assert_raise") {
280
+ raise "Error"
281
+ }
282
+ }
283
+ end
284
+
285
+ def test_assert_instance_of
286
+ check_nothing_fails {
287
+ assert_instance_of(String, "string")
288
+ }
289
+ check_nothing_fails {
290
+ assert_instance_of(String, "string", "successful assert_instance_of")
291
+ }
292
+ check_nothing_fails {
293
+ assert_instance_of(String, "string", "successful assert_instance_of")
294
+ }
295
+ check_fails(%Q{<"string"> expected to be an instance of\n<Hash> but was\n<String>.}) {
296
+ assert_instance_of(Hash, "string")
297
+ }
298
+ check_fails(%Q{failed assert_instance_of.\n<"string"> expected to be an instance of\n<Hash> but was\n<String>.}) {
299
+ assert_instance_of(Hash, "string", "failed assert_instance_of")
300
+ }
301
+ end
302
+
303
+ def test_assert_nil
304
+ check_nothing_fails {
305
+ assert_nil(nil)
306
+ }
307
+ check_nothing_fails {
308
+ assert_nil(nil, "successful assert_nil")
309
+ }
310
+ check_nothing_fails {
311
+ assert_nil(nil, "successful assert_nil")
312
+ }
313
+ check_fails(%Q{<"string"> expected to be nil.}) {
314
+ assert_nil("string")
315
+ }
316
+ check_fails(%Q{failed assert_nil.\n<"string"> expected to be nil.}) {
317
+ assert_nil("string", "failed assert_nil")
318
+ }
319
+ end
320
+
321
+ def test_assert_not_nil
322
+ check_nothing_fails{assert_not_nil(false)}
323
+ check_nothing_fails{assert_not_nil(false, "message")}
324
+ check_fails("<nil> expected to not be nil."){assert_not_nil(nil)}
325
+ check_fails("message.\n<nil> expected to not be nil.") {assert_not_nil(nil, "message")}
326
+ end
327
+
328
+ def test_assert_kind_of
329
+ check_nothing_fails {
330
+ assert_kind_of(Module, Array)
331
+ }
332
+ check_nothing_fails {
333
+ assert_kind_of(Object, "string", "successful assert_kind_of")
334
+ }
335
+ check_nothing_fails {
336
+ assert_kind_of(Object, "string", "successful assert_kind_of")
337
+ }
338
+ check_nothing_fails {
339
+ assert_kind_of(Comparable, 1)
340
+ }
341
+ check_fails(%Q{<"string">\nexpected to be kind_of?\n<Class> but was\n<String>.}) {
342
+ assert_kind_of(Class, "string")
343
+ }
344
+ check_fails(%Q{failed assert_kind_of.\n<"string">\nexpected to be kind_of?\n<Class> but was\n<String>.}) {
345
+ assert_kind_of(Class, "string", "failed assert_kind_of")
346
+ }
347
+ end
348
+
349
+ def test_assert_match
350
+ check_nothing_fails {
351
+ assert_match(/strin./, "string")
352
+ }
353
+ check_nothing_fails {
354
+ assert_match("strin", "string")
355
+ }
356
+ check_nothing_fails {
357
+ assert_match(/strin./, "string", "successful assert_match")
358
+ }
359
+ check_nothing_fails {
360
+ assert_match(/strin./, "string", "successful assert_match")
361
+ }
362
+ check_fails(%Q{<"string"> expected to be =~\n</slin./>.}) {
363
+ assert_match(/slin./, "string")
364
+ }
365
+ check_fails(%Q{<"string"> expected to be =~\n</strin\\./>.}) {
366
+ assert_match("strin.", "string")
367
+ }
368
+ check_fails(%Q{failed assert_match.\n<"string"> expected to be =~\n</slin./>.}) {
369
+ assert_match(/slin./, "string", "failed assert_match")
370
+ }
371
+ end
372
+
373
+ def test_assert_same
374
+ thing = "thing"
375
+ check_nothing_fails {
376
+ assert_same(thing, thing)
377
+ }
378
+ check_nothing_fails {
379
+ assert_same(thing, thing, "successful assert_same")
380
+ }
381
+ check_nothing_fails {
382
+ assert_same(thing, thing, "successful assert_same")
383
+ }
384
+ thing2 = "thing"
385
+ check_fails(%Q{<"thing">\nwith id <#{thing.__id__}> expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
386
+ assert_same(thing, thing2)
387
+ }
388
+ check_fails(%Q{failed assert_same.\n<"thing">\nwith id <#{thing.__id__}> expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
389
+ assert_same(thing, thing2, "failed assert_same")
390
+ }
391
+ end
392
+
393
+ def test_assert_nothing_raised
394
+ check_nothing_fails {
395
+ assert_nothing_raised {
396
+ 1 + 1
397
+ }
398
+ }
399
+ check_nothing_fails {
400
+ assert_nothing_raised("successful assert_nothing_raised") {
401
+ 1 + 1
402
+ }
403
+ }
404
+ check_nothing_fails {
405
+ assert_nothing_raised("successful assert_nothing_raised") {
406
+ 1 + 1
407
+ }
408
+ }
409
+ check_nothing_fails {
410
+ begin
411
+ assert_nothing_raised(RuntimeError, StandardError, Comparable, "successful assert_nothing_raised") {
412
+ raise ZeroDivisionError.new("ArgumentError")
413
+ }
414
+ rescue ZeroDivisionError
415
+ end
416
+ }
417
+ check_fails("Should expect a class of exception, Object.\n<false> is not true.") {
418
+ assert_nothing_raised(Object) {
419
+ 1 + 1
420
+ }
421
+ }
422
+ check_fails(%r{\AException raised:\nClass: <RuntimeError>\nMessage: <"Error">\n---Backtrace---\n.+\n---------------\Z}m) {
423
+ assert_nothing_raised {
424
+ raise "Error"
425
+ }
426
+ }
427
+ check_fails(%r{\Afailed assert_nothing_raised\.\nException raised:\nClass: <RuntimeError>\nMessage: <"Error">\n---Backtrace---\n.+\n---------------\Z}m) {
428
+ assert_nothing_raised("failed assert_nothing_raised") {
429
+ raise "Error"
430
+ }
431
+ }
432
+ check_fails(%r{\AException raised:\nClass: <RuntimeError>\nMessage: <"Error">\n---Backtrace---\n.+\n---------------\Z}m) {
433
+ assert_nothing_raised(StandardError, RuntimeError) {
434
+ raise "Error"
435
+ }
436
+ }
437
+ check_fails("Failure.") do
438
+ assert_nothing_raised do
439
+ flunk("Failure")
440
+ end
441
+ end
442
+ end
443
+
444
+ def test_flunk
445
+ check_fails("Flunked.") {
446
+ flunk
447
+ }
448
+ check_fails("flunk message.") {
449
+ flunk("flunk message")
450
+ }
451
+ end
452
+
453
+ def test_assert_not_same
454
+ thing = "thing"
455
+ thing2 = "thing"
456
+ check_nothing_fails {
457
+ assert_not_same(thing, thing2)
458
+ }
459
+ check_nothing_fails {
460
+ assert_not_same(thing, thing2, "message")
461
+ }
462
+ check_fails(%Q{<"thing">\nwith id <#{thing.__id__}> expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) {
463
+ assert_not_same(thing, thing)
464
+ }
465
+ check_fails(%Q{message.\n<"thing">\nwith id <#{thing.__id__}> expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) {
466
+ assert_not_same(thing, thing, "message")
467
+ }
468
+ end
469
+
470
+ def test_assert_not_equal
471
+ check_nothing_fails {
472
+ assert_not_equal("string1", "string2")
473
+ }
474
+ check_nothing_fails {
475
+ assert_not_equal("string1", "string2", "message")
476
+ }
477
+ check_fails(%Q{<"string"> expected to be != to\n<"string">.}) {
478
+ assert_not_equal("string", "string")
479
+ }
480
+ check_fails(%Q{message.\n<"string"> expected to be != to\n<"string">.}) {
481
+ assert_not_equal("string", "string", "message")
482
+ }
483
+ end
484
+
485
+ def test_assert_no_match
486
+ check_nothing_fails{assert_no_match(/sling/, "string")}
487
+ check_nothing_fails{assert_no_match(/sling/, "string", "message")}
488
+ check_fails(%Q{The first argument to assert_no_match should be a Regexp.\n<"asdf"> expected to be an instance of\n<Regexp> but was\n<String>.}) do
489
+ assert_no_match("asdf", "asdf")
490
+ end
491
+ check_fails(%Q{</string/> expected to not match\n<"string">.}) do
492
+ assert_no_match(/string/, "string")
493
+ end
494
+ check_fails(%Q{message.\n</string/> expected to not match\n<"string">.}) do
495
+ assert_no_match(/string/, "string", "message")
496
+ end
497
+ end
498
+
499
+ def test_assert_throws
500
+ check_nothing_fails do
501
+ assert_throws(:thing, "message") do
502
+ throw :thing
503
+ end
504
+ end
505
+
506
+ tag = :thing2
507
+ check_fails("message.\n" +
508
+ "<:thing> expected to be thrown but\n" +
509
+ "<#{inspect_tag(tag)}> was thrown.") do
510
+ assert_throws(:thing, "message") do
511
+ throw :thing2
512
+ end
513
+ end
514
+ check_fails("message.\n" +
515
+ "<:thing> should have been thrown.") do
516
+ assert_throws(:thing, "message") do
517
+ 1 + 1
518
+ end
519
+ end
520
+ end
521
+
522
+ def test_assert_nothing_thrown
523
+ check_nothing_fails do
524
+ assert_nothing_thrown("message") do
525
+ 1 + 1
526
+ end
527
+ end
528
+
529
+ tag = :thing
530
+ inspected = inspect_tag(tag)
531
+ check_fails("message.\n" +
532
+ "<#{inspected}> was thrown when nothing was expected.") do
533
+ assert_nothing_thrown("message") do
534
+ throw tag
535
+ end
536
+ end
537
+ end
538
+
539
+ def test_assert_operator
540
+ check_nothing_fails {
541
+ assert_operator("thing", :==, "thing", "message")
542
+ }
543
+ check_fails(%Q{<0.15>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to?(:to_str).}) do
544
+ assert_operator("thing", 0.15, "thing")
545
+ end
546
+ check_fails(%Q{message.\n<"thing1"> expected to be\n==\n<"thing2">.}) {
547
+ assert_operator("thing1", :==, "thing2", "message")
548
+ }
549
+ end
550
+
551
+ def test_assert_respond_to
552
+ check_nothing_fails {
553
+ assert_respond_to("thing", :to_s, "message")
554
+ }
555
+ check_nothing_fails {
556
+ assert_respond_to("thing", "to_s", "message")
557
+ }
558
+ check_fails("<0.15>\ngiven as the method name argument to #assert_respond_to must be a Symbol or #respond_to?(:to_str).") {
559
+ assert_respond_to("thing", 0.15)
560
+ }
561
+ check_fails("message.\n<:symbol>\nof type <Symbol>\nexpected to respond_to?<:non_existent>.") {
562
+ assert_respond_to(:symbol, :non_existent, "message")
563
+ }
564
+ end
565
+
566
+ def test_assert_in_delta
567
+ check_nothing_fails {
568
+ assert_in_delta(1.4, 1.4, 0)
569
+ }
570
+ check_nothing_fails {
571
+ assert_in_delta(0.5, 0.4, 0.1, "message")
572
+ }
573
+ check_nothing_fails {
574
+ float_thing = Object.new
575
+ def float_thing.to_f
576
+ 0.2
577
+ end
578
+ assert_in_delta(0.1, float_thing, 0.1)
579
+ }
580
+ check_fails("message.\n<0.5> and\n<0.4> expected to be within\n<0.05> of each other.") {
581
+ assert_in_delta(0.5, 0.4, 0.05, "message")
582
+ }
583
+ check_fails(%r{The arguments must respond to to_f; the first float did not\.\n<.+>\nof type <Object>\nexpected to respond_to\?<:to_f>.}) {
584
+ assert_in_delta(Object.new, 0.4, 0.1)
585
+ }
586
+ check_fails("The delta should not be negative.\n<-0.1> expected to be\n>=\n<0.0>.") {
587
+ assert_in_delta(0.5, 0.4, -0.1, "message")
588
+ }
589
+ end
590
+
591
+ def test_assert_send
592
+ object = Object.new
593
+ class << object
594
+ private
595
+ def return_argument(argument, bogus)
596
+ return argument
597
+ end
598
+ end
599
+ check_nothing_fails {
600
+ assert_send([object, :return_argument, true, "bogus"], "message")
601
+ }
602
+ check_fails(%r{\Amessage\.\n<.+> expected to respond to\n<return_argument\(\[false, "bogus"\]\)> with a true value.\Z}) {
603
+ assert_send([object, :return_argument, false, "bogus"], "message")
604
+ }
605
+ end
606
+
607
+ def test_condition_invariant
608
+ object = Object.new
609
+ def object.inspect
610
+ @changed = true
611
+ end
612
+ def object.==(other)
613
+ @changed ||= false
614
+ return (!@changed)
615
+ end
616
+ check_nothing_fails do
617
+ assert_equal(object, object, "message")
618
+ end
619
+ end
620
+
621
+ def test_assert_boolean
622
+ check_nothing_fails do
623
+ assert_boolean(true)
624
+ end
625
+ check_nothing_fails do
626
+ assert_boolean(false)
627
+ end
628
+
629
+ check_fails("<true> or <false> expected but was\n<1>") do
630
+ assert_boolean(1)
631
+ end
632
+
633
+ check_fails("<true> or <false> expected but was\n<nil>") do
634
+ assert_boolean(nil)
635
+ end
636
+
637
+ check_fails("message.\n<true> or <false> expected but was\n<\"XXX\">") do
638
+ assert_boolean("XXX", "message")
639
+ end
640
+ end
641
+
642
+ def test_assert_true
643
+ check_nothing_fails do
644
+ assert_true(true)
645
+ end
646
+
647
+ check_fails("<true> expected but was\n<false>") do
648
+ assert_true(false)
649
+ end
650
+
651
+ check_fails("<true> expected but was\n<1>") do
652
+ assert_true(1)
653
+ end
654
+
655
+ check_fails("message.\n<true> expected but was\n<nil>") do
656
+ assert_true(nil, "message")
657
+ end
658
+ end
659
+
660
+ def test_assert_false
661
+ check_nothing_fails do
662
+ assert_false(false)
663
+ end
664
+
665
+ check_fails("<false> expected but was\n<true>") do
666
+ assert_false(true)
667
+ end
668
+
669
+ check_fails("<false> expected but was\n<nil>") do
670
+ assert_false(nil)
671
+ end
672
+
673
+ check_fails("message.\n<false> expected but was\n<:false>") do
674
+ assert_false(:false, "message")
675
+ end
676
+ end
677
+
678
+ def add_failure(message, location=caller)
679
+ unless @catch_assertions
680
+ super
681
+ end
682
+ end
683
+
684
+ def add_assertion
685
+ if @catch_assertions
686
+ @actual_assertion_count += 1
687
+ else
688
+ super
689
+ end
690
+ end
691
+ end
692
+ end
693
+ end