rroonga 0.9.5-x86-mingw32 → 1.0.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (421) hide show
  1. data/NEWS.ja.rdoc +24 -0
  2. data/NEWS.rdoc +24 -0
  3. data/README.ja.rdoc +3 -2
  4. data/README.rdoc +3 -2
  5. data/Rakefile +15 -6
  6. data/ext/groonga/extconf.rb +25 -25
  7. data/ext/groonga/groonga.def +2 -0
  8. data/ext/groonga/rb-grn-array.c +1 -1
  9. data/ext/groonga/rb-grn-exception.c +14 -0
  10. data/ext/groonga/rb-grn-hash.c +1 -1
  11. data/ext/groonga/rb-grn-index-column.c +13 -1
  12. data/ext/groonga/rb-grn-object.c +2 -2
  13. data/ext/groonga/rb-grn-patricia-trie.c +394 -1
  14. data/ext/groonga/rb-grn-table.c +33 -2
  15. data/ext/groonga/rb-grn.h +3 -3
  16. data/html/index.html +1 -1
  17. data/lib/1.8/groonga.so +0 -0
  18. data/lib/1.9/groonga.so +0 -0
  19. data/lib/groonga/record.rb +32 -2
  20. data/lib/groonga/schema.rb +1 -1
  21. data/rroonga-build.rb +3 -3
  22. data/test/test-patricia-trie.rb +172 -1
  23. data/test/test-record.rb +7 -0
  24. data/test/test-remote.rb +2 -1
  25. data/test/test-table-cursor.rb +35 -1
  26. data/test/test-table-select-normalize.rb +7 -3
  27. data/vendor/local/bin/grntest.exe +0 -0
  28. data/vendor/local/bin/groonga.exe +0 -0
  29. data/vendor/local/bin/libgroonga-0.dll +0 -0
  30. data/vendor/local/etc/groonga/groonga.conf +11 -0
  31. data/vendor/local/etc/groonga/init.d/redhat/groonga +168 -0
  32. data/vendor/local/etc/groonga/init.d/redhat/sysconfig/groonga +8 -0
  33. data/vendor/local/include/groonga/groonga.h +38 -12
  34. data/vendor/local/lib/groonga/modules/suggest/suggest.a +0 -0
  35. data/vendor/local/lib/groonga/modules/suggest/suggest.dll +0 -0
  36. data/vendor/local/lib/groonga/modules/suggest/suggest.dll.a +0 -0
  37. data/vendor/local/lib/groonga/modules/{functions/cast.la → suggest/suggest.la} +6 -6
  38. data/vendor/local/lib/libgroonga.a +0 -0
  39. data/vendor/local/lib/libgroonga.dll.a +0 -0
  40. data/vendor/local/lib/pkgconfig/groonga.pc +1 -1
  41. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  42. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  43. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  44. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  45. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  46. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  47. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  48. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  49. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  50. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  51. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  52. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  53. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  54. data/vendor/local/share/groonga/admin_html/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  55. data/vendor/local/share/groonga/admin_html/images/groonga.png +0 -0
  56. data/vendor/local/share/groonga/admin_html/images/loading.gif +0 -0
  57. data/vendor/local/share/groonga/admin_html/js/jquery.json-2.2.min.js +31 -0
  58. data/vendor/local/share/groonga/doc/ja/html/.buildinfo +4 -0
  59. data/vendor/local/share/groonga/doc/ja/html/_sources/characteristic.txt +56 -0
  60. data/vendor/local/share/groonga/doc/ja/html/_sources/commands.txt +10 -0
  61. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/cache_limit.txt +52 -0
  62. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/check.txt +164 -0
  63. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/clearlock.txt +61 -0
  64. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/column_create.txt +93 -0
  65. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/column_list.txt +97 -0
  66. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/column_remove.txt +58 -0
  67. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/define_selector.txt +114 -0
  68. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/defrag.txt +57 -0
  69. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/delete.txt +68 -0
  70. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/dump.txt +62 -0
  71. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/load.txt +98 -0
  72. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/log_level.txt +65 -0
  73. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/log_put.txt +69 -0
  74. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/log_reopen.txt +66 -0
  75. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/quit.txt +38 -0
  76. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/select.txt +247 -0
  77. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/shutdown.txt +38 -0
  78. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/status.txt +59 -0
  79. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/suggest.txt +79 -0
  80. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/table_create.txt +111 -0
  81. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/table_list.txt +87 -0
  82. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/table_remove.txt +50 -0
  83. data/vendor/local/share/groonga/doc/ja/html/_sources/commands/view_add.txt +53 -0
  84. data/vendor/local/share/groonga/doc/ja/html/_sources/commands_not_implemented/add.txt +102 -0
  85. data/vendor/local/share/groonga/doc/ja/html/_sources/commands_not_implemented/get.txt +78 -0
  86. data/vendor/local/share/groonga/doc/ja/html/_sources/commands_not_implemented/set.txt +103 -0
  87. data/vendor/local/share/groonga/doc/ja/html/_sources/developer.txt +10 -0
  88. data/vendor/local/share/groonga/doc/ja/html/_sources/developer/com.txt +18 -0
  89. data/vendor/local/share/groonga/doc/ja/html/_sources/developer/document.txt +38 -0
  90. data/vendor/local/share/groonga/doc/ja/html/_sources/developer/query.txt +212 -0
  91. data/vendor/local/share/groonga/doc/ja/html/_sources/developer/test.txt +114 -0
  92. data/vendor/local/share/groonga/doc/ja/html/_sources/execfile.txt +226 -0
  93. data/vendor/local/share/groonga/doc/ja/html/_sources/expr.txt +43 -0
  94. data/vendor/local/share/groonga/doc/ja/html/_sources/functions.txt +10 -0
  95. data/vendor/local/share/groonga/doc/ja/html/_sources/functions/edit_distance.txt +48 -0
  96. data/vendor/local/share/groonga/doc/ja/html/_sources/functions/geo_distance.txt +51 -0
  97. data/vendor/local/share/groonga/doc/ja/html/_sources/functions/geo_in_circle.txt +54 -0
  98. data/vendor/local/share/groonga/doc/ja/html/_sources/functions/geo_in_rectangle.txt +55 -0
  99. data/vendor/local/share/groonga/doc/ja/html/_sources/functions/now.txt +34 -0
  100. data/vendor/local/share/groonga/doc/ja/html/_sources/functions/rand.txt +41 -0
  101. data/vendor/local/share/groonga/doc/ja/html/_sources/grnslap.txt +64 -0
  102. data/vendor/local/share/groonga/doc/ja/html/_sources/grntest.txt +259 -0
  103. data/vendor/local/share/groonga/doc/ja/html/_sources/http.txt +52 -0
  104. data/vendor/local/share/groonga/doc/ja/html/_sources/index.txt +21 -0
  105. data/vendor/local/share/groonga/doc/ja/html/_sources/install.txt +114 -0
  106. data/vendor/local/share/groonga/doc/ja/html/_sources/news.txt +199 -0
  107. data/vendor/local/share/groonga/doc/ja/html/_sources/process.txt +12 -0
  108. data/vendor/local/share/groonga/doc/ja/html/_sources/pseudo_column.txt +38 -0
  109. data/vendor/local/share/groonga/doc/ja/html/_sources/reference.txt +14 -0
  110. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial.txt +10 -0
  111. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial01.txt +293 -0
  112. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial02.txt +100 -0
  113. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial03.txt +72 -0
  114. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial04.txt +111 -0
  115. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial05.txt +65 -0
  116. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial06.txt +91 -0
  117. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial07.txt +92 -0
  118. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial08.txt +53 -0
  119. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial09.txt +9 -0
  120. data/vendor/local/share/groonga/doc/ja/html/_sources/tutorial/tutorial10.txt +486 -0
  121. data/vendor/local/share/groonga/doc/ja/html/_sources/type.txt +118 -0
  122. data/vendor/local/share/groonga/doc/ja/html/_static/basic.css +509 -0
  123. data/vendor/local/share/groonga/doc/ja/html/_static/default.css +277 -0
  124. data/vendor/local/share/groonga/doc/ja/html/_static/doctools.js +247 -0
  125. data/vendor/local/share/groonga/doc/ja/html/_static/file.png +0 -0
  126. data/vendor/local/share/groonga/doc/ja/html/_static/jquery.js +6240 -0
  127. data/vendor/local/share/groonga/doc/ja/html/_static/minus.png +0 -0
  128. data/vendor/local/share/groonga/doc/ja/html/_static/plus.png +0 -0
  129. data/vendor/local/share/groonga/doc/ja/html/_static/pygments.css +61 -0
  130. data/vendor/local/share/groonga/doc/ja/html/_static/searchtools.js +518 -0
  131. data/vendor/local/share/groonga/doc/ja/html/_static/sidebar.js +147 -0
  132. data/vendor/local/share/groonga/doc/ja/html/_static/underscore.js +16 -0
  133. data/vendor/local/share/groonga/doc/ja/html/characteristic.html +162 -0
  134. data/vendor/local/share/groonga/doc/ja/html/commands.html +139 -0
  135. data/vendor/local/share/groonga/doc/ja/html/commands/cache_limit.html +173 -0
  136. data/vendor/local/share/groonga/doc/ja/html/commands/check.html +285 -0
  137. data/vendor/local/share/groonga/doc/ja/html/commands/clearlock.html +180 -0
  138. data/vendor/local/share/groonga/doc/ja/html/commands/column_create.html +210 -0
  139. data/vendor/local/share/groonga/doc/ja/html/commands/column_list.html +220 -0
  140. data/vendor/local/share/groonga/doc/ja/html/commands/column_remove.html +183 -0
  141. data/vendor/local/share/groonga/doc/ja/html/commands/define_selector.html +221 -0
  142. data/vendor/local/share/groonga/doc/ja/html/commands/defrag.html +177 -0
  143. data/vendor/local/share/groonga/doc/ja/html/commands/delete.html +182 -0
  144. data/vendor/local/share/groonga/doc/ja/html/commands/dump.html +177 -0
  145. data/vendor/local/share/groonga/doc/ja/html/commands/load.html +208 -0
  146. data/vendor/local/share/groonga/doc/ja/html/commands/log_level.html +187 -0
  147. data/vendor/local/share/groonga/doc/ja/html/commands/log_put.html +190 -0
  148. data/vendor/local/share/groonga/doc/ja/html/commands/log_reopen.html +188 -0
  149. data/vendor/local/share/groonga/doc/ja/html/commands/quit.html +156 -0
  150. data/vendor/local/share/groonga/doc/ja/html/commands/select.html +331 -0
  151. data/vendor/local/share/groonga/doc/ja/html/commands/shutdown.html +156 -0
  152. data/vendor/local/share/groonga/doc/ja/html/commands/status.html +179 -0
  153. data/vendor/local/share/groonga/doc/ja/html/commands/suggest.html +191 -0
  154. data/vendor/local/share/groonga/doc/ja/html/commands/table_create.html +222 -0
  155. data/vendor/local/share/groonga/doc/ja/html/commands/table_list.html +202 -0
  156. data/vendor/local/share/groonga/doc/ja/html/commands/table_remove.html +173 -0
  157. data/vendor/local/share/groonga/doc/ja/html/commands/view_add.html +175 -0
  158. data/vendor/local/share/groonga/doc/ja/html/commands_not_implemented/add.html +180 -0
  159. data/vendor/local/share/groonga/doc/ja/html/commands_not_implemented/get.html +161 -0
  160. data/vendor/local/share/groonga/doc/ja/html/commands_not_implemented/set.html +182 -0
  161. data/vendor/local/share/groonga/doc/ja/html/developer.html +118 -0
  162. data/vendor/local/share/groonga/doc/ja/html/developer/com.html +136 -0
  163. data/vendor/local/share/groonga/doc/ja/html/developer/document.html +159 -0
  164. data/vendor/local/share/groonga/doc/ja/html/developer/query.html +336 -0
  165. data/vendor/local/share/groonga/doc/ja/html/developer/test.html +220 -0
  166. data/vendor/local/share/groonga/doc/ja/html/execfile.html +370 -0
  167. data/vendor/local/share/groonga/doc/ja/html/expr.html +157 -0
  168. data/vendor/local/share/groonga/doc/ja/html/functions.html +122 -0
  169. data/vendor/local/share/groonga/doc/ja/html/functions/edit_distance.html +162 -0
  170. data/vendor/local/share/groonga/doc/ja/html/functions/geo_distance.html +170 -0
  171. data/vendor/local/share/groonga/doc/ja/html/functions/geo_in_circle.html +173 -0
  172. data/vendor/local/share/groonga/doc/ja/html/functions/geo_in_rectangle.html +172 -0
  173. data/vendor/local/share/groonga/doc/ja/html/functions/now.html +152 -0
  174. data/vendor/local/share/groonga/doc/ja/html/functions/rand.html +159 -0
  175. data/vendor/local/share/groonga/doc/ja/html/genindex.html +227 -0
  176. data/vendor/local/share/groonga/doc/ja/html/grnslap.html +183 -0
  177. data/vendor/local/share/groonga/doc/ja/html/grntest.html +368 -0
  178. data/vendor/local/share/groonga/doc/ja/html/http.html +163 -0
  179. data/vendor/local/share/groonga/doc/ja/html/index.html +291 -0
  180. data/vendor/local/share/groonga/doc/ja/html/install.html +228 -0
  181. data/vendor/local/share/groonga/doc/ja/html/news.html +310 -0
  182. data/vendor/local/share/groonga/doc/ja/html/objects.inv +0 -0
  183. data/vendor/local/share/groonga/doc/ja/html/process.html +120 -0
  184. data/vendor/local/share/groonga/doc/ja/html/pseudo_column.html +147 -0
  185. data/vendor/local/share/groonga/doc/ja/html/reference.html +174 -0
  186. data/vendor/local/share/groonga/doc/ja/html/search.html +96 -0
  187. data/vendor/local/share/groonga/doc/ja/html/searchindex.js +1 -0
  188. data/vendor/local/share/groonga/doc/ja/html/tutorial.html +172 -0
  189. data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial01.html +388 -0
  190. data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial02.html +214 -0
  191. data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial03.html +183 -0
  192. data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial04.html +212 -0
  193. data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial05.html +169 -0
  194. data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial06.html +209 -0
  195. data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial07.html +212 -0
  196. data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial08.html +139 -0
  197. data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial09.html +114 -0
  198. data/vendor/local/share/groonga/doc/ja/html/tutorial/tutorial10.html +458 -0
  199. data/vendor/local/share/groonga/doc/ja/html/type.html +217 -0
  200. data/vendor/local/share/groonga/doc/ja/source/__init__.py +0 -0
  201. data/vendor/local/share/groonga/doc/ja/source/characteristic.txt +56 -0
  202. data/vendor/local/share/groonga/doc/ja/source/commands.txt +10 -0
  203. data/vendor/local/share/groonga/doc/ja/source/commands/cache_limit.txt +52 -0
  204. data/vendor/local/share/groonga/doc/ja/source/commands/check.txt +164 -0
  205. data/vendor/local/share/groonga/doc/ja/source/commands/clearlock.txt +61 -0
  206. data/vendor/local/share/groonga/doc/ja/source/commands/column_create.txt +93 -0
  207. data/vendor/local/share/groonga/doc/ja/source/commands/column_list.txt +97 -0
  208. data/vendor/local/share/groonga/doc/ja/source/commands/column_remove.txt +58 -0
  209. data/vendor/local/share/groonga/doc/ja/source/commands/define_selector.txt +114 -0
  210. data/vendor/local/share/groonga/doc/ja/source/commands/defrag.txt +57 -0
  211. data/vendor/local/share/groonga/doc/ja/source/commands/delete.txt +68 -0
  212. data/vendor/local/share/groonga/doc/ja/source/commands/dump.txt +62 -0
  213. data/vendor/local/share/groonga/doc/ja/source/commands/load.txt +98 -0
  214. data/vendor/local/share/groonga/doc/ja/source/commands/log_level.txt +65 -0
  215. data/vendor/local/share/groonga/doc/ja/source/commands/log_put.txt +69 -0
  216. data/vendor/local/share/groonga/doc/ja/source/commands/log_reopen.txt +66 -0
  217. data/vendor/local/share/groonga/doc/ja/source/commands/quit.txt +38 -0
  218. data/vendor/local/share/groonga/doc/ja/source/commands/select.txt +247 -0
  219. data/vendor/local/share/groonga/doc/ja/source/commands/shutdown.txt +38 -0
  220. data/vendor/local/share/groonga/doc/ja/source/commands/status.txt +59 -0
  221. data/vendor/local/share/groonga/doc/ja/source/commands/table_create.txt +111 -0
  222. data/vendor/local/share/groonga/doc/ja/source/commands/table_list.txt +87 -0
  223. data/vendor/local/share/groonga/doc/ja/source/commands/table_remove.txt +50 -0
  224. data/vendor/local/share/groonga/doc/ja/source/commands/view_add.txt +53 -0
  225. data/vendor/local/share/groonga/doc/ja/source/commands_not_implemented/add.txt +102 -0
  226. data/vendor/local/share/groonga/doc/ja/source/commands_not_implemented/get.txt +78 -0
  227. data/vendor/local/share/groonga/doc/ja/source/commands_not_implemented/set.txt +103 -0
  228. data/vendor/local/share/groonga/doc/ja/source/conf.py +265 -0
  229. data/vendor/local/share/groonga/doc/ja/source/developer.txt +10 -0
  230. data/vendor/local/share/groonga/doc/ja/source/developer/com.txt +18 -0
  231. data/vendor/local/share/groonga/doc/ja/source/developer/document.txt +38 -0
  232. data/vendor/local/share/groonga/doc/ja/source/developer/query.txt +212 -0
  233. data/vendor/local/share/groonga/doc/ja/source/developer/test.txt +114 -0
  234. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-1.log +6 -0
  235. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-10.log +5 -0
  236. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-11.log +5 -0
  237. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-12.log +5 -0
  238. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-13.log +5 -0
  239. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-14.log +9 -0
  240. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-15.log +5 -0
  241. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-16.log +5 -0
  242. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-17.log +5 -0
  243. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-2.log +5 -0
  244. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-3.log +5 -0
  245. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-4.log +7 -0
  246. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-5.log +5 -0
  247. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-6.log +5 -0
  248. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-7.log +16 -0
  249. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-8.log +5 -0
  250. data/vendor/local/share/groonga/doc/ja/source/example/tutorial01-9.log +5 -0
  251. data/vendor/local/share/groonga/doc/ja/source/example/tutorial02-1.log +8 -0
  252. data/vendor/local/share/groonga/doc/ja/source/example/tutorial02-2.log +6 -0
  253. data/vendor/local/share/groonga/doc/ja/source/example/tutorial02-3.log +12 -0
  254. data/vendor/local/share/groonga/doc/ja/source/example/tutorial03-1.log +18 -0
  255. data/vendor/local/share/groonga/doc/ja/source/example/tutorial03-2.log +10 -0
  256. data/vendor/local/share/groonga/doc/ja/source/example/tutorial03-3.log +10 -0
  257. data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-1.log +5 -0
  258. data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-2.log +7 -0
  259. data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-3.log +7 -0
  260. data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-4.log +13 -0
  261. data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-5.log +5 -0
  262. data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-6.log +5 -0
  263. data/vendor/local/share/groonga/doc/ja/source/example/tutorial04-7.log +5 -0
  264. data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-1.log +24 -0
  265. data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-2.log +5 -0
  266. data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-3.log +5 -0
  267. data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-4.log +5 -0
  268. data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-5.log +5 -0
  269. data/vendor/local/share/groonga/doc/ja/source/example/tutorial05-6.log +5 -0
  270. data/vendor/local/share/groonga/doc/ja/source/example/tutorial06-1.log +25 -0
  271. data/vendor/local/share/groonga/doc/ja/source/example/tutorial06-2.log +9 -0
  272. data/vendor/local/share/groonga/doc/ja/source/example/tutorial06-3.log +21 -0
  273. data/vendor/local/share/groonga/doc/ja/source/example/tutorial06-4.log +7 -0
  274. data/vendor/local/share/groonga/doc/ja/source/example/tutorial06-5.log +5 -0
  275. data/vendor/local/share/groonga/doc/ja/source/example/tutorial07-1.log +22 -0
  276. data/vendor/local/share/groonga/doc/ja/source/example/tutorial07-2.log +9 -0
  277. data/vendor/local/share/groonga/doc/ja/source/example/tutorial07-3.log +20 -0
  278. data/vendor/local/share/groonga/doc/ja/source/example/tutorial07-4.log +9 -0
  279. data/vendor/local/share/groonga/doc/ja/source/example/tutorial08-1.log +14 -0
  280. data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-1.log +5 -0
  281. data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-10.log +5 -0
  282. data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-2.log +5 -0
  283. data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-3.log +5 -0
  284. data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-4.log +5 -0
  285. data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-5.log +5 -0
  286. data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-6.log +5 -0
  287. data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-7.log +5 -0
  288. data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-8.log +5 -0
  289. data/vendor/local/share/groonga/doc/ja/source/example/tutorial10-9.log +5 -0
  290. data/vendor/local/share/groonga/doc/ja/source/execfile.txt +226 -0
  291. data/vendor/local/share/groonga/doc/ja/source/expr.txt +43 -0
  292. data/vendor/local/share/groonga/doc/ja/source/functions.txt +10 -0
  293. data/vendor/local/share/groonga/doc/ja/source/functions/edit_distance.txt +48 -0
  294. data/vendor/local/share/groonga/doc/ja/source/functions/geo_distance.txt +51 -0
  295. data/vendor/local/share/groonga/doc/ja/source/functions/geo_in_circle.txt +54 -0
  296. data/vendor/local/share/groonga/doc/ja/source/functions/geo_in_rectangle.txt +55 -0
  297. data/vendor/local/share/groonga/doc/ja/source/functions/now.txt +34 -0
  298. data/vendor/local/share/groonga/doc/ja/source/functions/rand.txt +41 -0
  299. data/vendor/local/share/groonga/doc/ja/source/grnslap.txt +64 -0
  300. data/vendor/local/share/groonga/doc/ja/source/grntest.txt +259 -0
  301. data/vendor/local/share/groonga/doc/ja/source/http.txt +52 -0
  302. data/vendor/local/share/groonga/doc/ja/source/index.txt +21 -0
  303. data/vendor/local/share/groonga/doc/ja/source/install.txt +114 -0
  304. data/vendor/local/share/groonga/doc/ja/source/news.txt +199 -0
  305. data/vendor/local/share/groonga/doc/ja/source/process.txt +12 -0
  306. data/vendor/local/share/groonga/doc/ja/source/pseudo_column.txt +38 -0
  307. data/vendor/local/share/groonga/doc/ja/source/rdoc.py +762 -0
  308. data/vendor/local/share/groonga/doc/ja/source/reference.txt +14 -0
  309. data/vendor/local/share/groonga/doc/ja/source/tutorial.txt +10 -0
  310. data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial01.txt +293 -0
  311. data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial02.txt +100 -0
  312. data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial03.txt +72 -0
  313. data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial04.txt +111 -0
  314. data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial05.txt +65 -0
  315. data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial06.txt +91 -0
  316. data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial07.txt +92 -0
  317. data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial08.txt +53 -0
  318. data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial09.txt +9 -0
  319. data/vendor/local/share/groonga/doc/ja/source/tutorial/tutorial10.txt +486 -0
  320. data/vendor/local/share/groonga/doc/ja/source/type.txt +118 -0
  321. data/vendor/local/share/groonga/doc/ja/source/update_execution_example.py +113 -0
  322. data/vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb +46 -0
  323. data/vendor/local/share/groonga/examples/dictionary/edict/edict_import.sh +10 -0
  324. data/vendor/local/share/groonga/examples/dictionary/eijiro/eijiro2grn.rb +61 -0
  325. data/vendor/local/share/groonga/examples/dictionary/eijiro/eijiro_import.sh +10 -0
  326. data/vendor/local/share/groonga/examples/dictionary/gene95/gene2grn.rb +46 -0
  327. data/vendor/local/share/groonga/examples/dictionary/gene95/gene_import.sh +10 -0
  328. data/vendor/local/share/groonga/examples/dictionary/html/css/dictionary.css +3 -0
  329. data/vendor/local/share/groonga/examples/dictionary/html/index.html +26 -0
  330. data/vendor/local/share/groonga/examples/dictionary/html/js/dictionary.js +51 -0
  331. data/vendor/local/share/groonga/examples/dictionary/html/js/jquery-1.4.2.min.js +154 -0
  332. data/vendor/local/share/groonga/examples/dictionary/init_db.sh +10 -0
  333. data/vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb +42 -0
  334. data/vendor/local/share/groonga/examples/dictionary/readme.txt +71 -0
  335. data/vendor/local/share/man/man1/groonga.1 +5498 -0
  336. metadata +360 -118
  337. data/pkg-config.rb +0 -333
  338. data/pkg/rroonga-0.9.5/NEWS.ja.rdoc +0 -156
  339. data/pkg/rroonga-0.9.5/NEWS.rdoc +0 -158
  340. data/pkg/rroonga-0.9.5/README.ja.rdoc +0 -65
  341. data/pkg/rroonga-0.9.5/README.rdoc +0 -66
  342. data/pkg/rroonga-0.9.5/text/TUTORIAL.ja.rdoc +0 -394
  343. data/pkg/rroonga-0.9.5/text/expression.rdoc +0 -285
  344. data/test-unit/Rakefile +0 -40
  345. data/test-unit/TODO +0 -5
  346. data/test-unit/bin/testrb +0 -5
  347. data/test-unit/html/classic.html +0 -15
  348. data/test-unit/html/index.html +0 -25
  349. data/test-unit/html/index.html.ja +0 -27
  350. data/test-unit/lib/test/unit.rb +0 -323
  351. data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
  352. data/test-unit/lib/test/unit/assertions.rb +0 -1230
  353. data/test-unit/lib/test/unit/attribute.rb +0 -125
  354. data/test-unit/lib/test/unit/autorunner.rb +0 -360
  355. data/test-unit/lib/test/unit/collector.rb +0 -36
  356. data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
  357. data/test-unit/lib/test/unit/collector/dir.rb +0 -108
  358. data/test-unit/lib/test/unit/collector/load.rb +0 -144
  359. data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
  360. data/test-unit/lib/test/unit/color-scheme.rb +0 -102
  361. data/test-unit/lib/test/unit/color.rb +0 -96
  362. data/test-unit/lib/test/unit/diff.rb +0 -724
  363. data/test-unit/lib/test/unit/error.rb +0 -130
  364. data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
  365. data/test-unit/lib/test/unit/failure.rb +0 -136
  366. data/test-unit/lib/test/unit/fixture.rb +0 -176
  367. data/test-unit/lib/test/unit/notification.rb +0 -129
  368. data/test-unit/lib/test/unit/omission.rb +0 -191
  369. data/test-unit/lib/test/unit/pending.rb +0 -150
  370. data/test-unit/lib/test/unit/priority.rb +0 -180
  371. data/test-unit/lib/test/unit/runner/console.rb +0 -52
  372. data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
  373. data/test-unit/lib/test/unit/runner/tap.rb +0 -8
  374. data/test-unit/lib/test/unit/testcase.rb +0 -476
  375. data/test-unit/lib/test/unit/testresult.rb +0 -89
  376. data/test-unit/lib/test/unit/testsuite.rb +0 -110
  377. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
  378. data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -466
  379. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
  380. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
  381. data/test-unit/lib/test/unit/ui/testrunner.rb +0 -28
  382. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
  383. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
  384. data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
  385. data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
  386. data/test-unit/lib/test/unit/util/observable.rb +0 -90
  387. data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
  388. data/test-unit/lib/test/unit/version.rb +0 -7
  389. data/test-unit/sample/adder.rb +0 -13
  390. data/test-unit/sample/subtracter.rb +0 -12
  391. data/test-unit/sample/test_adder.rb +0 -20
  392. data/test-unit/sample/test_subtracter.rb +0 -20
  393. data/test-unit/sample/test_user.rb +0 -23
  394. data/test-unit/test/collector/test-descendant.rb +0 -133
  395. data/test-unit/test/collector/test-load.rb +0 -442
  396. data/test-unit/test/collector/test_dir.rb +0 -406
  397. data/test-unit/test/collector/test_objectspace.rb +0 -100
  398. data/test-unit/test/run-test.rb +0 -15
  399. data/test-unit/test/test-attribute.rb +0 -86
  400. data/test-unit/test/test-color-scheme.rb +0 -67
  401. data/test-unit/test/test-color.rb +0 -47
  402. data/test-unit/test/test-diff.rb +0 -518
  403. data/test-unit/test/test-emacs-runner.rb +0 -60
  404. data/test-unit/test/test-fixture.rb +0 -287
  405. data/test-unit/test/test-notification.rb +0 -33
  406. data/test-unit/test/test-omission.rb +0 -81
  407. data/test-unit/test/test-pending.rb +0 -70
  408. data/test-unit/test/test-priority.rb +0 -119
  409. data/test-unit/test/test-testcase.rb +0 -544
  410. data/test-unit/test/test_assertions.rb +0 -1151
  411. data/test-unit/test/test_error.rb +0 -26
  412. data/test-unit/test/test_failure.rb +0 -33
  413. data/test-unit/test/test_testresult.rb +0 -113
  414. data/test-unit/test/test_testsuite.rb +0 -129
  415. data/test-unit/test/testunit-test-util.rb +0 -14
  416. data/test-unit/test/ui/test_testrunmediator.rb +0 -20
  417. data/test-unit/test/util/test-method-owner-finder.rb +0 -38
  418. data/test-unit/test/util/test_backtracefilter.rb +0 -41
  419. data/test-unit/test/util/test_observable.rb +0 -102
  420. data/test-unit/test/util/test_procwrapper.rb +0 -36
  421. data/vendor/local/lib/groonga/modules/functions/cast.dll +0 -0
@@ -1,25 +0,0 @@
1
- #--
2
- #
3
- # Author:: Nathaniel Talbott.
4
- # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
5
- # License:: Ruby license.
6
-
7
- module Test
8
- module Unit
9
-
10
- # Thrown by Test::Unit::Assertions when an assertion fails.
11
- class AssertionFailedError < StandardError
12
- attr_accessor :expected, :actual, :user_message
13
- attr_accessor :inspected_expected, :inspected_actual
14
- def initialize(message=nil, options=nil)
15
- options ||= {}
16
- @expected = options[:expected]
17
- @actual = options[:actual]
18
- @inspected_expected = options[:inspected_expected]
19
- @inspected_actual = options[:inspected_actual]
20
- @user_message = options[:user_message]
21
- super(message)
22
- end
23
- end
24
- end
25
- end
@@ -1,1230 +0,0 @@
1
- # Author:: Nathaniel Talbott.
2
- # Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
3
- # Copyright (c) 2009 Kouhei Sutou.
4
- # License:: Ruby license.
5
-
6
- require 'test/unit/assertionfailederror'
7
- require 'test/unit/util/backtracefilter'
8
- require 'test/unit/util/method-owner-finder'
9
- require 'test/unit/diff'
10
-
11
- module Test
12
- module Unit
13
-
14
- ##
15
- # Test::Unit::Assertions contains the standard Test::Unit assertions.
16
- # Assertions is included in Test::Unit::TestCase.
17
- #
18
- # To include it in your own code and use its functionality, you simply
19
- # need to rescue Test::Unit::AssertionFailedError. Additionally you may
20
- # override add_assertion to get notified whenever an assertion is made.
21
- #
22
- # Notes:
23
- # * The message to each assertion, if given, will be propagated with the
24
- # failure.
25
- # * It is easy to add your own assertions based on assert_block().
26
- #
27
- # = Example Custom Assertion
28
- #
29
- # def deny(boolean, message = nil)
30
- # message = build_message message, '<?> is not false or nil.', boolean
31
- # assert_block message do
32
- # not boolean
33
- # end
34
- # end
35
-
36
- module Assertions
37
-
38
- ##
39
- # The assertion upon which all other assertions are based. Passes if the
40
- # block yields true.
41
- #
42
- # Example:
43
- # assert_block "Couldn't do the thing" do
44
- # do_the_thing
45
- # end
46
-
47
- public
48
- def assert_block(message="assert_block failed.") # :yields:
49
- _wrap_assertion do
50
- if (! yield)
51
- raise AssertionFailedError.new(message.to_s)
52
- end
53
- end
54
- end
55
-
56
- ##
57
- # Asserts that +boolean+ is not false or nil.
58
- #
59
- # Example:
60
- # assert [1, 2].include?(5)
61
-
62
- public
63
- def assert(boolean, message=nil)
64
- _wrap_assertion do
65
- assert_block("assert should not be called with a block.") { !block_given? }
66
- assert_block(build_message(message, "<?> is not true.", boolean)) { boolean }
67
- end
68
- end
69
-
70
- ##
71
- # Passes if +expected+ == +actual.
72
- #
73
- # Note that the ordering of arguments is important, since a helpful
74
- # error message is generated when this one fails that tells you the
75
- # values of expected and actual.
76
- #
77
- # Example:
78
- # assert_equal 'MY STRING', 'my string'.upcase
79
-
80
- public
81
- def assert_equal(expected, actual, message=nil)
82
- diff = AssertionMessage.delayed_diff(expected, actual)
83
- full_message = build_message(message, <<EOT, expected, actual, diff)
84
- <?> expected but was
85
- <?>.?
86
- EOT
87
- begin
88
- assert_block(full_message) { expected == actual }
89
- rescue AssertionFailedError => failure
90
- failure.expected = expected
91
- failure.actual = actual
92
- failure.inspected_expected = AssertionMessage.convert(expected)
93
- failure.inspected_actual = AssertionMessage.convert(actual)
94
- failure.user_message = message
95
- raise
96
- end
97
- end
98
-
99
- ##
100
- # Passes if the block raises one of the expected
101
- # exceptions. When an expected exception is an Exception
102
- # object, passes if expected_exception == actual_exception.
103
- #
104
- # Example:
105
- # assert_raise(RuntimeError, LoadError) do
106
- # raise 'Boom!!!'
107
- # end # -> pass
108
- #
109
- # assert_raise do
110
- # raise Exception, 'Any exception should be raised!!!'
111
- # end # -> pass
112
- #
113
- # assert_raise(RuntimeError.new("XXX")) {raise "XXX"} # -> pass
114
- # assert_raise(MyError.new("XXX")) {raise "XXX"} # -> fail
115
- # assert_raise(RuntimeError.new("ZZZ")) {raise "XXX"} # -> fail
116
- public
117
- def assert_raise(*args, &block)
118
- assert_expected_exception = Proc.new do |*_args|
119
- message, assert_exception_helper, actual_exception = _args
120
- expected = assert_exception_helper.expected_exceptions
121
- full_message = build_message(message,
122
- "<?> exception expected but was\n?",
123
- expected, actual_exception)
124
- assert_block(full_message) do
125
- expected == [] or assert_exception_helper.expected?(actual_exception)
126
- end
127
- end
128
- _assert_raise(assert_expected_exception, *args, &block)
129
- end
130
-
131
- ##
132
- # Alias of assert_raise.
133
- #
134
- # Will be deprecated in 1.9, and removed in 2.0.
135
-
136
- public
137
- def assert_raises(*args, &block)
138
- assert_raise(*args, &block)
139
- end
140
-
141
- ##
142
- # Passes if the block raises one of the given
143
- # exceptions or sub exceptions of the given exceptions.
144
- #
145
- # Example:
146
- # assert_raise_kind_of(SystemCallError) do
147
- # raise Errno::EACCES
148
- # end
149
- def assert_raise_kind_of(*args, &block)
150
- assert_expected_exception = Proc.new do |*_args|
151
- message, assert_exception_helper, actual_exception = _args
152
- expected = assert_exception_helper.expected_exceptions
153
- full_message = build_message(message,
154
- "<?> family exception expected " +
155
- "but was\n?",
156
- expected, actual_exception)
157
- assert_block(full_message) do
158
- assert_exception_helper.expected?(actual_exception, :kind_of?)
159
- end
160
- end
161
- _assert_raise(assert_expected_exception, *args, &block)
162
- end
163
-
164
-
165
- ##
166
- # Passes if +object+.instance_of?(+klass+). When +klass+ is
167
- # an array of classes, it passes if any class
168
- # satisfies +object.instance_of?(class).
169
- #
170
- # Example:
171
- # assert_instance_of(String, 'foo') # -> pass
172
- # assert_instance_of([Fixnum, NilClass], 100) # -> pass
173
- # assert_instance_of([Numeric, NilClass], 100) # -> fail
174
-
175
- public
176
- def assert_instance_of(klass, object, message="")
177
- _wrap_assertion do
178
- klasses = nil
179
- klasses = klass if klass.is_a?(Array)
180
- assert_block("The first parameter to assert_instance_of should be " +
181
- "a Class or an Array of Class.") do
182
- if klasses
183
- klasses.all? {|k| k.is_a?(Class)}
184
- else
185
- klass.is_a?(Class)
186
- end
187
- end
188
- klass_message = AssertionMessage.maybe_container(klass) do |value|
189
- "<#{value}>"
190
- end
191
- full_message = build_message(message, <<EOT, object, klass_message, object.class)
192
- <?> expected to be an instance of
193
- ? but was
194
- <?>.
195
- EOT
196
- assert_block(full_message) do
197
- if klasses
198
- klasses.any? {|k| object.instance_of?(k)}
199
- else
200
- object.instance_of?(klass)
201
- end
202
- end
203
- end
204
- end
205
-
206
- ##
207
- # Passes if +object+ is nil.
208
- #
209
- # Example:
210
- # assert_nil [1, 2].uniq!
211
-
212
- public
213
- def assert_nil(object, message="")
214
- full_message = build_message(message, <<EOT, object)
215
- <?> expected to be nil.
216
- EOT
217
- assert_block(full_message) { object.nil? }
218
- end
219
-
220
- ##
221
- # Passes if +object+.kind_of?(+klass+). When +klass+ is
222
- # an array of classes or modules, it passes if any
223
- # class or module satisfies +object.kind_of?(class_or_module).
224
- #
225
- # Example:
226
- # assert_kind_of(Object, 'foo') # -> pass
227
- # assert_kind_of([Fixnum, NilClass], 100) # -> pass
228
- # assert_kind_of([Fixnum, NilClass], "string") # -> fail
229
-
230
- public
231
- def assert_kind_of(klass, object, message="")
232
- _wrap_assertion do
233
- klasses = nil
234
- klasses = klass if klass.is_a?(Array)
235
- assert_block("The first parameter to assert_kind_of should be " +
236
- "a kind_of Module or an Array of a kind_of Module.") do
237
- if klasses
238
- klasses.all? {|k| k.kind_of?(Module)}
239
- else
240
- klass.kind_of?(Module)
241
- end
242
- end
243
- klass_message = AssertionMessage.maybe_container(klass) do |value|
244
- "<#{value}>"
245
- end
246
- full_message = build_message(message,
247
- "<?> expected to be kind_of\\?\n" +
248
- "? but was\n" +
249
- "<?>.",
250
- object,
251
- klass_message,
252
- object.class)
253
- assert_block(full_message) do
254
- if klasses
255
- klasses.any? {|k| object.kind_of?(k)}
256
- else
257
- object.kind_of?(klass)
258
- end
259
- end
260
- end
261
- end
262
-
263
- ##
264
- # Passes if +object+ .respond_to? +method+
265
- #
266
- # Example:
267
- # assert_respond_to 'bugbear', :slice
268
-
269
- public
270
- def assert_respond_to(object, method, message="")
271
- _wrap_assertion do
272
- full_message = build_message(message,
273
- "<?>.kind_of\\?(Symbol) or\n" +
274
- "<?>.respond_to\\?(:to_str) expected",
275
- method, method)
276
- assert_block(full_message) do
277
- method.kind_of?(Symbol) or method.respond_to?(:to_str)
278
- end
279
- full_message = build_message(message,
280
- "<?>.respond_to\\?(?) expected\n" +
281
- "(Class: <?>)",
282
- object, method, object.class)
283
- assert_block(full_message) {object.respond_to?(method)}
284
- end
285
- end
286
-
287
- ##
288
- # Passes if +string+ =~ +pattern+.
289
- #
290
- # Example:
291
- # assert_match(/\d+/, 'five, 6, seven')
292
-
293
- public
294
- def assert_match(pattern, string, message="")
295
- _wrap_assertion do
296
- pattern = case(pattern)
297
- when String
298
- Regexp.new(Regexp.escape(pattern))
299
- else
300
- pattern
301
- end
302
- full_message = build_message(message, "<?> expected to be =~\n<?>.", string, pattern)
303
- assert_block(full_message) { string =~ pattern }
304
- end
305
- end
306
-
307
- ##
308
- # Passes if +actual+ .equal? +expected+ (i.e. they are the same
309
- # instance).
310
- #
311
- # Example:
312
- # o = Object.new
313
- # assert_same o, o
314
-
315
- public
316
- def assert_same(expected, actual, message="")
317
- full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
318
- <?>
319
- with id <?> expected to be equal\\? to
320
- <?>
321
- with id <?>.
322
- EOT
323
- assert_block(full_message) { actual.equal?(expected) }
324
- end
325
-
326
- ##
327
- # Compares the +object1+ with +object2+ using +operator+.
328
- #
329
- # Passes if object1.__send__(operator, object2) is true.
330
- #
331
- # Example:
332
- # assert_operator 5, :>=, 4
333
-
334
- public
335
- def assert_operator(object1, operator, object2, message="")
336
- _wrap_assertion do
337
- full_message = build_message(nil, "<?>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
338
- assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
339
- full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
340
- <?> expected to be
341
- ?
342
- <?>.
343
- EOT
344
- assert_block(full_message) { object1.__send__(operator, object2) }
345
- end
346
- end
347
-
348
- ##
349
- # Passes if block does not raise an exception.
350
- #
351
- # Example:
352
- # assert_nothing_raised do
353
- # [1, 2].uniq
354
- # end
355
-
356
- public
357
- def assert_nothing_raised(*args)
358
- _wrap_assertion do
359
- if args.last.is_a?(String)
360
- message = args.pop
361
- else
362
- message = ""
363
- end
364
-
365
- assert_exception_helper = AssertExceptionHelper.new(self, args)
366
- begin
367
- yield
368
- rescue Exception => e
369
- if ((args.empty? && !e.instance_of?(AssertionFailedError)) ||
370
- assert_exception_helper.expected?(e))
371
- failure_message = build_message(message, "Exception raised:\n?", e)
372
- assert_block(failure_message) {false}
373
- else
374
- raise
375
- end
376
- end
377
- nil
378
- end
379
- end
380
-
381
- ##
382
- # Flunk always fails.
383
- #
384
- # Example:
385
- # flunk 'Not done testing yet.'
386
-
387
- public
388
- def flunk(message="Flunked")
389
- assert_block(build_message(message)){false}
390
- end
391
-
392
- ##
393
- # Passes if ! +actual+ .equal? +expected+
394
- #
395
- # Example:
396
- # assert_not_same Object.new, Object.new
397
-
398
- public
399
- def assert_not_same(expected, actual, message="")
400
- full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
401
- <?>
402
- with id <?> expected to not be equal\\? to
403
- <?>
404
- with id <?>.
405
- EOT
406
- assert_block(full_message) { !actual.equal?(expected) }
407
- end
408
-
409
- ##
410
- # Passes if +expected+ != +actual+
411
- #
412
- # Example:
413
- # assert_not_equal 'some string', 5
414
-
415
- public
416
- def assert_not_equal(expected, actual, message="")
417
- full_message = build_message(message, "<?> expected to be != to\n<?>.", expected, actual)
418
- assert_block(full_message) { expected != actual }
419
- end
420
-
421
- ##
422
- # Passes if ! +object+ .nil?
423
- #
424
- # Example:
425
- # assert_not_nil '1 two 3'.sub!(/two/, '2')
426
-
427
- public
428
- def assert_not_nil(object, message="")
429
- full_message = build_message(message, "<?> expected to not be nil.", object)
430
- assert_block(full_message){!object.nil?}
431
- end
432
-
433
- ##
434
- # Passes if +regexp+ !~ +string+
435
- #
436
- # Example:
437
- # assert_no_match(/two/, 'one 2 three')
438
-
439
- public
440
- def assert_no_match(regexp, string, message="")
441
- _wrap_assertion do
442
- assert_instance_of(Regexp, regexp, "The first argument to assert_no_match should be a Regexp.")
443
- full_message = build_message(message, "<?> expected to not match\n<?>.", regexp, string)
444
- assert_block(full_message) { regexp !~ string }
445
- end
446
- end
447
-
448
- UncaughtThrow = {
449
- NameError => /^uncaught throw \`(.+)\'$/,
450
- ArgumentError => /^uncaught throw (.+)$/,
451
- ThreadError => /^uncaught throw \`(.+)\' in thread /
452
- } #`
453
-
454
- ##
455
- # Passes if the block throws +expected_object+
456
- #
457
- # Example:
458
- # assert_throw(:done) do
459
- # throw(:done)
460
- # end
461
-
462
- public
463
- def assert_throw(expected_object, message="", &proc)
464
- _wrap_assertion do
465
- begin
466
- catch([]) {}
467
- rescue TypeError
468
- assert_instance_of(Symbol, expected_object,
469
- "assert_throws expects the symbol that should be thrown for its first argument")
470
- end
471
- assert_block("Should have passed a block to assert_throw.") do
472
- block_given?
473
- end
474
- caught = true
475
- begin
476
- catch(expected_object) do
477
- proc.call
478
- caught = false
479
- end
480
- full_message = build_message(message,
481
- "<?> should have been thrown.",
482
- expected_object)
483
- assert_block(full_message) {caught}
484
- rescue NameError, ArgumentError, ThreadError => error
485
- raise unless UncaughtThrow[error.class] =~ error.message
486
- tag = $1
487
- tag = tag[1..-1].intern if tag[0, 1] == ":"
488
- full_message = build_message(message,
489
- "<?> expected to be thrown but\n" +
490
- "<?> was thrown.",
491
- expected_object, tag)
492
- flunk(full_message)
493
- end
494
- end
495
- end
496
-
497
- ##
498
- # Alias of assert_throw.
499
- #
500
- # Will be deprecated in 1.9, and removed in 2.0.
501
- def assert_throws(*args, &block)
502
- assert_throw(*args, &block)
503
- end
504
-
505
- ##
506
- # Passes if block does not throw anything.
507
- #
508
- # Example:
509
- # assert_nothing_thrown do
510
- # [1, 2].uniq
511
- # end
512
-
513
- public
514
- def assert_nothing_thrown(message="", &proc)
515
- _wrap_assertion do
516
- assert(block_given?, "Should have passed a block to assert_nothing_thrown")
517
- begin
518
- proc.call
519
- rescue NameError, ArgumentError, ThreadError => error
520
- raise unless UncaughtThrow[error.class] =~ error.message
521
- tag = $1
522
- tag = tag[1..-1].intern if tag[0, 1] == ":"
523
- full_message = build_message(message,
524
- "<?> was thrown when nothing was expected",
525
- tag)
526
- flunk(full_message)
527
- end
528
- assert(true, "Expected nothing to be thrown")
529
- end
530
- end
531
-
532
- ##
533
- # Passes if +expected_float+ and +actual_float+ are equal
534
- # within +delta+ tolerance.
535
- #
536
- # Example:
537
- # assert_in_delta 0.05, (50000.0 / 10**6), 0.00001
538
-
539
- public
540
- def assert_in_delta(expected_float, actual_float, delta, message="")
541
- _wrap_assertion do
542
- {expected_float => "first float", actual_float => "second float", delta => "delta"}.each do |float, name|
543
- assert_respond_to(float, :to_f, "The arguments must respond to to_f; the #{name} did not")
544
- end
545
- assert_operator(delta, :>=, 0.0, "The delta should not be negative")
546
- full_message = build_message(message, <<EOT, expected_float, actual_float, delta)
547
- <?> and
548
- <?> expected to be within
549
- <?> of each other.
550
- EOT
551
- assert_block(full_message) { (expected_float.to_f - actual_float.to_f).abs <= delta.to_f }
552
- end
553
- end
554
-
555
- ##
556
- # Passes if the method send returns a true value.
557
- #
558
- # +send_array+ is composed of:
559
- # * A receiver
560
- # * A method
561
- # * Arguments to the method
562
- #
563
- # Example:
564
- # assert_send [[1, 2], :include?, 4]
565
-
566
- public
567
- def assert_send(send_array, message="")
568
- _wrap_assertion do
569
- assert_instance_of(Array, send_array, "assert_send requires an array of send information")
570
- assert(send_array.size >= 2, "assert_send requires at least a receiver and a message name")
571
- full_message = build_message(message, <<EOT, send_array[0], AssertionMessage.literal(send_array[1].to_s), send_array[2..-1])
572
- <?> expected to respond to
573
- <?(?)> with a true value.
574
- EOT
575
- assert_block(full_message) { send_array[0].__send__(send_array[1], *send_array[2..-1]) }
576
- end
577
- end
578
-
579
- ##
580
- # Passes if +actual+ is a boolean value.
581
- #
582
- # Example:
583
- # assert_boolean(true) # -> pass
584
- # assert_boolean(nil) # -> fail
585
- def assert_boolean(actual, message=nil)
586
- _wrap_assertion do
587
- assert_block(build_message(message,
588
- "<true> or <false> expected but was\n<?>",
589
- actual)) do
590
- [true, false].include?(actual)
591
- end
592
- end
593
- end
594
-
595
- ##
596
- # Passes if +actual+ is true.
597
- #
598
- # Example:
599
- # assert_true(true) # -> pass
600
- # assert_true(:true) # -> fail
601
- def assert_true(actual, message=nil)
602
- _wrap_assertion do
603
- assert_block(build_message(message,
604
- "<true> expected but was\n<?>",
605
- actual)) do
606
- actual == true
607
- end
608
- end
609
- end
610
-
611
- ##
612
- # Passes if +actual+ is false.
613
- #
614
- # Example:
615
- # assert_false(false) # -> pass
616
- # assert_false(nil) # -> fail
617
- def assert_false(actual, message=nil)
618
- _wrap_assertion do
619
- assert_block(build_message(message,
620
- "<false> expected but was\n<?>",
621
- actual)) do
622
- actual == false
623
- end
624
- end
625
- end
626
-
627
- ##
628
- # Passes if expression "+expected+ +operator+
629
- # +actual+" is true.
630
- #
631
- # Example:
632
- # assert_compare(1, "<", 10) # -> pass
633
- # assert_compare(1, ">=", 10) # -> fail
634
- def assert_compare(expected, operator, actual, message=nil)
635
- _wrap_assertion do
636
- assert_send([["<", "<=", ">", ">="], :include?, operator.to_s])
637
- case operator.to_s
638
- when "<"
639
- operator_description = "less than"
640
- when "<="
641
- operator_description = "less than or equal to"
642
- when ">"
643
- operator_description = "greater than"
644
- when ">="
645
- operator_description = "greater than or equal to"
646
- end
647
- template = <<-EOT
648
- <?> #{operator} <?> should be true
649
- <?> expected #{operator_description}
650
- <?>.
651
- EOT
652
- full_message = build_message(message, template,
653
- expected, actual,
654
- expected, actual)
655
- assert_block(full_message) do
656
- expected.send(operator, actual)
657
- end
658
- end
659
- end
660
-
661
- ##
662
- # Passes if assertion is failed in block.
663
- #
664
- # Example:
665
- # assert_fail_assertion {assert_equal("A", "B")} # -> pass
666
- # assert_fail_assertion {assert_equal("A", "A")} # -> fail
667
- def assert_fail_assertion(message=nil)
668
- _wrap_assertion do
669
- full_message = build_message(message,
670
- "Failed assertion was expected.")
671
- assert_block(full_message) do
672
- begin
673
- yield
674
- false
675
- rescue AssertionFailedError
676
- true
677
- end
678
- end
679
- end
680
- end
681
-
682
- ##
683
- # Passes if an exception is raised in block and its
684
- # message is +expected+.
685
- #
686
- # Example:
687
- # assert_raise_message("exception") {raise "exception"} # -> pass
688
- # assert_raise_message(/exc/i) {raise "exception"} # -> pass
689
- # assert_raise_message("exception") {raise "EXCEPTION"} # -> fail
690
- # assert_raise_message("exception") {} # -> fail
691
- def assert_raise_message(expected, message=nil)
692
- _wrap_assertion do
693
- full_message = build_message(message,
694
- "<?> exception message expected " +
695
- "but none was thrown.",
696
- expected)
697
- exception = nil
698
- assert_block(full_message) do
699
- begin
700
- yield
701
- false
702
- rescue Exception => exception
703
- true
704
- end
705
- end
706
-
707
- actual = exception.message
708
- diff = AssertionMessage.delayed_diff(expected, actual)
709
- full_message =
710
- build_message(message,
711
- "<?> exception message expected but was\n" +
712
- "<?>.?", expected, actual, diff)
713
- assert_block(full_message) do
714
- if expected.is_a?(Regexp)
715
- expected =~ actual
716
- else
717
- expected == actual
718
- end
719
- end
720
- end
721
- end
722
-
723
- ##
724
- # Passes if +object+.const_defined?(+constant_name+)
725
- #
726
- # Example:
727
- # assert_const_defined(Test, :Unit) # -> pass
728
- # assert_const_defined(Object, :Nonexistent) # -> fail
729
- def assert_const_defined(object, constant_name, message=nil)
730
- _wrap_assertion do
731
- full_message = build_message(message,
732
- "<?>.const_defined\\?(<?>) expected.",
733
- object, constant_name)
734
- assert_block(full_message) do
735
- object.const_defined?(constant_name)
736
- end
737
- end
738
- end
739
-
740
- ##
741
- # Passes if !+object+.const_defined?(+constant_name+)
742
- #
743
- # Example:
744
- # assert_not_const_defined(Object, :Nonexistent) # -> pass
745
- # assert_not_const_defined(Test, :Unit) # -> fail
746
- def assert_not_const_defined(object, constant_name, message=nil)
747
- _wrap_assertion do
748
- full_message = build_message(message,
749
- "!<?>.const_defined\\?(<?>) expected.",
750
- object, constant_name)
751
- assert_block(full_message) do
752
- !object.const_defined?(constant_name)
753
- end
754
- end
755
- end
756
-
757
- ##
758
- # Passes if +object+.+predicate+
759
- #
760
- # Example:
761
- # assert_predicate([], :empty?) # -> pass
762
- # assert_predicate([1], :empty?) # -> fail
763
- def assert_predicate(object, predicate, message=nil)
764
- _wrap_assertion do
765
- assert_respond_to(object, predicate, message)
766
- actual = object.send(predicate)
767
- full_message = build_message(message,
768
- "<?>.? is true value expected but was\n" +
769
- "<?>",
770
- object,
771
- AssertionMessage.literal(predicate),
772
- actual)
773
- assert_block(full_message) do
774
- actual
775
- end
776
- end
777
- end
778
-
779
- ##
780
- # Passes if +object+.+predicate+
781
- #
782
- # Example:
783
- # assert_not_predicate([1], :empty?) # -> pass
784
- # assert_not_predicate([], :empty?) # -> fail
785
- def assert_not_predicate(object, predicate, message=nil)
786
- _wrap_assertion do
787
- assert_respond_to(object, predicate, message)
788
- actual = object.send(predicate)
789
- full_message = build_message(message,
790
- "<?>.? is false value expected but was\n" +
791
- "<?>",
792
- object,
793
- AssertionMessage.literal(predicate),
794
- actual)
795
- assert_block(full_message) do
796
- not actual
797
- end
798
- end
799
- end
800
-
801
- ##
802
- # Passes if +object+#+alias_name+ is an alias method of
803
- # +object+#+original_name+.
804
- #
805
- # Example:
806
- # assert_alias_method([], :length, :size) # -> pass
807
- # assert_alias_method([], :size, :length) # -> pass
808
- # assert_alias_method([], :each, :size) # -> fail
809
- def assert_alias_method(object, alias_name, original_name, message=nil)
810
- _wrap_assertion do
811
- find_method_failure_message = Proc.new do |method_name|
812
- build_message(message,
813
- "<?>.? doesn't exist\n" +
814
- "(Class: <?>)",
815
- object,
816
- AssertionMessage.literal(method_name),
817
- object.class)
818
- end
819
-
820
- alias_method = original_method = nil
821
- assert_block(find_method_failure_message.call(alias_name)) do
822
- begin
823
- alias_method = object.method(alias_name)
824
- true
825
- rescue NameError
826
- false
827
- end
828
- end
829
- assert_block(find_method_failure_message.call(original_name)) do
830
- begin
831
- original_method = object.method(original_name)
832
- true
833
- rescue NameError
834
- false
835
- end
836
- end
837
-
838
- full_message = build_message(message,
839
- "<?> is alias of\n" +
840
- "<?> expected",
841
- alias_method,
842
- original_method)
843
- assert_block(full_message) do
844
- alias_method == original_method
845
- end
846
- end
847
- end
848
-
849
- ##
850
- # Builds a failure message. +head+ is added before the +template+ and
851
- # +arguments+ replaces the '?'s positionally in the template.
852
-
853
- public
854
- def build_message(head, template=nil, *arguments)
855
- template &&= template.chomp
856
- return AssertionMessage.new(head, template, arguments)
857
- end
858
-
859
- private
860
- def _wrap_assertion
861
- @_assertion_wrapped ||= false
862
- unless (@_assertion_wrapped)
863
- @_assertion_wrapped = true
864
- begin
865
- add_assertion
866
- return yield
867
- ensure
868
- @_assertion_wrapped = false
869
- end
870
- else
871
- return yield
872
- end
873
- end
874
-
875
- ##
876
- # Called whenever an assertion is made. Define this in classes that
877
- # include Test::Unit::Assertions to record assertion counts.
878
-
879
- private
880
- def add_assertion
881
- end
882
-
883
- ##
884
- # Select whether or not to use the pretty-printer. If this option is set
885
- # to false before any assertions are made, pp.rb will not be required.
886
-
887
- public
888
- def self.use_pp=(value)
889
- AssertionMessage.use_pp = value
890
- end
891
-
892
- # :stopdoc:
893
- private
894
- def _assert_raise(assert_expected_exception, *args, &block)
895
- _wrap_assertion do
896
- if args.last.is_a?(String)
897
- message = args.pop
898
- else
899
- message = ""
900
- end
901
-
902
- assert_exception_helper = AssertExceptionHelper.new(self, args)
903
- expected = assert_exception_helper.expected_exceptions
904
- actual_exception = nil
905
- full_message = build_message(message,
906
- "<?> exception expected " +
907
- "but none was thrown.",
908
- expected)
909
- assert_block(full_message) do
910
- begin
911
- yield
912
- false
913
- rescue Exception => actual_exception
914
- true
915
- end
916
- end
917
- assert_expected_exception.call(message, assert_exception_helper,
918
- actual_exception)
919
- actual_exception
920
- end
921
- end
922
-
923
- class AssertionMessage
924
- @use_pp = true
925
- class << self
926
- attr_accessor :use_pp
927
-
928
- def literal(value)
929
- Literal.new(value)
930
- end
931
-
932
- def delayed_literal(&block)
933
- DelayedLiteral.new(block)
934
- end
935
-
936
- def maybe_container(value, &formatter)
937
- MaybeContainer.new(value, &formatter)
938
- end
939
-
940
- MAX_DIFF_TARGET_STRING_SIZE = 1000
941
- def max_diff_target_string_size
942
- size = ENV["TEST_UNIT_MAX_DIFF_TARGET_STRING_SIZE"]
943
- if size
944
- begin
945
- size = Integer(size)
946
- rescue ArgumentError
947
- size = nil
948
- end
949
- end
950
- size || MAX_DIFF_TARGET_STRING_SIZE
951
- end
952
-
953
- def diff_target_string?(string)
954
- if string.respond_to?(:bytesize)
955
- string.bytesize < max_diff_target_string_size
956
- else
957
- string.size < max_diff_target_string_size
958
- end
959
- end
960
-
961
- def prepare_for_diff(from, to)
962
- if !from.is_a?(String) or !to.is_a?(String)
963
- from = convert(from)
964
- to = convert(to)
965
- end
966
-
967
- if diff_target_string?(from) and diff_target_string?(to)
968
- [from, to]
969
- else
970
- [nil, nil]
971
- end
972
- end
973
-
974
- def delayed_diff(from, to)
975
- delayed_literal do
976
- from, to = prepare_for_diff(from, to)
977
-
978
- diff = "" if from.nil? or to.nil?
979
- diff ||= Diff.readable(from, to)
980
- if /^[-+]/ !~ diff
981
- diff = ""
982
- elsif /^[ ?]/ =~ diff or /(?:.*\n){2,}/ =~ diff
983
- diff = "\n\ndiff:\n#{diff}"
984
- else
985
- diff = ""
986
- end
987
-
988
- if Diff.need_fold?(diff)
989
- folded_diff = Diff.folded_readable(from, to)
990
- diff << "\n\nfolded diff:\n#{folded_diff}"
991
- end
992
-
993
- diff
994
- end
995
- end
996
-
997
- def convert(object)
998
- case object
999
- when Exception
1000
- <<EOM.chop
1001
- Class: <#{convert(object.class)}>
1002
- Message: <#{convert(object.message)}>
1003
- ---Backtrace---
1004
- #{Util::BacktraceFilter.filter_backtrace(object.backtrace).join("\n")}
1005
- ---------------
1006
- EOM
1007
- else
1008
- if use_pp
1009
- begin
1010
- require 'pp' unless defined?(PP)
1011
- begin
1012
- return PP.pp(object, '').chomp
1013
- rescue NameError
1014
- end
1015
- rescue LoadError
1016
- self.use_pp = false
1017
- end
1018
- end
1019
- object.inspect
1020
- end
1021
- end
1022
- end
1023
-
1024
- class Literal
1025
- def initialize(value)
1026
- @value = value
1027
- end
1028
-
1029
- def inspect
1030
- @value.to_s
1031
- end
1032
- end
1033
-
1034
- class DelayedLiteral
1035
- def initialize(value)
1036
- @value = value
1037
- end
1038
-
1039
- def inspect
1040
- @value.call.to_s
1041
- end
1042
- end
1043
-
1044
- class MaybeContainer
1045
- def initialize(value, &formatter)
1046
- @value = value
1047
- @formatter = formatter
1048
- end
1049
-
1050
- def inspect
1051
- if @value.is_a?(Array)
1052
- values = @value.collect do |value|
1053
- @formatter.call(AssertionMessage.convert(value))
1054
- end
1055
- "[#{values.join(', ')}]"
1056
- else
1057
- @formatter.call(AssertionMessage.convert(@value))
1058
- end
1059
- end
1060
- end
1061
-
1062
- class Template
1063
- def self.create(string)
1064
- parts = (string ? string.scan(/(?=[^\\])\?|(?:\\\?|[^\?])+/m) : [])
1065
- self.new(parts)
1066
- end
1067
-
1068
- attr_reader :count
1069
-
1070
- def initialize(parts)
1071
- @parts = parts
1072
- @count = parts.find_all{|e| e == '?'}.size
1073
- end
1074
-
1075
- def result(parameters)
1076
- raise "The number of parameters does not match the number of substitutions." if(parameters.size != count)
1077
- params = parameters.dup
1078
- @parts.collect{|e| e == '?' ? params.shift : e.gsub(/\\\?/m, '?')}.join('')
1079
- end
1080
- end
1081
-
1082
- include Util::BacktraceFilter
1083
-
1084
- def initialize(head, template_string, parameters)
1085
- @head = head
1086
- @template_string = template_string
1087
- @parameters = parameters
1088
- end
1089
-
1090
- def convert(object)
1091
- self.class.convert(object)
1092
- end
1093
-
1094
- def template
1095
- @template ||= Template.create(@template_string)
1096
- end
1097
-
1098
- def add_period(string)
1099
- (string =~ /\.\Z/ ? string : string + '.')
1100
- end
1101
-
1102
- def to_s
1103
- message_parts = []
1104
- if (@head)
1105
- head = @head.to_s
1106
- unless(head.empty?)
1107
- message_parts << add_period(head)
1108
- end
1109
- end
1110
- tail = template.result(@parameters.collect{|e| convert(e)})
1111
- message_parts << tail unless(tail.empty?)
1112
- message_parts.join("\n")
1113
- end
1114
- end
1115
-
1116
- class AssertExceptionHelper
1117
- class WrappedException
1118
- def initialize(exception)
1119
- @exception = exception
1120
- end
1121
-
1122
- def inspect
1123
- if default_inspect?
1124
- "#{@exception.class.inspect}(#{@exception.message.inspect})"
1125
- else
1126
- @exception.inspect
1127
- end
1128
- end
1129
-
1130
- def method_missing(name, *args, &block)
1131
- @exception.send(name, *args, &block)
1132
- end
1133
-
1134
- private
1135
- def default_inspect?
1136
- inspect_method = @exception.method(:inspect)
1137
- if inspect_method.respond_to?(:owner) and
1138
- inspect_method.owner == Exception
1139
- true
1140
- else
1141
- default_inspect_method = Exception.instance_method(:inspect)
1142
- default_inspect_method.bind(@exception).call == @exception.inspect
1143
- end
1144
- end
1145
- end
1146
-
1147
- def initialize(test_case, expected_exceptions)
1148
- @test_case = test_case
1149
- @expected_exceptions = expected_exceptions
1150
- @expected_classes, @expected_modules, @expected_objects =
1151
- split_expected_exceptions(expected_exceptions)
1152
- end
1153
-
1154
- def expected_exceptions
1155
- exceptions = @expected_exceptions.collect do |exception|
1156
- if exception.is_a?(Exception)
1157
- WrappedException.new(exception)
1158
- else
1159
- exception
1160
- end
1161
- end
1162
- if exceptions.size == 1
1163
- exceptions[0]
1164
- else
1165
- exceptions
1166
- end
1167
- end
1168
-
1169
- def expected?(actual_exception, equality=nil)
1170
- equality ||= :instance_of?
1171
- expected_class?(actual_exception, equality) or
1172
- expected_module?(actual_exception) or
1173
- expected_object?(actual_exception)
1174
- end
1175
-
1176
- private
1177
- def split_expected_exceptions(expected_exceptions)
1178
- exception_modules = []
1179
- exception_objects = []
1180
- exception_classes = []
1181
- expected_exceptions.each do |exception_type|
1182
- if exception_type.instance_of?(Module)
1183
- exception_modules << exception_type
1184
- elsif exception_type.is_a?(Exception)
1185
- exception_objects << exception_type
1186
- else
1187
- @test_case.send(:assert,
1188
- Exception >= exception_type,
1189
- "Should expect a class of exception, " +
1190
- "#{exception_type}")
1191
- exception_classes << exception_type
1192
- end
1193
- end
1194
- [exception_classes, exception_modules, exception_objects]
1195
- end
1196
-
1197
- def expected_class?(actual_exception, equality)
1198
- @expected_classes.any? do |expected_class|
1199
- actual_exception.send(equality, expected_class)
1200
- end
1201
- end
1202
-
1203
- def expected_module?(actual_exception)
1204
- @expected_modules.any? do |expected_module|
1205
- actual_exception.is_a?(expected_module)
1206
- end
1207
- end
1208
-
1209
- def expected_object?(actual_exception)
1210
- @expected_objects.any? do |expected_object|
1211
- expected_object == actual_exception or
1212
- fallback_exception_object_equal(expected_object, actual_exception)
1213
- end
1214
- end
1215
-
1216
- def fallback_exception_object_equal(expected_object, actual_exception)
1217
- owner = Util::MethodOwnerFinder.find(expected_object, :==)
1218
- if owner == Kernel or owner == Exception
1219
- expected_object.class == actual_exception.class and
1220
- expected_object.message == actual_exception.message
1221
- else
1222
- false
1223
- end
1224
- end
1225
- end
1226
-
1227
- # :startdoc:
1228
- end
1229
- end
1230
- end