glib2 0.90.8-x86-mingw32 → 0.90.9-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (620) hide show
  1. data/ChangeLog +46 -0
  2. data/Rakefile +1 -0
  3. data/ext/glib2/rbglib.h +1 -1
  4. data/ext/glib2/rbglib_iochannel.c +15 -6
  5. data/ext/glib2/rbgobj_signal.c +1 -1
  6. data/ext/glib2/rbgobject.h +1 -1
  7. data/lib/1.8/glib2.so +0 -0
  8. data/lib/1.9/glib2.so +0 -0
  9. data/lib/gnome2-raketask.rb +3 -2
  10. data/lib/mkmf-gnome2.rb +47 -23
  11. data/test/glib-test-init.rb +1 -3
  12. data/vendor/local/bin/glib-genmarshal.exe +0 -0
  13. data/vendor/local/bin/glib-gettextize +2 -2
  14. data/vendor/local/bin/glib-mkenums +3 -2
  15. data/vendor/local/bin/gobject-query.exe +0 -0
  16. data/vendor/local/bin/gspawn-win32-helper-console.exe +0 -0
  17. data/vendor/local/bin/gspawn-win32-helper.exe +0 -0
  18. data/vendor/local/bin/libgio-2.0-0.dll +0 -0
  19. data/vendor/local/bin/libglib-2.0-0.dll +0 -0
  20. data/vendor/local/bin/libgmodule-2.0-0.dll +0 -0
  21. data/vendor/local/bin/libgobject-2.0-0.dll +0 -0
  22. data/vendor/local/bin/libgthread-2.0-0.dll +0 -0
  23. data/vendor/local/include/glib-2.0/gio/gaction.h +91 -0
  24. data/vendor/local/include/glib-2.0/gio/gactiongroup.h +151 -0
  25. data/vendor/local/include/glib-2.0/gio/gappinfo.h +11 -1
  26. data/vendor/local/include/glib-2.0/gio/gapplication.h +165 -0
  27. data/vendor/local/include/glib-2.0/gio/gapplicationcommandline.h +118 -0
  28. data/vendor/local/include/glib-2.0/gio/gasyncresult.h +2 -2
  29. data/vendor/local/include/glib-2.0/gio/gcancellable.h +2 -0
  30. data/vendor/local/include/glib-2.0/gio/gemblemedicon.h +15 -0
  31. data/vendor/local/include/glib-2.0/gio/gfileenumerator.h +2 -2
  32. data/vendor/local/include/glib-2.0/gio/gfileinputstream.h +1 -1
  33. data/vendor/local/include/glib-2.0/gio/gfileiostream.h +1 -1
  34. data/vendor/local/include/glib-2.0/gio/gfilemonitor.h +1 -1
  35. data/vendor/local/include/glib-2.0/gio/gfileoutputstream.h +1 -1
  36. data/vendor/local/include/glib-2.0/gio/gio.h +14 -0
  37. data/vendor/local/include/glib-2.0/gio/gioenums.h +158 -2
  38. data/vendor/local/include/glib-2.0/gio/gioenumtypes.h +12 -0
  39. data/vendor/local/include/glib-2.0/gio/giomodule.h +1 -1
  40. data/vendor/local/include/glib-2.0/gio/giostream.h +11 -0
  41. data/vendor/local/include/glib-2.0/gio/giotypes.h +48 -0
  42. data/vendor/local/include/glib-2.0/gio/goutputstream.h +1 -1
  43. data/vendor/local/include/glib-2.0/gio/gpollableinputstream.h +101 -0
  44. data/vendor/local/include/glib-2.0/gio/gpollableoutputstream.h +98 -0
  45. data/vendor/local/include/glib-2.0/gio/gsettings.h +9 -2
  46. data/vendor/local/include/glib-2.0/gio/gsettingsbackend.h +6 -0
  47. data/vendor/local/include/glib-2.0/gio/gsimpleaction.h +95 -0
  48. data/vendor/local/include/glib-2.0/gio/gsimpleactiongroup.h +87 -0
  49. data/vendor/local/include/glib-2.0/gio/gsimpleasyncresult.h +11 -1
  50. data/vendor/local/include/glib-2.0/gio/gsocketclient.h +7 -0
  51. data/vendor/local/include/glib-2.0/gio/gtcpwrapperconnection.h +68 -0
  52. data/vendor/local/include/glib-2.0/gio/gtlsbackend.h +92 -0
  53. data/vendor/local/include/glib-2.0/gio/gtlscertificate.h +83 -0
  54. data/vendor/local/include/glib-2.0/gio/gtlsclientconnection.h +72 -0
  55. data/vendor/local/include/glib-2.0/gio/gtlsconnection.h +136 -0
  56. data/vendor/local/include/glib-2.0/gio/gtlsserverconnection.h +61 -0
  57. data/vendor/local/include/glib-2.0/glib/glist.h +2 -0
  58. data/vendor/local/include/glib-2.0/glib/gmain.h +27 -6
  59. data/vendor/local/include/glib-2.0/glib/gmarkup.h +80 -5
  60. data/vendor/local/include/glib-2.0/glib/grand.h +1 -1
  61. data/vendor/local/include/glib-2.0/glib/gsequence.h +8 -0
  62. data/vendor/local/include/glib-2.0/glib/gslist.h +2 -0
  63. data/vendor/local/include/glib-2.0/glib/gtimezone.h +37 -0
  64. data/vendor/local/include/glib-2.0/glib/gtypes.h +1 -0
  65. data/vendor/local/include/glib-2.0/glib/gunicode.h +22 -16
  66. data/vendor/local/include/glib-2.0/glib/gutils.h +5 -0
  67. data/vendor/local/include/glib-2.0/glib/gvariant.h +35 -11
  68. data/vendor/local/include/glib-2.0/gobject/gobject.h +15 -0
  69. data/vendor/local/include/glib-2.0/gobject/gsignal.h +5 -0
  70. data/vendor/local/include/glib-2.0/gobject/gsourceclosure.h +4 -2
  71. data/vendor/local/include/glib-2.0/gobject/gtypemodule.h +1 -1
  72. data/vendor/local/lib/gio-2.0.def +142 -0
  73. data/vendor/local/lib/gio-2.0.lib +0 -0
  74. data/vendor/local/lib/glib-2.0.def +21 -0
  75. data/vendor/local/lib/glib-2.0.lib +0 -0
  76. data/vendor/local/lib/glib-2.0/include/glibconfig.h +1 -1
  77. data/vendor/local/lib/gmodule-2.0.lib +0 -0
  78. data/vendor/local/lib/gobject-2.0.def +3 -0
  79. data/vendor/local/lib/gobject-2.0.lib +0 -0
  80. data/vendor/local/lib/gthread-2.0.lib +0 -0
  81. data/vendor/local/lib/libgio-2.0.dll.a +0 -0
  82. data/vendor/local/lib/libglib-2.0.dll.a +0 -0
  83. data/vendor/local/lib/libgmodule-2.0.dll.a +0 -0
  84. data/vendor/local/lib/libgobject-2.0.dll.a +0 -0
  85. data/vendor/local/lib/libgthread-2.0.dll.a +0 -0
  86. data/vendor/local/lib/pkgconfig/gio-2.0.pc +2 -2
  87. data/vendor/local/lib/pkgconfig/gio-windows-2.0.pc +1 -1
  88. data/vendor/local/lib/pkgconfig/glib-2.0.pc +1 -1
  89. data/vendor/local/lib/pkgconfig/gmodule-2.0.pc +1 -1
  90. data/vendor/local/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
  91. data/vendor/local/lib/pkgconfig/gobject-2.0.pc +1 -1
  92. data/vendor/local/lib/pkgconfig/gthread-2.0.pc +1 -1
  93. data/vendor/local/manifest/{glib-dev_2.26.1-1_win32.mft → glib-dev_2.28.1-1_win32.mft} +55 -19
  94. data/vendor/local/manifest/{glib_2.26.1-1_win32.mft → glib_2.28.1-1_win32.mft} +3 -2
  95. data/vendor/local/share/aclocal/glib-2.0.m4 +4 -4
  96. data/vendor/local/share/doc/{glib-2.26.1 → glib-2.28.1}/COPYING +0 -0
  97. data/vendor/local/share/doc/{glib-dev-2.26.1 → glib-dev-2.28.1}/COPYING +0 -0
  98. data/vendor/local/share/glib-2.0/gettext/mkinstalldirs +72 -21
  99. data/vendor/local/share/glib-2.0/schemas/gschema.dtd +21 -8
  100. data/vendor/local/share/gtk-doc/html/gio/GAction.html +469 -0
  101. data/vendor/local/share/gtk-doc/html/gio/GActionGroup.html +754 -0
  102. data/vendor/local/share/gtk-doc/html/gio/GAppInfo.html +296 -249
  103. data/vendor/local/share/gtk-doc/html/gio/GApplication.html +1458 -0
  104. data/vendor/local/share/gtk-doc/html/gio/GApplicationCommandLine.html +815 -0
  105. data/vendor/local/share/gtk-doc/html/gio/GAsyncInitable.html +61 -97
  106. data/vendor/local/share/gtk-doc/html/gio/GAsyncResult.html +31 -38
  107. data/vendor/local/share/gtk-doc/html/gio/GBufferedInputStream.html +52 -68
  108. data/vendor/local/share/gtk-doc/html/gio/GBufferedOutputStream.html +38 -50
  109. data/vendor/local/share/gtk-doc/html/gio/GCancellable.html +120 -77
  110. data/vendor/local/share/gtk-doc/html/gio/GCharsetConverter.html +26 -34
  111. data/vendor/local/share/gtk-doc/html/gio/GConverter.html +49 -51
  112. data/vendor/local/share/gtk-doc/html/gio/GCredentials.html +39 -62
  113. data/vendor/local/share/gtk-doc/html/gio/GDBusAuthObserver.html +26 -35
  114. data/vendor/local/share/gtk-doc/html/gio/GDBusConnection.html +415 -650
  115. data/vendor/local/share/gtk-doc/html/gio/{gio-GDBusError.html → GDBusError.html} +118 -147
  116. data/vendor/local/share/gtk-doc/html/gio/GDBusMessage.html +204 -347
  117. data/vendor/local/share/gtk-doc/html/gio/GDBusMethodInvocation.html +66 -111
  118. data/vendor/local/share/gtk-doc/html/gio/GDBusProxy.html +210 -309
  119. data/vendor/local/share/gtk-doc/html/gio/GDBusServer.html +68 -87
  120. data/vendor/local/share/gtk-doc/html/gio/GDataInputStream.html +190 -232
  121. data/vendor/local/share/gtk-doc/html/gio/GDataOutputStream.html +89 -118
  122. data/vendor/local/share/gtk-doc/html/gio/GDrive.html +196 -270
  123. data/vendor/local/share/gtk-doc/html/gio/GEmblem.html +40 -46
  124. data/vendor/local/share/gtk-doc/html/gio/GEmblemedIcon.html +56 -24
  125. data/vendor/local/share/gtk-doc/html/gio/GFile.html +1090 -1443
  126. data/vendor/local/share/gtk-doc/html/gio/GFileDescriptorBased.html +13 -16
  127. data/vendor/local/share/gtk-doc/html/gio/GFileEnumerator.html +66 -86
  128. data/vendor/local/share/gtk-doc/html/gio/GFileIOStream.html +31 -45
  129. data/vendor/local/share/gtk-doc/html/gio/GFileIcon.html +19 -21
  130. data/vendor/local/share/gtk-doc/html/gio/GFileInfo.html +466 -602
  131. data/vendor/local/share/gtk-doc/html/gio/GFileInputStream.html +32 -40
  132. data/vendor/local/share/gtk-doc/html/gio/GFileMonitor.html +60 -59
  133. data/vendor/local/share/gtk-doc/html/gio/GFileOutputStream.html +32 -47
  134. data/vendor/local/share/gtk-doc/html/gio/GFilenameCompleter.html +37 -45
  135. data/vendor/local/share/gtk-doc/html/gio/GFilterInputStream.html +22 -26
  136. data/vendor/local/share/gtk-doc/html/gio/GFilterOutputStream.html +22 -26
  137. data/vendor/local/share/gtk-doc/html/gio/GIOModule.html +32 -38
  138. data/vendor/local/share/gtk-doc/html/gio/GIOStream.html +184 -52
  139. data/vendor/local/share/gtk-doc/html/gio/GIcon.html +45 -54
  140. data/vendor/local/share/gtk-doc/html/gio/GInetAddress.html +96 -125
  141. data/vendor/local/share/gtk-doc/html/gio/GInetSocketAddress.html +21 -25
  142. data/vendor/local/share/gtk-doc/html/gio/GInitable.html +49 -71
  143. data/vendor/local/share/gtk-doc/html/gio/GInputStream.html +102 -134
  144. data/vendor/local/share/gtk-doc/html/gio/GLoadableIcon.html +43 -54
  145. data/vendor/local/share/gtk-doc/html/gio/GMemoryInputStream.html +21 -24
  146. data/vendor/local/share/gtk-doc/html/gio/GMemoryOutputStream.html +34 -41
  147. data/vendor/local/share/gtk-doc/html/gio/GMount.html +223 -294
  148. data/vendor/local/share/gtk-doc/html/gio/GMountOperation.html +127 -153
  149. data/vendor/local/share/gtk-doc/html/gio/GNetworkAddress.html +35 -46
  150. data/vendor/local/share/gtk-doc/html/gio/GNetworkService.html +37 -46
  151. data/vendor/local/share/gtk-doc/html/gio/GOutputStream.html +138 -174
  152. data/vendor/local/share/gtk-doc/html/gio/GPermission.html +46 -68
  153. data/vendor/local/share/gtk-doc/html/gio/GPollableInputStream.html +398 -0
  154. data/vendor/local/share/gtk-doc/html/gio/GPollableOutputStream.html +340 -0
  155. data/vendor/local/share/gtk-doc/html/gio/GProxy.html +89 -32
  156. data/vendor/local/share/gtk-doc/html/gio/GProxyAddress.html +42 -56
  157. data/vendor/local/share/gtk-doc/html/gio/GProxyResolver.html +59 -34
  158. data/vendor/local/share/gtk-doc/html/gio/GResolver.html +82 -95
  159. data/vendor/local/share/gtk-doc/html/gio/GSeekable.html +58 -72
  160. data/vendor/local/share/gtk-doc/html/gio/GSettings.html +597 -357
  161. data/vendor/local/share/gtk-doc/html/gio/GSettingsBackend.html +125 -75
  162. data/vendor/local/share/gtk-doc/html/gio/GSimpleAction.html +339 -0
  163. data/vendor/local/share/gtk-doc/html/gio/GSimpleActionGroup.html +200 -0
  164. data/vendor/local/share/gtk-doc/html/gio/GSimpleAsyncResult.html +232 -167
  165. data/vendor/local/share/gtk-doc/html/gio/GSimplePermission.html +15 -16
  166. data/vendor/local/share/gtk-doc/html/gio/GSocket.html +291 -406
  167. data/vendor/local/share/gtk-doc/html/gio/GSocketAddress.html +39 -45
  168. data/vendor/local/share/gtk-doc/html/gio/GSocketClient.html +301 -223
  169. data/vendor/local/share/gtk-doc/html/gio/GSocketConnectable.html +41 -44
  170. data/vendor/local/share/gtk-doc/html/gio/GSocketConnection.html +41 -49
  171. data/vendor/local/share/gtk-doc/html/gio/GSocketControlMessage.html +22 -32
  172. data/vendor/local/share/gtk-doc/html/gio/GSocketListener.html +88 -107
  173. data/vendor/local/share/gtk-doc/html/gio/GSocketService.html +26 -32
  174. data/vendor/local/share/gtk-doc/html/gio/{gio-GSrvTarget.html → GSrvTarget.html} +74 -77
  175. data/vendor/local/share/gtk-doc/html/gio/GTcpConnection.html +21 -22
  176. data/vendor/local/share/gtk-doc/html/gio/GTcpWrapperConnection.html +156 -0
  177. data/vendor/local/share/gtk-doc/html/gio/GThemedIcon.html +40 -46
  178. data/vendor/local/share/gtk-doc/html/gio/GThreadedSocketService.html +29 -35
  179. data/vendor/local/share/gtk-doc/html/gio/GTlsBackend.html +260 -0
  180. data/vendor/local/share/gtk-doc/html/gio/GTlsCertificate.html +396 -0
  181. data/vendor/local/share/gtk-doc/html/gio/GTlsClientConnection.html +428 -0
  182. data/vendor/local/share/gtk-doc/html/gio/GTlsConnection.html +869 -0
  183. data/vendor/local/share/gtk-doc/html/gio/GTlsServerConnection.html +158 -0
  184. data/vendor/local/share/gtk-doc/html/gio/GUnixConnection.html +32 -41
  185. data/vendor/local/share/gtk-doc/html/gio/GUnixCredentialsMessage.html +28 -34
  186. data/vendor/local/share/gtk-doc/html/gio/GUnixFDList.html +44 -54
  187. data/vendor/local/share/gtk-doc/html/gio/GUnixFDMessage.html +36 -41
  188. data/vendor/local/share/gtk-doc/html/gio/GUnixInputStream.html +35 -32
  189. data/vendor/local/share/gtk-doc/html/gio/GUnixOutputStream.html +35 -32
  190. data/vendor/local/share/gtk-doc/html/gio/GUnixSocketAddress.html +59 -67
  191. data/vendor/local/share/gtk-doc/html/gio/GVfs.html +49 -57
  192. data/vendor/local/share/gtk-doc/html/gio/GVolume.html +142 -187
  193. data/vendor/local/share/gtk-doc/html/gio/GVolumeMonitor.html +99 -132
  194. data/vendor/local/share/gtk-doc/html/gio/GZlibCompressor.html +33 -32
  195. data/vendor/local/share/gtk-doc/html/gio/GZlibDecompressor.html +22 -24
  196. data/vendor/local/share/gtk-doc/html/gio/annotation-glossary.html +43 -13
  197. data/vendor/local/share/gtk-doc/html/gio/api-index-2-18.html +5 -5
  198. data/vendor/local/share/gtk-doc/html/gio/api-index-2-20.html +10 -3
  199. data/vendor/local/share/gtk-doc/html/gio/api-index-2-22.html +20 -20
  200. data/vendor/local/share/gtk-doc/html/gio/api-index-2-24.html +8 -8
  201. data/vendor/local/share/gtk-doc/html/gio/api-index-2-26.html +36 -28
  202. data/vendor/local/share/gtk-doc/html/gio/api-index-2-28.html +744 -0
  203. data/vendor/local/share/gtk-doc/html/gio/api-index-deprecated.html +3 -3
  204. data/vendor/local/share/gtk-doc/html/gio/api-index-full.html +915 -107
  205. data/vendor/local/share/gtk-doc/html/gio/application.html +50 -0
  206. data/vendor/local/share/gtk-doc/html/gio/async.html +5 -5
  207. data/vendor/local/share/gtk-doc/html/gio/ch01.html +4 -4
  208. data/vendor/local/share/gtk-doc/html/gio/ch02.html +5 -5
  209. data/vendor/local/share/gtk-doc/html/gio/ch03.html +23 -24
  210. data/vendor/local/share/gtk-doc/html/gio/ch26.html +54 -36
  211. data/vendor/local/share/gtk-doc/html/gio/ch27.html +188 -41
  212. data/vendor/local/share/gtk-doc/html/gio/ch27s02.html +19 -108
  213. data/vendor/local/share/gtk-doc/html/gio/ch27s03.html +16 -179
  214. data/vendor/local/share/gtk-doc/html/gio/ch28.html +57 -0
  215. data/vendor/local/share/gtk-doc/html/gio/{ch26s02.html → ch28s02.html} +10 -10
  216. data/vendor/local/share/gtk-doc/html/gio/{ch26s03.html → ch28s03.html} +10 -10
  217. data/vendor/local/share/gtk-doc/html/gio/{ch26s04.html → ch28s04.html} +10 -10
  218. data/vendor/local/share/gtk-doc/html/gio/{ch26s05.html → ch28s05.html} +10 -10
  219. data/vendor/local/share/gtk-doc/html/gio/{ch26s06.html → ch28s06.html} +17 -15
  220. data/vendor/local/share/gtk-doc/html/gio/{ch26s07.html → ch28s07.html} +10 -10
  221. data/vendor/local/share/gtk-doc/html/gio/ch29.html +70 -0
  222. data/vendor/local/share/gtk-doc/html/gio/ch29s02.html +130 -0
  223. data/vendor/local/share/gtk-doc/html/gio/ch29s03.html +202 -0
  224. data/vendor/local/share/gtk-doc/html/gio/{ch27s04.html → ch29s04.html} +11 -11
  225. data/vendor/local/share/gtk-doc/html/gio/{ch27s05.html → ch29s05.html} +12 -12
  226. data/vendor/local/share/gtk-doc/html/gio/{ch27s06.html → ch29s06.html} +10 -10
  227. data/vendor/local/share/gtk-doc/html/gio/conversion.html +3 -3
  228. data/vendor/local/share/gtk-doc/html/gio/extending-gio.html +27 -14
  229. data/vendor/local/share/gtk-doc/html/gio/extending.html +5 -5
  230. data/vendor/local/share/gtk-doc/html/gio/failable_initialization.html +3 -3
  231. data/vendor/local/share/gtk-doc/html/gio/file_mon.html +3 -3
  232. data/vendor/local/share/gtk-doc/html/gio/file_ops.html +3 -3
  233. data/vendor/local/share/gtk-doc/html/gio/gdbus-convenience.html +3 -3
  234. data/vendor/local/share/gtk-doc/html/gio/gdbus-lowlevel.html +6 -6
  235. data/vendor/local/share/gtk-doc/html/gio/gdbus.html +18 -18
  236. data/vendor/local/share/gtk-doc/html/gio/gio-D-Bus-Addresses.html +39 -62
  237. data/vendor/local/share/gtk-doc/html/gio/gio-D-Bus-Introspection-Data.html +141 -248
  238. data/vendor/local/share/gtk-doc/html/gio/gio-D-Bus-Utilities.html +28 -40
  239. data/vendor/local/share/gtk-doc/html/gio/gio-Desktop-file-based-GAppInfo.html +29 -112
  240. data/vendor/local/share/gtk-doc/html/gio/gio-Extension-Points.html +45 -57
  241. data/vendor/local/share/gtk-doc/html/gio/gio-GContentType.html +58 -68
  242. data/vendor/local/share/gtk-doc/html/gio/gio-GConverterInputstream.html +16 -18
  243. data/vendor/local/share/gtk-doc/html/gio/gio-GConverterOutputstream.html +18 -20
  244. data/vendor/local/share/gtk-doc/html/gio/gio-GFileAttribute.html +82 -76
  245. data/vendor/local/share/gtk-doc/html/gio/gio-GIOError.html +34 -28
  246. data/vendor/local/share/gtk-doc/html/gio/gio-GIOScheduler.html +25 -33
  247. data/vendor/local/share/gtk-doc/html/gio/gio-Owning-Bus-Names.html +87 -113
  248. data/vendor/local/share/gtk-doc/html/gio/gio-TLS-Overview.html +287 -0
  249. data/vendor/local/share/gtk-doc/html/gio/gio-Unix-Mounts.html +119 -151
  250. data/vendor/local/share/gtk-doc/html/gio/gio-Watching-Bus-Names.html +62 -95
  251. data/vendor/local/share/gtk-doc/html/gio/gio-hierarchy.html +66 -6
  252. data/vendor/local/share/gtk-doc/html/gio/gio-querymodules.html +8 -8
  253. data/vendor/local/share/gtk-doc/html/gio/gio.devhelp +312 -91
  254. data/vendor/local/share/gtk-doc/html/gio/gio.devhelp2 +386 -133
  255. data/vendor/local/share/gtk-doc/html/gio/glib-compile-schemas.html +12 -12
  256. data/vendor/local/share/gtk-doc/html/gio/gsettings-tool.html +162 -0
  257. data/vendor/local/share/gtk-doc/html/gio/highlevel-socket.html +7 -4
  258. data/vendor/local/share/gtk-doc/html/gio/icons.html +3 -3
  259. data/vendor/local/share/gtk-doc/html/gio/index.html +88 -36
  260. data/vendor/local/share/gtk-doc/html/gio/index.sgml +506 -95
  261. data/vendor/local/share/gtk-doc/html/gio/migrating.html +23 -23
  262. data/vendor/local/share/gtk-doc/html/gio/networking.html +3 -3
  263. data/vendor/local/share/gtk-doc/html/gio/permissions.html +5 -5
  264. data/vendor/local/share/gtk-doc/html/gio/pt01.html +4 -4
  265. data/vendor/local/share/gtk-doc/html/gio/pt02.html +68 -17
  266. data/vendor/local/share/gtk-doc/html/gio/resolver.html +6 -6
  267. data/vendor/local/share/gtk-doc/html/gio/settings.html +7 -7
  268. data/vendor/local/share/gtk-doc/html/gio/streaming.html +9 -3
  269. data/vendor/local/share/gtk-doc/html/gio/style.css +2 -1
  270. data/vendor/local/share/gtk-doc/html/gio/tls.html +50 -0
  271. data/vendor/local/share/gtk-doc/html/gio/tools.html +4 -4
  272. data/vendor/local/share/gtk-doc/html/gio/types.html +6 -6
  273. data/vendor/local/share/gtk-doc/html/gio/utils.html +7 -7
  274. data/vendor/local/share/gtk-doc/html/gio/volume_mon.html +4 -4
  275. data/vendor/local/share/gtk-doc/html/glib/annotation-glossary.html +8 -11
  276. data/vendor/local/share/gtk-doc/html/glib/api-index-2-10.html +3 -3
  277. data/vendor/local/share/gtk-doc/html/glib/api-index-2-12.html +3 -3
  278. data/vendor/local/share/gtk-doc/html/glib/api-index-2-14.html +3 -3
  279. data/vendor/local/share/gtk-doc/html/glib/api-index-2-16.html +3 -3
  280. data/vendor/local/share/gtk-doc/html/glib/api-index-2-18.html +4 -4
  281. data/vendor/local/share/gtk-doc/html/glib/api-index-2-2.html +3 -3
  282. data/vendor/local/share/gtk-doc/html/glib/api-index-2-20.html +3 -3
  283. data/vendor/local/share/gtk-doc/html/glib/api-index-2-22.html +3 -3
  284. data/vendor/local/share/gtk-doc/html/glib/api-index-2-24.html +3 -3
  285. data/vendor/local/share/gtk-doc/html/glib/api-index-2-26.html +25 -5
  286. data/vendor/local/share/gtk-doc/html/glib/api-index-2-28.html +112 -0
  287. data/vendor/local/share/gtk-doc/html/glib/api-index-2-4.html +6 -6
  288. data/vendor/local/share/gtk-doc/html/glib/api-index-2-6.html +15 -11
  289. data/vendor/local/share/gtk-doc/html/glib/api-index-2-8.html +5 -5
  290. data/vendor/local/share/gtk-doc/html/glib/api-index-deprecated.html +9 -5
  291. data/vendor/local/share/gtk-doc/html/glib/api-index-full.html +201 -89
  292. data/vendor/local/share/gtk-doc/html/glib/glib-Arrays.html +144 -210
  293. data/vendor/local/share/gtk-doc/html/glib/glib-Asynchronous-Queues.html +97 -136
  294. data/vendor/local/share/gtk-doc/html/glib/glib-Atomic-Operations.html +40 -58
  295. data/vendor/local/share/gtk-doc/html/glib/glib-Automatic-String-Completion.html +99 -128
  296. data/vendor/local/share/gtk-doc/html/glib/glib-Balanced-Binary-Trees.html +104 -155
  297. data/vendor/local/share/gtk-doc/html/glib/glib-Base64-Encoding.html +42 -71
  298. data/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html +40 -43
  299. data/vendor/local/share/gtk-doc/html/glib/glib-Bookmark-file-parser.html +224 -314
  300. data/vendor/local/share/gtk-doc/html/glib/glib-Byte-Arrays.html +104 -142
  301. data/vendor/local/share/gtk-doc/html/glib/glib-Byte-Order-Macros.html +193 -308
  302. data/vendor/local/share/gtk-doc/html/glib/glib-Caches.html +51 -76
  303. data/vendor/local/share/gtk-doc/html/glib/glib-Character-Set-Conversion.html +170 -307
  304. data/vendor/local/share/gtk-doc/html/glib/glib-Commandline-option-parser.html +154 -198
  305. data/vendor/local/share/gtk-doc/html/glib/glib-Data-Checksums.html +45 -67
  306. data/vendor/local/share/gtk-doc/html/glib/glib-Datasets.html +60 -97
  307. data/vendor/local/share/gtk-doc/html/glib/glib-Date-and-Time-Functions.html +390 -428
  308. data/vendor/local/share/gtk-doc/html/glib/glib-Double-ended-Queues.html +265 -333
  309. data/vendor/local/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html +306 -330
  310. data/vendor/local/share/gtk-doc/html/glib/glib-Dynamic-Loading-of-Modules.html +60 -99
  311. data/vendor/local/share/gtk-doc/html/glib/glib-Error-Reporting.html +122 -152
  312. data/vendor/local/share/gtk-doc/html/glib/glib-File-Utilities.html +241 -571
  313. data/vendor/local/share/gtk-doc/html/glib/glib-GDateTime.html +233 -330
  314. data/vendor/local/share/gtk-doc/html/glib/glib-GTimeZone.html +310 -34
  315. data/vendor/local/share/gtk-doc/html/glib/glib-GVariant.html +739 -590
  316. data/vendor/local/share/gtk-doc/html/glib/glib-GVariantType.html +136 -143
  317. data/vendor/local/share/gtk-doc/html/glib/glib-Glob-style-pattern-matching.html +22 -29
  318. data/vendor/local/share/gtk-doc/html/glib/glib-Hash-Tables.html +210 -297
  319. data/vendor/local/share/gtk-doc/html/glib/glib-Hook-Functions.html +294 -355
  320. data/vendor/local/share/gtk-doc/html/glib/glib-Hostname-Utilities.html +27 -39
  321. data/vendor/local/share/gtk-doc/html/glib/glib-I18N.html +102 -95
  322. data/vendor/local/share/gtk-doc/html/glib/glib-IO-Channels.html +402 -486
  323. data/vendor/local/share/gtk-doc/html/glib/glib-Key-value-file-parser.html +308 -442
  324. data/vendor/local/share/gtk-doc/html/glib/glib-Keyed-Data-Lists.html +75 -116
  325. data/vendor/local/share/gtk-doc/html/glib/glib-Lexical-Scanner.html +229 -297
  326. data/vendor/local/share/gtk-doc/html/glib/glib-Limits-of-Basic-Types.html +36 -36
  327. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Allocation.html +121 -187
  328. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Allocators.html +23 -27
  329. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Chunks.html +80 -107
  330. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Slices.html +46 -69
  331. data/vendor/local/share/gtk-doc/html/glib/glib-Message-Logging.html +63 -99
  332. data/vendor/local/share/gtk-doc/html/glib/glib-Miscellaneous-Macros.html +121 -115
  333. data/vendor/local/share/gtk-doc/html/glib/glib-Miscellaneous-Utility-Functions.html +304 -327
  334. data/vendor/local/share/gtk-doc/html/glib/glib-N-ary-Trees.html +307 -366
  335. data/vendor/local/share/gtk-doc/html/glib/glib-Numerical-Definitions.html +39 -20
  336. data/vendor/local/share/gtk-doc/html/glib/glib-Perl-compatible-regular-expressions.html +230 -343
  337. data/vendor/local/share/gtk-doc/html/glib/glib-Pointer-Arrays.html +121 -167
  338. data/vendor/local/share/gtk-doc/html/glib/glib-Quarks.html +31 -45
  339. data/vendor/local/share/gtk-doc/html/glib/glib-Random-Numbers.html +73 -113
  340. data/vendor/local/share/gtk-doc/html/glib/glib-Relations-and-Tuples.html +75 -106
  341. data/vendor/local/share/gtk-doc/html/glib/glib-Sequences.html +229 -184
  342. data/vendor/local/share/gtk-doc/html/glib/glib-Shell-related-Utilities.html +31 -40
  343. data/vendor/local/share/gtk-doc/html/glib/glib-Simple-XML-Subset-Parser.html +247 -286
  344. data/vendor/local/share/gtk-doc/html/glib/glib-Singly-Linked-Lists.html +281 -283
  345. data/vendor/local/share/gtk-doc/html/glib/glib-Spawning-Processes.html +83 -337
  346. data/vendor/local/share/gtk-doc/html/glib/glib-Standard-Macros.html +65 -80
  347. data/vendor/local/share/gtk-doc/html/glib/glib-String-Chunks.html +36 -42
  348. data/vendor/local/share/gtk-doc/html/glib/glib-String-Utility-Functions.html +408 -621
  349. data/vendor/local/share/gtk-doc/html/glib/glib-Strings.html +253 -322
  350. data/vendor/local/share/gtk-doc/html/glib/glib-Testing.html +161 -252
  351. data/vendor/local/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html +677 -590
  352. data/vendor/local/share/gtk-doc/html/glib/glib-Thread-Pools.html +88 -111
  353. data/vendor/local/share/gtk-doc/html/glib/glib-Threads.html +378 -475
  354. data/vendor/local/share/gtk-doc/html/glib/glib-Timers.html +27 -48
  355. data/vendor/local/share/gtk-doc/html/glib/glib-Trash-Stacks.html +39 -48
  356. data/vendor/local/share/gtk-doc/html/glib/glib-Type-Conversion-Macros.html +19 -25
  357. data/vendor/local/share/gtk-doc/html/glib/glib-URI-Functions.html +57 -93
  358. data/vendor/local/share/gtk-doc/html/glib/glib-Unicode-Manipulation.html +413 -534
  359. data/vendor/local/share/gtk-doc/html/glib/glib-Version-Information.html +117 -21
  360. data/vendor/local/share/gtk-doc/html/glib/glib-Warnings-and-Assertions.html +38 -53
  361. data/vendor/local/share/gtk-doc/html/glib/glib-Windows-Compatibility-Functions.html +60 -114
  362. data/vendor/local/share/gtk-doc/html/glib/glib-building.html +38 -39
  363. data/vendor/local/share/gtk-doc/html/glib/glib-changes.html +7 -13
  364. data/vendor/local/share/gtk-doc/html/glib/glib-compiling.html +5 -5
  365. data/vendor/local/share/gtk-doc/html/glib/glib-core.html +3 -3
  366. data/vendor/local/share/gtk-doc/html/glib/glib-cross-compiling.html +19 -19
  367. data/vendor/local/share/gtk-doc/html/glib/glib-data-types.html +6 -3
  368. data/vendor/local/share/gtk-doc/html/glib/glib-fundamentals.html +3 -3
  369. data/vendor/local/share/gtk-doc/html/glib/glib-gettextize.html +10 -10
  370. data/vendor/local/share/gtk-doc/html/glib/glib-regex-syntax.html +82 -82
  371. data/vendor/local/share/gtk-doc/html/glib/glib-resources.html +9 -9
  372. data/vendor/local/share/gtk-doc/html/glib/glib-running.html +26 -26
  373. data/vendor/local/share/gtk-doc/html/glib/glib-utilities.html +3 -3
  374. data/vendor/local/share/gtk-doc/html/glib/glib.devhelp +144 -103
  375. data/vendor/local/share/gtk-doc/html/glib/glib.devhelp2 +170 -105
  376. data/vendor/local/share/gtk-doc/html/glib/glib.html +3 -3
  377. data/vendor/local/share/gtk-doc/html/glib/gtester-report.html +10 -10
  378. data/vendor/local/share/gtk-doc/html/glib/gtester.html +10 -10
  379. data/vendor/local/share/gtk-doc/html/glib/gvariant-format-strings.html +48 -43
  380. data/vendor/local/share/gtk-doc/html/glib/gvariant-text.html +660 -0
  381. data/vendor/local/share/gtk-doc/html/glib/index.html +8 -4
  382. data/vendor/local/share/gtk-doc/html/glib/index.sgml +67 -2
  383. data/vendor/local/share/gtk-doc/html/glib/style.css +2 -1
  384. data/vendor/local/share/gtk-doc/html/glib/tools.html +5 -5
  385. data/vendor/local/share/gtk-doc/html/gobject/GBinding.html +72 -90
  386. data/vendor/local/share/gtk-doc/html/gobject/GTypeModule.html +79 -108
  387. data/vendor/local/share/gtk-doc/html/gobject/GTypePlugin.html +67 -85
  388. data/vendor/local/share/gtk-doc/html/gobject/annotation-glossary.html +63 -9
  389. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-10.html +4 -4
  390. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-12.html +3 -3
  391. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-14.html +3 -3
  392. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-18.html +3 -3
  393. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-2.html +3 -3
  394. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-22.html +3 -3
  395. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-24.html +3 -3
  396. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-26.html +6 -6
  397. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-28.html +47 -0
  398. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-4.html +4 -4
  399. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-6.html +3 -3
  400. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-8.html +3 -3
  401. data/vendor/local/share/gtk-doc/html/gobject/api-index-deprecated.html +3 -3
  402. data/vendor/local/share/gtk-doc/html/gobject/api-index-full.html +65 -53
  403. data/vendor/local/share/gtk-doc/html/gobject/ch01s02.html +7 -7
  404. data/vendor/local/share/gtk-doc/html/gobject/ch06s03.html +4 -4
  405. data/vendor/local/share/gtk-doc/html/gobject/chapter-gobject.html +8 -11
  406. data/vendor/local/share/gtk-doc/html/gobject/chapter-gtype.html +19 -19
  407. data/vendor/local/share/gtk-doc/html/gobject/chapter-intro.html +6 -6
  408. data/vendor/local/share/gtk-doc/html/gobject/chapter-signal.html +18 -18
  409. data/vendor/local/share/gtk-doc/html/gobject/glib-genmarshal.html +22 -22
  410. data/vendor/local/share/gtk-doc/html/gobject/glib-mkenums.html +16 -16
  411. data/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html +40 -54
  412. data/vendor/local/share/gtk-doc/html/gobject/gobject-Closures.html +405 -512
  413. data/vendor/local/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html +170 -213
  414. data/vendor/local/share/gtk-doc/html/gobject/gobject-GParamSpec.html +242 -292
  415. data/vendor/local/share/gtk-doc/html/gobject/gobject-Generic-values.html +91 -127
  416. data/vendor/local/share/gtk-doc/html/gobject/gobject-Signals.html +407 -573
  417. data/vendor/local/share/gtk-doc/html/gobject/gobject-Standard-Parameter-and-Value-Types.html +951 -1268
  418. data/vendor/local/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html +383 -441
  419. data/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html +648 -829
  420. data/vendor/local/share/gtk-doc/html/gobject/gobject-Value-arrays.html +82 -95
  421. data/vendor/local/share/gtk-doc/html/gobject/gobject-Varargs-Value-Collection.html +31 -49
  422. data/vendor/local/share/gtk-doc/html/gobject/gobject-memory.html +8 -8
  423. data/vendor/local/share/gtk-doc/html/gobject/gobject-properties.html +15 -14
  424. data/vendor/local/share/gtk-doc/html/gobject/gobject-query.html +10 -10
  425. data/vendor/local/share/gtk-doc/html/gobject/gobject.devhelp +62 -58
  426. data/vendor/local/share/gtk-doc/html/gobject/gobject.devhelp2 +62 -58
  427. data/vendor/local/share/gtk-doc/html/gobject/gtype-conventions.html +6 -6
  428. data/vendor/local/share/gtk-doc/html/gobject/gtype-instantiable-classed.html +11 -11
  429. data/vendor/local/share/gtk-doc/html/gobject/gtype-non-instantiable-classed.html +14 -14
  430. data/vendor/local/share/gtk-doc/html/gobject/gtype-non-instantiable.html +6 -6
  431. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-chainup.html +5 -5
  432. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-code.html +3 -3
  433. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-construction.html +7 -7
  434. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-destruction.html +3 -3
  435. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-methods.html +9 -9
  436. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject.html +10 -10
  437. data/vendor/local/share/gtk-doc/html/gobject/howto-interface-implement.html +4 -4
  438. data/vendor/local/share/gtk-doc/html/gobject/howto-interface-properties.html +7 -7
  439. data/vendor/local/share/gtk-doc/html/gobject/howto-interface.html +6 -6
  440. data/vendor/local/share/gtk-doc/html/gobject/howto-signals.html +6 -6
  441. data/vendor/local/share/gtk-doc/html/gobject/index.html +11 -10
  442. data/vendor/local/share/gtk-doc/html/gobject/index.sgml +13 -1
  443. data/vendor/local/share/gtk-doc/html/gobject/pr01.html +4 -4
  444. data/vendor/local/share/gtk-doc/html/gobject/pt01.html +7 -7
  445. data/vendor/local/share/gtk-doc/html/gobject/pt02.html +8 -8
  446. data/vendor/local/share/gtk-doc/html/gobject/pt03.html +5 -5
  447. data/vendor/local/share/gtk-doc/html/gobject/rn01.html +4 -4
  448. data/vendor/local/share/gtk-doc/html/gobject/rn02.html +4 -4
  449. data/vendor/local/share/gtk-doc/html/gobject/signal.html +13 -13
  450. data/vendor/local/share/gtk-doc/html/gobject/style.css +2 -1
  451. data/vendor/local/share/gtk-doc/html/gobject/tools-ginspector.html +3 -3
  452. data/vendor/local/share/gtk-doc/html/gobject/tools-gob.html +3 -3
  453. data/vendor/local/share/gtk-doc/html/gobject/tools-gtkdoc.html +6 -6
  454. data/vendor/local/share/gtk-doc/html/gobject/tools-refdb.html +3 -3
  455. data/vendor/local/share/gtk-doc/html/gobject/tools-vala.html +3 -3
  456. data/vendor/local/share/locale/ar/LC_MESSAGES/glib20.mo +0 -0
  457. data/vendor/local/share/locale/be/LC_MESSAGES/glib20.mo +0 -0
  458. data/vendor/local/share/locale/bg/LC_MESSAGES/glib20.mo +0 -0
  459. data/vendor/local/share/locale/bn_IN/LC_MESSAGES/glib20.mo +0 -0
  460. data/vendor/local/share/locale/cs/LC_MESSAGES/glib20.mo +0 -0
  461. data/vendor/local/share/locale/da/LC_MESSAGES/glib20.mo +0 -0
  462. data/vendor/local/share/locale/de/LC_MESSAGES/glib20.mo +0 -0
  463. data/vendor/local/share/locale/el/LC_MESSAGES/glib20.mo +0 -0
  464. data/vendor/local/share/locale/en_GB/LC_MESSAGES/glib20.mo +0 -0
  465. data/vendor/local/share/locale/es/LC_MESSAGES/glib20.mo +0 -0
  466. data/vendor/local/share/locale/et/LC_MESSAGES/glib20.mo +0 -0
  467. data/vendor/local/share/locale/eu/LC_MESSAGES/glib20.mo +0 -0
  468. data/vendor/local/share/locale/fr/LC_MESSAGES/glib20.mo +0 -0
  469. data/vendor/local/share/locale/gl/LC_MESSAGES/glib20.mo +0 -0
  470. data/vendor/local/share/locale/he/LC_MESSAGES/glib20.mo +0 -0
  471. data/vendor/local/share/locale/hu/LC_MESSAGES/glib20.mo +0 -0
  472. data/vendor/local/share/locale/hy/LC_MESSAGES/glib20.mo +0 -0
  473. data/vendor/local/share/locale/id/LC_MESSAGES/glib20.mo +0 -0
  474. data/vendor/local/share/locale/it/LC_MESSAGES/glib20.mo +0 -0
  475. data/vendor/local/share/locale/ja/LC_MESSAGES/glib20.mo +0 -0
  476. data/vendor/local/share/locale/ko/LC_MESSAGES/glib20.mo +0 -0
  477. data/vendor/local/share/locale/lt/LC_MESSAGES/glib20.mo +0 -0
  478. data/vendor/local/share/locale/nb/LC_MESSAGES/glib20.mo +0 -0
  479. data/vendor/local/share/locale/pa/LC_MESSAGES/glib20.mo +0 -0
  480. data/vendor/local/share/locale/pl/LC_MESSAGES/glib20.mo +0 -0
  481. data/vendor/local/share/locale/pt/LC_MESSAGES/glib20.mo +0 -0
  482. data/vendor/local/share/locale/pt_BR/LC_MESSAGES/glib20.mo +0 -0
  483. data/vendor/local/share/locale/ro/LC_MESSAGES/glib20.mo +0 -0
  484. data/vendor/local/share/locale/ru/LC_MESSAGES/glib20.mo +0 -0
  485. data/vendor/local/share/locale/sl/LC_MESSAGES/glib20.mo +0 -0
  486. data/vendor/local/share/locale/sr/LC_MESSAGES/glib20.mo +0 -0
  487. data/vendor/local/share/locale/sr@latin/LC_MESSAGES/glib20.mo +0 -0
  488. data/vendor/local/share/locale/sv/LC_MESSAGES/glib20.mo +0 -0
  489. data/vendor/local/share/locale/ug/LC_MESSAGES/glib20.mo +0 -0
  490. data/vendor/local/share/locale/vi/LC_MESSAGES/glib20.mo +0 -0
  491. data/vendor/local/share/locale/zh_CN/LC_MESSAGES/glib20.mo +0 -0
  492. data/vendor/local/share/locale/zh_HK/LC_MESSAGES/glib20.mo +0 -0
  493. data/vendor/local/share/locale/zh_TW/LC_MESSAGES/glib20.mo +0 -0
  494. data/vendor/local/share/man/man1/glib-genmarshal.1 +2 -2
  495. data/vendor/local/share/man/man1/glib-mkenums.1 +2 -2
  496. data/vendor/local/share/man/man1/gobject-query.1 +2 -2
  497. data/vendor/local/src/tml/packaging/{glib_2.26.1-1_win32.log → glib_2.28.1-1_win32.log} +690 -773
  498. data/vendor/local/src/tml/packaging/{glib_2.26.1-1_win32.sh → glib_2.28.1-1_win32.sh} +2 -4
  499. metadata +78 -146
  500. data/ext/glib2/Makefile +0 -169
  501. data/ext/glib2/glib-enum-types.c +0 -1065
  502. data/ext/glib2/glib-enum-types.h +0 -144
  503. data/ext/glib2/ruby-glib2.pc +0 -3
  504. data/test-unit/COPYING +0 -56
  505. data/test-unit/GPL +0 -340
  506. data/test-unit/History.txt +0 -279
  507. data/test-unit/Manifest.txt +0 -110
  508. data/test-unit/PSFL +0 -271
  509. data/test-unit/README.txt +0 -75
  510. data/test-unit/Rakefile +0 -53
  511. data/test-unit/TODO +0 -5
  512. data/test-unit/bin/testrb +0 -5
  513. data/test-unit/html/bar.png +0 -0
  514. data/test-unit/html/bar.svg +0 -153
  515. data/test-unit/html/developer.png +0 -0
  516. data/test-unit/html/developer.svg +0 -469
  517. data/test-unit/html/famfamfam-logo.png +0 -0
  518. data/test-unit/html/favicon.ico +0 -0
  519. data/test-unit/html/favicon.png +0 -0
  520. data/test-unit/html/favicon.svg +0 -82
  521. data/test-unit/html/heading-mark.png +0 -0
  522. data/test-unit/html/heading-mark.svg +0 -393
  523. data/test-unit/html/index.html +0 -285
  524. data/test-unit/html/index.html.ja +0 -299
  525. data/test-unit/html/install.png +0 -0
  526. data/test-unit/html/install.svg +0 -636
  527. data/test-unit/html/jp.png +0 -0
  528. data/test-unit/html/kinotan-failure.png +0 -0
  529. data/test-unit/html/kinotan-pass.png +0 -0
  530. data/test-unit/html/logo.png +0 -0
  531. data/test-unit/html/logo.svg +0 -483
  532. data/test-unit/html/reference.png +0 -0
  533. data/test-unit/html/rubyforge.png +0 -0
  534. data/test-unit/html/tango-logo.png +0 -0
  535. data/test-unit/html/test-unit.css +0 -339
  536. data/test-unit/html/tutorial.png +0 -0
  537. data/test-unit/html/tutorial.svg +0 -559
  538. data/test-unit/html/us.png +0 -0
  539. data/test-unit/images/color-diff.png +0 -0
  540. data/test-unit/lib/test/unit.rb +0 -328
  541. data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
  542. data/test-unit/lib/test/unit/assertions.rb +0 -1792
  543. data/test-unit/lib/test/unit/attribute.rb +0 -125
  544. data/test-unit/lib/test/unit/autorunner.rb +0 -415
  545. data/test-unit/lib/test/unit/collector.rb +0 -38
  546. data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
  547. data/test-unit/lib/test/unit/collector/dir.rb +0 -108
  548. data/test-unit/lib/test/unit/collector/load.rb +0 -187
  549. data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
  550. data/test-unit/lib/test/unit/collector/xml.rb +0 -250
  551. data/test-unit/lib/test/unit/color-scheme.rb +0 -106
  552. data/test-unit/lib/test/unit/color.rb +0 -96
  553. data/test-unit/lib/test/unit/diff.rb +0 -740
  554. data/test-unit/lib/test/unit/error.rb +0 -131
  555. data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
  556. data/test-unit/lib/test/unit/failure.rb +0 -136
  557. data/test-unit/lib/test/unit/fixture.rb +0 -185
  558. data/test-unit/lib/test/unit/notification.rb +0 -129
  559. data/test-unit/lib/test/unit/omission.rb +0 -191
  560. data/test-unit/lib/test/unit/pending.rb +0 -150
  561. data/test-unit/lib/test/unit/priority.rb +0 -180
  562. data/test-unit/lib/test/unit/runner/console.rb +0 -52
  563. data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
  564. data/test-unit/lib/test/unit/runner/tap.rb +0 -8
  565. data/test-unit/lib/test/unit/runner/xml.rb +0 -15
  566. data/test-unit/lib/test/unit/testcase.rb +0 -515
  567. data/test-unit/lib/test/unit/testresult.rb +0 -125
  568. data/test-unit/lib/test/unit/testsuite.rb +0 -134
  569. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
  570. data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -467
  571. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
  572. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -82
  573. data/test-unit/lib/test/unit/ui/testrunner.rb +0 -53
  574. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -86
  575. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
  576. data/test-unit/lib/test/unit/ui/xml/testrunner.rb +0 -224
  577. data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -42
  578. data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
  579. data/test-unit/lib/test/unit/util/observable.rb +0 -90
  580. data/test-unit/lib/test/unit/util/output.rb +0 -31
  581. data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
  582. data/test-unit/lib/test/unit/version.rb +0 -7
  583. data/test-unit/sample/adder.rb +0 -13
  584. data/test-unit/sample/subtracter.rb +0 -12
  585. data/test-unit/sample/test_adder.rb +0 -20
  586. data/test-unit/sample/test_subtracter.rb +0 -20
  587. data/test-unit/sample/test_user.rb +0 -23
  588. data/test-unit/test/collector/test-descendant.rb +0 -133
  589. data/test-unit/test/collector/test-load.rb +0 -442
  590. data/test-unit/test/collector/test_dir.rb +0 -406
  591. data/test-unit/test/collector/test_objectspace.rb +0 -100
  592. data/test-unit/test/run-test.rb +0 -22
  593. data/test-unit/test/test-assertions.rb +0 -1849
  594. data/test-unit/test/test-attribute.rb +0 -86
  595. data/test-unit/test/test-color-scheme.rb +0 -69
  596. data/test-unit/test/test-color.rb +0 -47
  597. data/test-unit/test/test-diff.rb +0 -518
  598. data/test-unit/test/test-emacs-runner.rb +0 -60
  599. data/test-unit/test/test-fixture.rb +0 -324
  600. data/test-unit/test/test-notification.rb +0 -33
  601. data/test-unit/test/test-omission.rb +0 -81
  602. data/test-unit/test/test-pending.rb +0 -70
  603. data/test-unit/test/test-priority.rb +0 -119
  604. data/test-unit/test/test-testcase.rb +0 -569
  605. data/test-unit/test/test_error.rb +0 -26
  606. data/test-unit/test/test_failure.rb +0 -33
  607. data/test-unit/test/test_testresult.rb +0 -113
  608. data/test-unit/test/test_testsuite.rb +0 -137
  609. data/test-unit/test/testunit-test-util.rb +0 -14
  610. data/test-unit/test/ui/test_tap.rb +0 -33
  611. data/test-unit/test/ui/test_testrunmediator.rb +0 -20
  612. data/test-unit/test/util/test-method-owner-finder.rb +0 -38
  613. data/test-unit/test/util/test-output.rb +0 -11
  614. data/test-unit/test/util/test_backtracefilter.rb +0 -41
  615. data/test-unit/test/util/test_observable.rb +0 -102
  616. data/test-unit/test/util/test_procwrapper.rb +0 -36
  617. data/vendor/local/share/gtk-doc/html/gio/ch24.html +0 -75
  618. data/vendor/local/share/gtk-doc/html/gio/ch25.html +0 -217
  619. data/vendor/local/share/gtk-doc/html/gio/ch25s02.html +0 -41
  620. data/vendor/local/share/gtk-doc/html/gio/ch25s03.html +0 -39
Binary file
@@ -1,328 +0,0 @@
1
- require 'test/unit/testcase'
2
- require 'test/unit/autorunner'
3
-
4
- module Test # :nodoc:
5
- #
6
- # = Test::Unit - Ruby Unit Testing Framework
7
- #
8
- # == Introduction
9
- #
10
- # Unit testing is making waves all over the place, largely due to the
11
- # fact that it is a core practice of XP. While XP is great, unit testing
12
- # has been around for a long time and has always been a good idea. One
13
- # of the keys to good unit testing, though, is not just writing tests,
14
- # but having tests. What's the difference? Well, if you just _write_ a
15
- # test and throw it away, you have no guarantee that something won't
16
- # change later which breaks your code. If, on the other hand, you _have_
17
- # tests (obviously you have to write them first), and run them as often
18
- # as possible, you slowly build up a wall of things that cannot break
19
- # without you immediately knowing about it. This is when unit testing
20
- # hits its peak usefulness.
21
- #
22
- # Enter Test::Unit, a framework for unit testing in Ruby, helping you to
23
- # design, debug and evaluate your code by making it easy to write and
24
- # have tests for it.
25
- #
26
- #
27
- # == Notes
28
- #
29
- # Test::Unit has grown out of and superceded Lapidary.
30
- #
31
- #
32
- # == Feedback
33
- #
34
- # I like (and do my best to practice) XP, so I value early releases,
35
- # user feedback, and clean, simple, expressive code. There is always
36
- # room for improvement in everything I do, and Test::Unit is no
37
- # exception. Please, let me know what you think of Test::Unit as it
38
- # stands, and what you'd like to see expanded/changed/improved/etc. If
39
- # you find a bug, let me know ASAP; one good way to let me know what the
40
- # bug is is to submit a new test that catches it :-) Also, I'd love to
41
- # hear about any successes you have with Test::Unit, and any
42
- # documentation you might add will be greatly appreciated. My contact
43
- # info is below.
44
- #
45
- #
46
- # == Contact Information
47
- #
48
- # A lot of discussion happens about Ruby in general on the ruby-talk
49
- # mailing list (http://www.ruby-lang.org/en/ml.html), and you can ask
50
- # any questions you might have there. I monitor the list, as do many
51
- # other helpful Rubyists, and you're sure to get a quick answer. Of
52
- # course, you're also welcome to email me (Nathaniel Talbott) directly
53
- # at mailto:testunit@talbott.ws, and I'll do my best to help you out.
54
- #
55
- #
56
- # == Credits
57
- #
58
- # I'd like to thank...
59
- #
60
- # Matz, for a great language!
61
- #
62
- # Masaki Suketa, for his work on RubyUnit, which filled a vital need in
63
- # the Ruby world for a very long time. I'm also grateful for his help in
64
- # polishing Test::Unit and getting the RubyUnit compatibility layer
65
- # right. His graciousness in allowing Test::Unit to supercede RubyUnit
66
- # continues to be a challenge to me to be more willing to defer my own
67
- # rights.
68
- #
69
- # Ken McKinlay, for his interest and work on unit testing, and for his
70
- # willingness to dialog about it. He was also a great help in pointing
71
- # out some of the holes in the RubyUnit compatibility layer.
72
- #
73
- # Dave Thomas, for the original idea that led to the extremely simple
74
- # "require 'test/unit'", plus his code to improve it even more by
75
- # allowing the selection of tests from the command-line. Also, without
76
- # RDoc, the documentation for Test::Unit would stink a lot more than it
77
- # does now.
78
- #
79
- # Everyone who's helped out with bug reports, feature ideas,
80
- # encouragement to continue, etc. It's a real privilege to be a part of
81
- # the Ruby community.
82
- #
83
- # The guys at RoleModel Software, for putting up with me repeating, "But
84
- # this would be so much easier in Ruby!" whenever we're coding in Java.
85
- #
86
- # My Creator, for giving me life, and giving it more abundantly.
87
- #
88
- #
89
- # == License
90
- #
91
- # Test::Unit is copyright (c) 2000-2003 Nathaniel Talbott. It is free
92
- # software, and is distributed under the Ruby license. See the COPYING
93
- # file.
94
- #
95
- # Exception: lib/test/unit/diff.rb is copyright (c)
96
- # 2008-2010 Kouhei Sutou and 2001-2008 Python Software
97
- # Foundation. It is free software, and is distributed
98
- # under the Ruby license and/or the PSF license. See the
99
- # COPYING file and PSFL file.
100
- #
101
- # == Warranty
102
- #
103
- # This software is provided "as is" and without any express or
104
- # implied warranties, including, without limitation, the implied
105
- # warranties of merchantibility and fitness for a particular
106
- # purpose.
107
- #
108
- #
109
- # == Author
110
- #
111
- # Nathaniel Talbott.
112
- # Copyright (c) 2000-2003, Nathaniel Talbott
113
- #
114
- # ----
115
- #
116
- # = Usage
117
- #
118
- # The general idea behind unit testing is that you write a _test_
119
- # _method_ that makes certain _assertions_ about your code, working
120
- # against a _test_ _fixture_. A bunch of these _test_ _methods_ are
121
- # bundled up into a _test_ _suite_ and can be run any time the
122
- # developer wants. The results of a run are gathered in a _test_
123
- # _result_ and displayed to the user through some UI. So, lets break
124
- # this down and see how Test::Unit provides each of these necessary
125
- # pieces.
126
- #
127
- #
128
- # == Assertions
129
- #
130
- # These are the heart of the framework. Think of an assertion as a
131
- # statement of expected outcome, i.e. "I assert that x should be equal
132
- # to y". If, when the assertion is executed, it turns out to be
133
- # correct, nothing happens, and life is good. If, on the other hand,
134
- # your assertion turns out to be false, an error is propagated with
135
- # pertinent information so that you can go back and make your
136
- # assertion succeed, and, once again, life is good. For an explanation
137
- # of the current assertions, see Test::Unit::Assertions.
138
- #
139
- #
140
- # == Test Method & Test Fixture
141
- #
142
- # Obviously, these assertions have to be called within a context that
143
- # knows about them and can do something meaningful with their
144
- # pass/fail value. Also, it's handy to collect a bunch of related
145
- # tests, each test represented by a method, into a common test class
146
- # that knows how to run them. The tests will be in a separate class
147
- # from the code they're testing for a couple of reasons. First of all,
148
- # it allows your code to stay uncluttered with test code, making it
149
- # easier to maintain. Second, it allows the tests to be stripped out
150
- # for deployment, since they're really there for you, the developer,
151
- # and your users don't need them. Third, and most importantly, it
152
- # allows you to set up a common test fixture for your tests to run
153
- # against.
154
- #
155
- # What's a test fixture? Well, tests do not live in a vacuum; rather,
156
- # they're run against the code they are testing. Often, a collection
157
- # of tests will run against a common set of data, also called a
158
- # fixture. If they're all bundled into the same test class, they can
159
- # all share the setting up and tearing down of that data, eliminating
160
- # unnecessary duplication and making it much easier to add related
161
- # tests.
162
- #
163
- # Test::Unit::TestCase wraps up a collection of test methods together
164
- # and allows you to easily set up and tear down the same test fixture
165
- # for each test. This is done by overriding #setup and/or #teardown,
166
- # which will be called before and after each test method that is
167
- # run. The TestCase also knows how to collect the results of your
168
- # assertions into a Test::Unit::TestResult, which can then be reported
169
- # back to you... but I'm getting ahead of myself. To write a test,
170
- # follow these steps:
171
- #
172
- # * Make sure Test::Unit is in your library path.
173
- # * require 'test/unit' in your test script.
174
- # * Create a class that subclasses Test::Unit::TestCase.
175
- # * Add a method that begins with "test" to your class.
176
- # * Make assertions in your test method.
177
- # * Optionally define #setup and/or #teardown to set up and/or tear
178
- # down your common test fixture.
179
- # * You can now run your test as you would any other Ruby
180
- # script... try it and see!
181
- #
182
- # A really simple test might look like this (#setup and #teardown are
183
- # commented out to indicate that they are completely optional):
184
- #
185
- # require 'test/unit'
186
- #
187
- # class MyTest < Test::Unit::TestCase
188
- # # def setup
189
- # # end
190
- #
191
- # # def teardown
192
- # # end
193
- #
194
- # def test_fail
195
- # assert(false, 'Assertion was false.')
196
- # end
197
- # end
198
- #
199
- #
200
- # == Test Runners
201
- #
202
- # So, now you have this great test class, but you still
203
- # need a way to run it and view any failures that occur
204
- # during the run. There are some test runner; console test
205
- # runner, GTK+ test runner and so on. The console test
206
- # runner is automatically invoked for you if you require
207
- # 'test/unit' and simply run the file. To use another
208
- # runner simply set default test runner ID to
209
- # Test::Unit::AutoRunner:
210
- #
211
- # require 'test/unit'
212
- # Test::Unit::AutoRunner.default_runner = "gtk2"
213
- #
214
- # == Test Suite
215
- #
216
- # As more and more unit tests accumulate for a given project, it
217
- # becomes a real drag running them one at a time, and it also
218
- # introduces the potential to overlook a failing test because you
219
- # forget to run it. Suddenly it becomes very handy that the
220
- # TestRunners can take any object that returns a Test::Unit::TestSuite
221
- # in response to a suite method. The TestSuite can, in turn, contain
222
- # other TestSuites or individual tests (typically created by a
223
- # TestCase). In other words, you can easily wrap up a group of
224
- # TestCases and TestSuites.
225
- #
226
- # Test::Unit does a little bit more for you, by wrapping
227
- # these up automatically when you require
228
- # 'test/unit'. What does this mean? It means you could
229
- # write the above test case like this instead:
230
- #
231
- # require 'test/unit'
232
- # require 'test_myfirsttests'
233
- # require 'test_moretestsbyme'
234
- # require 'test_anothersetoftests'
235
- #
236
- # Test::Unit is smart enough to find all the test cases existing in
237
- # the ObjectSpace and wrap them up into a suite for you. It then runs
238
- # the dynamic suite using the console TestRunner.
239
- #
240
- #
241
- # == Configuration file
242
- #
243
- # Test::Unit reads 'test-unit.yml' in the current working
244
- # directory as Test::Unit's configuration file. It can
245
- # contain the following configurations:
246
- #
247
- # * color scheme definitions
248
- # * test runner to be used
249
- # * test runner options
250
- # * test collector to be used
251
- #
252
- # Except color scheme definitions, all of them are
253
- # specified by command line option.
254
- #
255
- # Here are sample color scheme definitions:
256
- #
257
- # color_schemes:
258
- # inverted:
259
- # success:
260
- # name: red
261
- # bold: true
262
- # failure:
263
- # name: green
264
- # bold: true
265
- # other_scheme:
266
- # ...
267
- #
268
- # Here are the syntax of color scheme definitions:
269
- #
270
- # color_schemes:
271
- # SCHEME_NAME:
272
- # EVENT_NAME:
273
- # name: COLOR_NAME
274
- # intensity: BOOLEAN
275
- # bold: BOOLEAN
276
- # italic: BOOLEAN
277
- # underline: BOOLEAN
278
- # ...
279
- # ...
280
- #
281
- # SCHEME_NAME:: the name of the color scheme
282
- # EVENT_NAME:: one of [success, failure, pending,
283
- # omission, notification, error]
284
- # COLOR_NAME:: one of [black, red, green, yellow, blue,
285
- # magenta, cyan, white]
286
- # BOOLEAN:: true or false
287
- #
288
- # You can use the above 'inverted' color scheme with the
289
- # following configuration:
290
- #
291
- # runner: console
292
- # console_options:
293
- # color_scheme: inverted
294
- # color_schemes:
295
- # inverted:
296
- # success:
297
- # name: red
298
- # bold: true
299
- # failure:
300
- # name: green
301
- # bold: true
302
- #
303
- # == Questions?
304
- #
305
- # I'd really like to get feedback from all levels of Ruby
306
- # practitioners about typos, grammatical errors, unclear statements,
307
- # missing points, etc., in this document (or any other).
308
- #
309
-
310
- module Unit
311
- # Set true when Test::Unit has run. If set to true Test::Unit
312
- # will not automatically run at exit.
313
- def self.run=(flag)
314
- @run = flag
315
- end
316
-
317
- # Already tests have run?
318
- def self.run?
319
- @run ||= false
320
- end
321
- end
322
- end
323
-
324
- at_exit do
325
- unless $! || Test::Unit.run?
326
- exit Test::Unit::AutoRunner.run
327
- end
328
- end
@@ -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,1792 +0,0 @@
1
- # Author:: Nathaniel Talbott.
2
- # Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
3
- # Copyright (c) 2009-2010 Kouhei Sutou. All rights reserved.
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
- case message
66
- when nil, String, Proc
67
- else
68
- error_message = "assertion message must be String or Proc: "
69
- error_message << "<#{message.inspect}>(<#{message.class}>)"
70
- raise ArgumentError, error_message, filter_backtrace(caller)
71
- end
72
- assert_block("assert should not be called with a block.") do
73
- !block_given?
74
- end
75
- assert_block(build_message(message, "<?> is not true.", boolean)) do
76
- boolean
77
- end
78
- end
79
- end
80
-
81
- ##
82
- # Passes if +expected+ == +actual.
83
- #
84
- # Note that the ordering of arguments is important, since a helpful
85
- # error message is generated when this one fails that tells you the
86
- # values of expected and actual.
87
- #
88
- # Example:
89
- # assert_equal 'MY STRING', 'my string'.upcase
90
-
91
- public
92
- def assert_equal(expected, actual, message=nil)
93
- diff = AssertionMessage.delayed_diff(expected, actual)
94
- if expected.respond_to?(:encoding) and
95
- actual.respond_to?(:encoding) and
96
- expected.encoding != actual.encoding
97
- format = <<EOT
98
- <?>(?) expected but was
99
- <?>(?).?
100
- EOT
101
- full_message = build_message(message, format,
102
- expected, expected.encoding.name,
103
- actual, actual.encoding.name,
104
- diff)
105
- else
106
- full_message = build_message(message, <<EOT, expected, actual, diff)
107
- <?> expected but was
108
- <?>.?
109
- EOT
110
- end
111
- begin
112
- assert_block(full_message) { expected == actual }
113
- rescue AssertionFailedError => failure
114
- failure.expected = expected
115
- failure.actual = actual
116
- failure.inspected_expected = AssertionMessage.convert(expected)
117
- failure.inspected_actual = AssertionMessage.convert(actual)
118
- failure.user_message = message
119
- raise
120
- end
121
- end
122
-
123
- ##
124
- # Passes if the block raises one of the expected
125
- # exceptions. When an expected exception is an Exception
126
- # object, passes if expected_exception == actual_exception.
127
- #
128
- # Example:
129
- # assert_raise(RuntimeError, LoadError) do
130
- # raise 'Boom!!!'
131
- # end # -> pass
132
- #
133
- # assert_raise do
134
- # raise Exception, 'Any exception should be raised!!!'
135
- # end # -> pass
136
- #
137
- # assert_raise(RuntimeError.new("XXX")) {raise "XXX"} # -> pass
138
- # assert_raise(MyError.new("XXX")) {raise "XXX"} # -> fail
139
- # assert_raise(RuntimeError.new("ZZZ")) {raise "XXX"} # -> fail
140
- public
141
- def assert_raise(*args, &block)
142
- assert_expected_exception = Proc.new do |*_args|
143
- message, assert_exception_helper, actual_exception = _args
144
- expected = assert_exception_helper.expected_exceptions
145
- full_message = build_message(message,
146
- "<?> exception expected but was\n?",
147
- expected, actual_exception)
148
- assert_block(full_message) do
149
- expected == [] or assert_exception_helper.expected?(actual_exception)
150
- end
151
- end
152
- _assert_raise(assert_expected_exception, *args, &block)
153
- end
154
-
155
- ##
156
- # Alias of assert_raise.
157
- #
158
- # Will be deprecated in 1.9, and removed in 2.0.
159
-
160
- public
161
- def assert_raises(*args, &block)
162
- assert_raise(*args, &block)
163
- end
164
-
165
- ##
166
- # Passes if the block raises one of the given
167
- # exceptions or sub exceptions of the given exceptions.
168
- #
169
- # Example:
170
- # assert_raise_kind_of(SystemCallError) do
171
- # raise Errno::EACCES
172
- # end
173
- def assert_raise_kind_of(*args, &block)
174
- assert_expected_exception = Proc.new do |*_args|
175
- message, assert_exception_helper, actual_exception = _args
176
- expected = assert_exception_helper.expected_exceptions
177
- full_message = build_message(message,
178
- "<?> family exception expected " +
179
- "but was\n?",
180
- expected, actual_exception)
181
- assert_block(full_message) do
182
- assert_exception_helper.expected?(actual_exception, :kind_of?)
183
- end
184
- end
185
- _assert_raise(assert_expected_exception, *args, &block)
186
- end
187
-
188
-
189
- ##
190
- # Passes if +object+.instance_of?(+klass+). When +klass+ is
191
- # an array of classes, it passes if any class
192
- # satisfies +object.instance_of?(class).
193
- #
194
- # Example:
195
- # assert_instance_of(String, 'foo') # -> pass
196
- # assert_instance_of([Fixnum, NilClass], 100) # -> pass
197
- # assert_instance_of([Numeric, NilClass], 100) # -> fail
198
-
199
- public
200
- def assert_instance_of(klass, object, message="")
201
- _wrap_assertion do
202
- klasses = nil
203
- klasses = klass if klass.is_a?(Array)
204
- assert_block("The first parameter to assert_instance_of should be " +
205
- "a Class or an Array of Class.") do
206
- if klasses
207
- klasses.all? {|k| k.is_a?(Class)}
208
- else
209
- klass.is_a?(Class)
210
- end
211
- end
212
- klass_message = AssertionMessage.maybe_container(klass) do |value|
213
- "<#{value}>"
214
- end
215
- full_message = build_message(message, <<EOT, object, klass_message, object.class)
216
- <?> expected to be an instance of
217
- ? but was
218
- <?>.
219
- EOT
220
- assert_block(full_message) do
221
- if klasses
222
- klasses.any? {|k| object.instance_of?(k)}
223
- else
224
- object.instance_of?(klass)
225
- end
226
- end
227
- end
228
- end
229
-
230
- ##
231
- # Passes if +object+ is nil.
232
- #
233
- # Example:
234
- # assert_nil [1, 2].uniq!
235
-
236
- public
237
- def assert_nil(object, message="")
238
- full_message = build_message(message, <<EOT, object)
239
- <?> expected to be nil.
240
- EOT
241
- assert_block(full_message) { object.nil? }
242
- end
243
-
244
- ##
245
- # Passes if +object+.kind_of?(+klass+). When +klass+ is
246
- # an array of classes or modules, it passes if any
247
- # class or module satisfies +object.kind_of?(class_or_module).
248
- #
249
- # Example:
250
- # assert_kind_of(Object, 'foo') # -> pass
251
- # assert_kind_of([Fixnum, NilClass], 100) # -> pass
252
- # assert_kind_of([Fixnum, NilClass], "string") # -> fail
253
-
254
- public
255
- def assert_kind_of(klass, object, message="")
256
- _wrap_assertion do
257
- klasses = nil
258
- klasses = klass if klass.is_a?(Array)
259
- assert_block("The first parameter to assert_kind_of should be " +
260
- "a kind_of Module or an Array of a kind_of Module.") do
261
- if klasses
262
- klasses.all? {|k| k.kind_of?(Module)}
263
- else
264
- klass.kind_of?(Module)
265
- end
266
- end
267
- klass_message = AssertionMessage.maybe_container(klass) do |value|
268
- "<#{value}>"
269
- end
270
- full_message = build_message(message,
271
- "<?> expected to be kind_of\\?\n" +
272
- "? but was\n" +
273
- "<?>.",
274
- object,
275
- klass_message,
276
- object.class)
277
- assert_block(full_message) do
278
- if klasses
279
- klasses.any? {|k| object.kind_of?(k)}
280
- else
281
- object.kind_of?(klass)
282
- end
283
- end
284
- end
285
- end
286
-
287
- ##
288
- # Passes if +object+ .respond_to? +method+
289
- #
290
- # Example:
291
- # assert_respond_to 'bugbear', :slice
292
-
293
- public
294
- def assert_respond_to(object, method, message="")
295
- _wrap_assertion do
296
- full_message = build_message(message,
297
- "<?>.kind_of\\?(Symbol) or\n" +
298
- "<?>.respond_to\\?(:to_str) expected",
299
- method, method)
300
- assert_block(full_message) do
301
- method.kind_of?(Symbol) or method.respond_to?(:to_str)
302
- end
303
- full_message = build_message(message,
304
- "<?>.respond_to\\?(?) expected\n" +
305
- "(Class: <?>)",
306
- object, method, object.class)
307
- assert_block(full_message) {object.respond_to?(method)}
308
- end
309
- end
310
-
311
- ##
312
- # Passes if +object+ does not .respond_to? +method+.
313
- #
314
- # Example:
315
- # assert_not_respond_to('bugbear', :nonexistence) # -> pass
316
- # assert_not_respond_to('bugbear', :size) # -> fail
317
-
318
- public
319
- def assert_not_respond_to(object, method, message="")
320
- _wrap_assertion do
321
- full_message = build_message(message,
322
- "<?>.kind_of\\?(Symbol) or\n" +
323
- "<?>.respond_to\\?(:to_str) expected",
324
- method, method)
325
- assert_block(full_message) do
326
- method.kind_of?(Symbol) or method.respond_to?(:to_str)
327
- end
328
- full_message = build_message(message,
329
- "!<?>.respond_to\\?(?) expected\n" +
330
- "(Class: <?>)",
331
- object, method, object.class)
332
- assert_block(full_message) {!object.respond_to?(method)}
333
- end
334
- end
335
-
336
- ##
337
- # Passes if +string+ =~ +pattern+.
338
- #
339
- # Example:
340
- # assert_match(/\d+/, 'five, 6, seven')
341
-
342
- public
343
- def assert_match(pattern, string, message="")
344
- _wrap_assertion do
345
- pattern = case(pattern)
346
- when String
347
- Regexp.new(Regexp.escape(pattern))
348
- else
349
- pattern
350
- end
351
- full_message = build_message(message, "<?> expected to be =~\n<?>.", string, pattern)
352
- assert_block(full_message) { string =~ pattern }
353
- end
354
- end
355
-
356
- ##
357
- # Passes if +actual+ .equal? +expected+ (i.e. they are the same
358
- # instance).
359
- #
360
- # Example:
361
- # o = Object.new
362
- # assert_same o, o
363
-
364
- public
365
- def assert_same(expected, actual, message="")
366
- full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
367
- <?>
368
- with id <?> expected to be equal\\? to
369
- <?>
370
- with id <?>.
371
- EOT
372
- assert_block(full_message) { actual.equal?(expected) }
373
- end
374
-
375
- ##
376
- # Compares the +object1+ with +object2+ using +operator+.
377
- #
378
- # Passes if object1.__send__(operator, object2) is true.
379
- #
380
- # Example:
381
- # assert_operator 5, :>=, 4
382
-
383
- public
384
- def assert_operator(object1, operator, object2, message="")
385
- _wrap_assertion do
386
- full_message = build_message(nil, "<?>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
387
- assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
388
- full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
389
- <?> expected to be
390
- ?
391
- <?>.
392
- EOT
393
- assert_block(full_message) { object1.__send__(operator, object2) }
394
- end
395
- end
396
-
397
- ##
398
- # Passes if block does not raise an exception.
399
- #
400
- # Example:
401
- # assert_nothing_raised do
402
- # [1, 2].uniq
403
- # end
404
-
405
- public
406
- def assert_nothing_raised(*args)
407
- _wrap_assertion do
408
- if args.last.is_a?(String)
409
- message = args.pop
410
- else
411
- message = ""
412
- end
413
-
414
- assert_exception_helper = AssertExceptionHelper.new(self, args)
415
- begin
416
- yield
417
- rescue Exception => e
418
- if ((args.empty? && !e.instance_of?(AssertionFailedError)) ||
419
- assert_exception_helper.expected?(e))
420
- failure_message = build_message(message, "Exception raised:\n?", e)
421
- assert_block(failure_message) {false}
422
- else
423
- raise
424
- end
425
- end
426
- nil
427
- end
428
- end
429
-
430
- ##
431
- # Flunk always fails.
432
- #
433
- # Example:
434
- # flunk 'Not done testing yet.'
435
-
436
- public
437
- def flunk(message="Flunked")
438
- assert_block(build_message(message)){false}
439
- end
440
-
441
- ##
442
- # Passes if ! +actual+ .equal? +expected+
443
- #
444
- # Example:
445
- # assert_not_same Object.new, Object.new
446
-
447
- public
448
- def assert_not_same(expected, actual, message="")
449
- full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
450
- <?>
451
- with id <?> expected to not be equal\\? to
452
- <?>
453
- with id <?>.
454
- EOT
455
- assert_block(full_message) { !actual.equal?(expected) }
456
- end
457
-
458
- ##
459
- # Passes if +expected+ != +actual+
460
- #
461
- # Example:
462
- # assert_not_equal 'some string', 5
463
-
464
- public
465
- def assert_not_equal(expected, actual, message="")
466
- full_message = build_message(message, "<?> expected to be != to\n<?>.", expected, actual)
467
- assert_block(full_message) { expected != actual }
468
- end
469
-
470
- ##
471
- # Passes if ! +object+ .nil?
472
- #
473
- # Example:
474
- # assert_not_nil '1 two 3'.sub!(/two/, '2')
475
-
476
- public
477
- def assert_not_nil(object, message="")
478
- full_message = build_message(message, "<?> expected to not be nil.", object)
479
- assert_block(full_message){!object.nil?}
480
- end
481
-
482
- ##
483
- # Passes if +regexp+ !~ +string+
484
- #
485
- # Example:
486
- # assert_not_match(/two/, 'one 2 three') # -> pass
487
- # assert_not_match(/three/, 'one 2 three') # -> fail
488
-
489
- public
490
- def assert_not_match(regexp, string, message="")
491
- _wrap_assertion do
492
- assert_instance_of(Regexp, regexp,
493
- "<REGEXP> in assert_not_match(<REGEXP>, ...) " +
494
- "should be a Regexp.")
495
- full_message = build_message(message,
496
- "<?> expected to not match\n<?>.",
497
- regexp, string)
498
- assert_block(full_message) { regexp !~ string }
499
- end
500
- end
501
-
502
- ##
503
- # Deprecated. Use #assert_not_match instead.
504
- #
505
- # Passes if +regexp+ !~ +string+
506
- #
507
- # Example:
508
- # assert_no_match(/two/, 'one 2 three') # -> pass
509
- # assert_no_match(/three/, 'one 2 three') # -> fail
510
-
511
- public
512
- def assert_no_match(regexp, string, message="")
513
- _wrap_assertion do
514
- assert_instance_of(Regexp, regexp,
515
- "The first argument to assert_no_match " +
516
- "should be a Regexp.")
517
- assert_not_match(regexp, string, message)
518
- end
519
- end
520
-
521
- UncaughtThrow = {
522
- NameError => /^uncaught throw \`(.+)\'$/, #`
523
- ArgumentError => /^uncaught throw (.+)$/,
524
- ThreadError => /^uncaught throw \`(.+)\' in thread / #`
525
- }
526
-
527
- ##
528
- # Passes if the block throws +expected_object+
529
- #
530
- # Example:
531
- # assert_throw(:done) do
532
- # throw(:done)
533
- # end
534
-
535
- public
536
- def assert_throw(expected_object, message="", &proc)
537
- _wrap_assertion do
538
- begin
539
- catch([]) {}
540
- rescue TypeError
541
- assert_instance_of(Symbol, expected_object,
542
- "assert_throws expects the symbol that should be thrown for its first argument")
543
- end
544
- assert_block("Should have passed a block to assert_throw.") do
545
- block_given?
546
- end
547
- caught = true
548
- begin
549
- catch(expected_object) do
550
- proc.call
551
- caught = false
552
- end
553
- full_message = build_message(message,
554
- "<?> should have been thrown.",
555
- expected_object)
556
- assert_block(full_message) {caught}
557
- rescue NameError, ArgumentError, ThreadError => error
558
- raise unless UncaughtThrow[error.class] =~ error.message
559
- tag = $1
560
- tag = tag[1..-1].intern if tag[0, 1] == ":"
561
- full_message = build_message(message,
562
- "<?> expected to be thrown but\n" +
563
- "<?> was thrown.",
564
- expected_object, tag)
565
- flunk(full_message)
566
- end
567
- end
568
- end
569
-
570
- ##
571
- # Alias of assert_throw.
572
- #
573
- # Will be deprecated in 1.9, and removed in 2.0.
574
- def assert_throws(*args, &block)
575
- assert_throw(*args, &block)
576
- end
577
-
578
- ##
579
- # Passes if block does not throw anything.
580
- #
581
- # Example:
582
- # assert_nothing_thrown do
583
- # [1, 2].uniq
584
- # end
585
-
586
- public
587
- def assert_nothing_thrown(message="", &proc)
588
- _wrap_assertion do
589
- assert(block_given?, "Should have passed a block to assert_nothing_thrown")
590
- begin
591
- proc.call
592
- rescue NameError, ArgumentError, ThreadError => error
593
- raise unless UncaughtThrow[error.class] =~ error.message
594
- tag = $1
595
- tag = tag[1..-1].intern if tag[0, 1] == ":"
596
- full_message = build_message(message,
597
- "<?> was thrown when nothing was expected",
598
- tag)
599
- flunk(full_message)
600
- end
601
- assert(true, "Expected nothing to be thrown")
602
- end
603
- end
604
-
605
- ##
606
- # Passes if +expected_float+ and +actual_float+ are equal
607
- # within +delta+ tolerance.
608
- #
609
- # Example:
610
- # assert_in_delta 0.05, (50000.0 / 10**6), 0.00001
611
-
612
- public
613
- def assert_in_delta(expected_float, actual_float, delta=0.001, message="")
614
- _wrap_assertion do
615
- _assert_in_delta_validate_arguments(expected_float,
616
- actual_float,
617
- delta)
618
- full_message = _assert_in_delta_message(expected_float,
619
- actual_float,
620
- delta,
621
- message)
622
- assert_block(full_message) do
623
- (expected_float.to_f - actual_float.to_f).abs <= delta.to_f
624
- end
625
- end
626
- end
627
-
628
- ##
629
- # Passes if +expected_float+ and +actual_float+ are
630
- # not equal within +delta+ tolerance.
631
- #
632
- # Example:
633
- # assert_not_in_delta(0.05, (50000.0 / 10**6), 0.00002) # -> pass
634
- # assert_not_in_delta(0.05, (50000.0 / 10**6), 0.00001) # -> fail
635
-
636
- public
637
- def assert_not_in_delta(expected_float, actual_float, delta=0.001, message="")
638
- _wrap_assertion do
639
- _assert_in_delta_validate_arguments(expected_float,
640
- actual_float,
641
- delta)
642
- full_message = _assert_in_delta_message(expected_float,
643
- actual_float,
644
- delta,
645
- message,
646
- :negative_assertion => true)
647
- assert_block(full_message) do
648
- (expected_float.to_f - actual_float.to_f).abs > delta.to_f
649
- end
650
- end
651
- end
652
-
653
- # :stopdoc:
654
- private
655
- def _assert_in_delta_validate_arguments(expected_float,
656
- actual_float,
657
- delta)
658
- {
659
- expected_float => "first float",
660
- actual_float => "second float",
661
- delta => "delta"
662
- }.each do |float, name|
663
- assert_respond_to(float, :to_f,
664
- "The arguments must respond to to_f; " +
665
- "the #{name} did not")
666
- end
667
- delta = delta.to_f
668
- assert_operator(delta, :>=, 0.0, "The delta should not be negative")
669
- end
670
-
671
- def _assert_in_delta_message(expected_float, actual_float, delta,
672
- message, options={})
673
- if options[:negative_assertion]
674
- format = <<-EOT
675
- <?> -/+ <?> expected to not include
676
- <?>.
677
- EOT
678
- else
679
- format = <<-EOT
680
- <?> -/+ <?> expected to include
681
- <?>.
682
- EOT
683
- end
684
- arguments = [expected_float, delta, actual_float]
685
- normalized_expected = expected_float.to_f
686
- normalized_actual = actual_float.to_f
687
- normalized_delta = delta.to_f
688
- relation_format = nil
689
- relation_arguments = nil
690
- if normalized_actual < normalized_expected - normalized_delta
691
- relation_format = "<<?> < <?>-<?>[?] <= <?>+<?>[?]>"
692
- relation_arguments = [actual_float,
693
- expected_float, delta,
694
- normalized_expected - normalized_delta,
695
- expected_float, delta,
696
- normalized_expected + normalized_delta]
697
- elsif normalized_actual <= normalized_expected + normalized_delta
698
- relation_format = "<<?>-<?>[?] <= <?> <= <?>+<?>[?]>"
699
- relation_arguments = [expected_float, delta,
700
- normalized_expected - normalized_delta,
701
- actual_float,
702
- expected_float, delta,
703
- normalized_expected + normalized_delta]
704
- else
705
- relation_format = "<<?>-<?>[?] <= <?>+<?>[?] < <?>>"
706
- relation_arguments = [expected_float, delta,
707
- normalized_expected - normalized_delta,
708
- expected_float, delta,
709
- normalized_expected + normalized_delta,
710
- actual_float]
711
- end
712
-
713
- if relation_format
714
- format << <<-EOT
715
-
716
- Relation:
717
- #{relation_format}
718
- EOT
719
- arguments.concat(relation_arguments)
720
- end
721
-
722
- build_message(message, format, *arguments)
723
- end
724
-
725
- public
726
- # :startdoc:
727
-
728
- ##
729
- # Passes if +expected_float+ and +actual_float+ are equal
730
- # within +epsilon+ relative error of +expected_float+.
731
- #
732
- # Example:
733
- # assert_in_epsilon(10000.0, 9900.0, 0.1) # -> pass
734
- # assert_in_epsilon(10000.0, 9899.0, 0.1) # -> fail
735
-
736
- public
737
- def assert_in_epsilon(expected_float, actual_float, epsilon=0.001,
738
- message="")
739
- _wrap_assertion do
740
- _assert_in_epsilon_validate_arguments(expected_float,
741
- actual_float,
742
- epsilon)
743
- full_message = _assert_in_epsilon_message(expected_float,
744
- actual_float,
745
- epsilon,
746
- message)
747
- assert_block(full_message) do
748
- normalized_expected_float = expected_float.to_f
749
- delta = normalized_expected_float * epsilon.to_f
750
- (normalized_expected_float - actual_float.to_f).abs <= delta
751
- end
752
- end
753
- end
754
-
755
- ##
756
- # Passes if +expected_float+ and +actual_float+ are
757
- # not equal within +epsilon+ relative error of
758
- # +expected_float+.
759
- #
760
- # Example:
761
- # assert_not_in_epsilon(10000.0, 9900.0, 0.1) # -> fail
762
- # assert_not_in_epsilon(10000.0, 9899.0, 0.1) # -> pass
763
-
764
- public
765
- def assert_not_in_epsilon(expected_float, actual_float, epsilon=0.001,
766
- message="")
767
- _wrap_assertion do
768
- _assert_in_epsilon_validate_arguments(expected_float,
769
- actual_float,
770
- epsilon)
771
- full_message = _assert_in_epsilon_message(expected_float,
772
- actual_float,
773
- epsilon,
774
- message,
775
- :negative_assertion => true)
776
- assert_block(full_message) do
777
- normalized_expected_float = expected_float.to_f
778
- delta = normalized_expected_float * epsilon.to_f
779
- (normalized_expected_float - actual_float.to_f).abs > delta
780
- end
781
- end
782
- end
783
-
784
- # :stopdoc:
785
- private
786
- def _assert_in_epsilon_validate_arguments(expected_float,
787
- actual_float,
788
- epsilon)
789
- {
790
- expected_float => "first float",
791
- actual_float => "second float",
792
- epsilon => "epsilon"
793
- }.each do |float, name|
794
- assert_respond_to(float, :to_f,
795
- "The arguments must respond to to_f; " +
796
- "the #{name} did not")
797
- end
798
- epsilon = epsilon.to_f
799
- assert_operator(epsilon, :>=, 0.0, "The epsilon should not be negative")
800
- end
801
-
802
- def _assert_in_epsilon_message(expected_float, actual_float, epsilon,
803
- message, options={})
804
- normalized_expected = expected_float.to_f
805
- normalized_actual = actual_float.to_f
806
- normalized_epsilon = epsilon.to_f
807
- delta = normalized_expected * normalized_epsilon
808
-
809
- if options[:negative_assertion]
810
- format = <<-EOT
811
- <?> -/+ (<?> * <?>)[?] expected to not include
812
- <?>.
813
- EOT
814
- else
815
- format = <<-EOT
816
- <?> -/+ (<?> * <?>)[?] expected to include
817
- <?>.
818
- EOT
819
- end
820
- arguments = [expected_float, expected_float, epsilon, delta,
821
- actual_float]
822
-
823
- relation_format = nil
824
- relation_arguments = nil
825
- if normalized_actual < normalized_expected - delta
826
- relation_format = "<<?> < <?>-(<?>*<?>)[?] <= <?>+(<?>*<?>)[?]>"
827
- relation_arguments = [actual_float,
828
- expected_float, expected_float, epsilon,
829
- normalized_expected - delta,
830
- expected_float, expected_float, epsilon,
831
- normalized_expected + delta]
832
- elsif normalized_actual <= normalized_expected + delta
833
- relation_format = "<<?>-(<?>*<?>)[?] <= <?> <= <?>+(<?>*<?>)[?]>"
834
- relation_arguments = [expected_float, expected_float, epsilon,
835
- normalized_expected - delta,
836
- actual_float,
837
- expected_float, expected_float, epsilon,
838
- normalized_expected + delta]
839
- else
840
- relation_format = "<<?>-(<?>*<?>)[?] <= <?>+(<?>*<?>)[?] < <?>>"
841
- relation_arguments = [expected_float, expected_float, epsilon,
842
- normalized_expected - delta,
843
- expected_float, expected_float, epsilon,
844
- normalized_expected + delta,
845
- actual_float]
846
- end
847
-
848
- if relation_format
849
- format << <<-EOT
850
-
851
- Relation:
852
- #{relation_format}
853
- EOT
854
- arguments.concat(relation_arguments)
855
- end
856
-
857
- build_message(message, format, *arguments)
858
- end
859
-
860
- public
861
- # :startdoc:
862
-
863
- ##
864
- # Passes if the method send returns a true value.
865
- #
866
- # +send_array+ is composed of:
867
- # * A receiver
868
- # * A method
869
- # * Arguments to the method
870
- #
871
- # Example:
872
- # assert_send([[1, 2], :member?, 1]) # -> pass
873
- # assert_send([[1, 2], :member?, 4]) # -> fail
874
-
875
- public
876
- def assert_send(send_array, message=nil)
877
- _wrap_assertion do
878
- assert_instance_of(Array, send_array,
879
- "assert_send requires an array " +
880
- "of send information")
881
- assert_operator(send_array.size, :>=, 2,
882
- "assert_send requires at least a receiver " +
883
- "and a message name")
884
- format = <<EOT
885
- <?> expected to respond to
886
- <?(*?)> with a true value but was
887
- <?>.
888
- EOT
889
- receiver, message_name, *arguments = send_array
890
- result = nil
891
- full_message =
892
- build_message(message,
893
- format,
894
- receiver,
895
- AssertionMessage.literal(message_name.to_s),
896
- arguments,
897
- AssertionMessage.delayed_literal {result})
898
- assert_block(full_message) do
899
- result = receiver.__send__(message_name, *arguments)
900
- result
901
- end
902
- end
903
- end
904
-
905
- ##
906
- # Passes if the method send doesn't return a true value.
907
- #
908
- # +send_array+ is composed of:
909
- # * A receiver
910
- # * A method
911
- # * Arguments to the method
912
- #
913
- # Example:
914
- # assert_not_send([[1, 2], :member?, 1]) # -> fail
915
- # assert_not_send([[1, 2], :member?, 4]) # -> pass
916
- def assert_not_send(send_array, message=nil)
917
- _wrap_assertion do
918
- assert_instance_of(Array, send_array,
919
- "assert_not_send requires an array " +
920
- "of send information")
921
- assert_operator(send_array.size, :>=, 2,
922
- "assert_not_send requires at least a receiver " +
923
- "and a message name")
924
- format = <<EOT
925
- <?> expected to respond to
926
- <?(*?)> with not a true value but was
927
- <?>.
928
- EOT
929
- receiver, message_name, *arguments = send_array
930
- result = nil
931
- full_message =
932
- build_message(message,
933
- format,
934
- receiver,
935
- AssertionMessage.literal(message_name.to_s),
936
- arguments,
937
- AssertionMessage.delayed_literal {result})
938
- assert_block(full_message) do
939
- result = receiver.__send__(message_name, *arguments)
940
- not result
941
- end
942
- end
943
- end
944
-
945
- ##
946
- # Passes if +actual+ is a boolean value.
947
- #
948
- # Example:
949
- # assert_boolean(true) # -> pass
950
- # assert_boolean(nil) # -> fail
951
- def assert_boolean(actual, message=nil)
952
- _wrap_assertion do
953
- assert_block(build_message(message,
954
- "<true> or <false> expected but was\n<?>",
955
- actual)) do
956
- [true, false].include?(actual)
957
- end
958
- end
959
- end
960
-
961
- ##
962
- # Passes if +actual+ is true.
963
- #
964
- # Example:
965
- # assert_true(true) # -> pass
966
- # assert_true(:true) # -> fail
967
- def assert_true(actual, message=nil)
968
- _wrap_assertion do
969
- assert_block(build_message(message,
970
- "<true> expected but was\n<?>",
971
- actual)) do
972
- actual == true
973
- end
974
- end
975
- end
976
-
977
- ##
978
- # Passes if +actual+ is false.
979
- #
980
- # Example:
981
- # assert_false(false) # -> pass
982
- # assert_false(nil) # -> fail
983
- def assert_false(actual, message=nil)
984
- _wrap_assertion do
985
- assert_block(build_message(message,
986
- "<false> expected but was\n<?>",
987
- actual)) do
988
- actual == false
989
- end
990
- end
991
- end
992
-
993
- ##
994
- # Passes if expression "+expected+ +operator+
995
- # +actual+" is true.
996
- #
997
- # Example:
998
- # assert_compare(1, "<", 10) # -> pass
999
- # assert_compare(1, ">=", 10) # -> fail
1000
- def assert_compare(expected, operator, actual, message=nil)
1001
- _wrap_assertion do
1002
- assert_send([["<", "<=", ">", ">="], :include?, operator.to_s])
1003
- case operator.to_s
1004
- when "<"
1005
- operator_description = "less than"
1006
- when "<="
1007
- operator_description = "less than or equal to"
1008
- when ">"
1009
- operator_description = "greater than"
1010
- when ">="
1011
- operator_description = "greater than or equal to"
1012
- end
1013
- template = <<-EOT
1014
- <?> #{operator} <?> should be true
1015
- <?> expected #{operator_description}
1016
- <?>.
1017
- EOT
1018
- full_message = build_message(message, template,
1019
- expected, actual,
1020
- expected, actual)
1021
- assert_block(full_message) do
1022
- expected.send(operator, actual)
1023
- end
1024
- end
1025
- end
1026
-
1027
- ##
1028
- # Passes if assertion is failed in block.
1029
- #
1030
- # Example:
1031
- # assert_fail_assertion {assert_equal("A", "B")} # -> pass
1032
- # assert_fail_assertion {assert_equal("A", "A")} # -> fail
1033
- def assert_fail_assertion(message=nil)
1034
- _wrap_assertion do
1035
- full_message = build_message(message,
1036
- "Failed assertion was expected.")
1037
- assert_block(full_message) do
1038
- begin
1039
- yield
1040
- false
1041
- rescue AssertionFailedError
1042
- true
1043
- end
1044
- end
1045
- end
1046
- end
1047
-
1048
- ##
1049
- # Passes if an exception is raised in block and its
1050
- # message is +expected+.
1051
- #
1052
- # Example:
1053
- # assert_raise_message("exception") {raise "exception"} # -> pass
1054
- # assert_raise_message(/exc/i) {raise "exception"} # -> pass
1055
- # assert_raise_message("exception") {raise "EXCEPTION"} # -> fail
1056
- # assert_raise_message("exception") {} # -> fail
1057
- def assert_raise_message(expected, message=nil)
1058
- _wrap_assertion do
1059
- full_message = build_message(message,
1060
- "<?> exception message expected " +
1061
- "but none was thrown.",
1062
- expected)
1063
- exception = nil
1064
- assert_block(full_message) do
1065
- begin
1066
- yield
1067
- false
1068
- rescue Exception => exception
1069
- true
1070
- end
1071
- end
1072
-
1073
- actual = exception.message
1074
- diff = AssertionMessage.delayed_diff(expected, actual)
1075
- full_message =
1076
- build_message(message,
1077
- "<?> exception message expected but was\n" +
1078
- "<?>.?", expected, actual, diff)
1079
- assert_block(full_message) do
1080
- if expected.is_a?(Regexp)
1081
- expected =~ actual
1082
- else
1083
- expected == actual
1084
- end
1085
- end
1086
- end
1087
- end
1088
-
1089
- ##
1090
- # Passes if +object+.const_defined?(+constant_name+)
1091
- #
1092
- # Example:
1093
- # assert_const_defined(Test, :Unit) # -> pass
1094
- # assert_const_defined(Object, :Nonexistent) # -> fail
1095
- def assert_const_defined(object, constant_name, message=nil)
1096
- _wrap_assertion do
1097
- full_message = build_message(message,
1098
- "<?>.const_defined\\?(<?>) expected.",
1099
- object, constant_name)
1100
- assert_block(full_message) do
1101
- object.const_defined?(constant_name)
1102
- end
1103
- end
1104
- end
1105
-
1106
- ##
1107
- # Passes if !+object+.const_defined?(+constant_name+)
1108
- #
1109
- # Example:
1110
- # assert_not_const_defined(Object, :Nonexistent) # -> pass
1111
- # assert_not_const_defined(Test, :Unit) # -> fail
1112
- def assert_not_const_defined(object, constant_name, message=nil)
1113
- _wrap_assertion do
1114
- full_message = build_message(message,
1115
- "!<?>.const_defined\\?(<?>) expected.",
1116
- object, constant_name)
1117
- assert_block(full_message) do
1118
- !object.const_defined?(constant_name)
1119
- end
1120
- end
1121
- end
1122
-
1123
- ##
1124
- # Passes if +object+.+predicate+ is _true_.
1125
- #
1126
- # Example:
1127
- # assert_predicate([], :empty?) # -> pass
1128
- # assert_predicate([1], :empty?) # -> fail
1129
- def assert_predicate(object, predicate, message=nil)
1130
- _wrap_assertion do
1131
- assert_respond_to(object, predicate, message)
1132
- actual = object.send(predicate)
1133
- full_message = build_message(message,
1134
- "<?>.? is true value expected but was\n" +
1135
- "<?>",
1136
- object,
1137
- AssertionMessage.literal(predicate),
1138
- actual)
1139
- assert_block(full_message) do
1140
- actual
1141
- end
1142
- end
1143
- end
1144
-
1145
- ##
1146
- # Passes if +object+.+predicate+ is not _true_.
1147
- #
1148
- # Example:
1149
- # assert_not_predicate([1], :empty?) # -> pass
1150
- # assert_not_predicate([], :empty?) # -> fail
1151
- def assert_not_predicate(object, predicate, message=nil)
1152
- _wrap_assertion do
1153
- assert_respond_to(object, predicate, message)
1154
- actual = object.send(predicate)
1155
- full_message = build_message(message,
1156
- "<?>.? is false value expected but was\n" +
1157
- "<?>",
1158
- object,
1159
- AssertionMessage.literal(predicate),
1160
- actual)
1161
- assert_block(full_message) do
1162
- not actual
1163
- end
1164
- end
1165
- end
1166
-
1167
- ##
1168
- # Passes if +object+#+alias_name+ is an alias method of
1169
- # +object+#+original_name+.
1170
- #
1171
- # Example:
1172
- # assert_alias_method([], :length, :size) # -> pass
1173
- # assert_alias_method([], :size, :length) # -> pass
1174
- # assert_alias_method([], :each, :size) # -> fail
1175
- def assert_alias_method(object, alias_name, original_name, message=nil)
1176
- _wrap_assertion do
1177
- find_method_failure_message = Proc.new do |method_name|
1178
- build_message(message,
1179
- "<?>.? doesn't exist\n" +
1180
- "(Class: <?>)",
1181
- object,
1182
- AssertionMessage.literal(method_name),
1183
- object.class)
1184
- end
1185
-
1186
- alias_method = original_method = nil
1187
- assert_block(find_method_failure_message.call(alias_name)) do
1188
- begin
1189
- alias_method = object.method(alias_name)
1190
- true
1191
- rescue NameError
1192
- false
1193
- end
1194
- end
1195
- assert_block(find_method_failure_message.call(original_name)) do
1196
- begin
1197
- original_method = object.method(original_name)
1198
- true
1199
- rescue NameError
1200
- false
1201
- end
1202
- end
1203
-
1204
- full_message = build_message(message,
1205
- "<?> is alias of\n" +
1206
- "<?> expected",
1207
- alias_method,
1208
- original_method)
1209
- assert_block(full_message) do
1210
- alias_method == original_method
1211
- end
1212
- end
1213
- end
1214
-
1215
- ##
1216
- # Passes if +path+ exists.
1217
- #
1218
- # Example:
1219
- # assert_path_exist("/tmp") # -> pass
1220
- # assert_path_exist("/bin/sh") # -> pass
1221
- # assert_path_exist("/nonexistent") # -> fail
1222
- def assert_path_exist(path, message=nil)
1223
- _wrap_assertion do
1224
- failure_message = build_message(message,
1225
- "<?> expected to exist",
1226
- path)
1227
- assert_block(failure_message) do
1228
- File.exist?(path)
1229
- end
1230
- end
1231
- end
1232
-
1233
- ##
1234
- # Passes if +path+ doesn't exist.
1235
- #
1236
- # Example:
1237
- # assert_path_not_exist("/nonexistent") # -> pass
1238
- # assert_path_not_exist("/tmp") # -> fail
1239
- # assert_path_not_exist("/bin/sh") # -> fail
1240
- def assert_path_not_exist(path, message=nil)
1241
- _wrap_assertion do
1242
- failure_message = build_message(message,
1243
- "<?> expected to not exist",
1244
- path)
1245
- assert_block(failure_message) do
1246
- not File.exist?(path)
1247
- end
1248
- end
1249
- end
1250
-
1251
- ##
1252
- # Passes if +collection+ includes +object+.
1253
- #
1254
- # Example:
1255
- # assert_include([1, 10], 1) # -> pass
1256
- # assert_include(1..10, 5) # -> pass
1257
- # assert_include([1, 10], 5) # -> fail
1258
- # assert_include(1..10, 20) # -> fail
1259
- def assert_include(collection, object, message=nil)
1260
- _wrap_assertion do
1261
- assert_respond_to(collection, :include?,
1262
- "The collection must respond to :include?.")
1263
- full_message = build_message(message,
1264
- "<?> expected to include\n<?>.",
1265
- collection,
1266
- object)
1267
- assert_block(full_message) do
1268
- collection.include?(object)
1269
- end
1270
- end
1271
- end
1272
-
1273
- ##
1274
- # Passes if +collection+ doesn't include +object+.
1275
- #
1276
- # Example:
1277
- # assert_not_include([1, 10], 5) # -> pass
1278
- # assert_not_include(1..10, 20) # -> pass
1279
- # assert_not_include([1, 10], 1) # -> fail
1280
- # assert_not_include(1..10, 5) # -> fail
1281
- def assert_not_include(collection, object, message=nil)
1282
- _wrap_assertion do
1283
- assert_respond_to(collection, :include?,
1284
- "The collection must respond to :include?.")
1285
- full_message = build_message(message,
1286
- "<?> expected to not include\n<?>.",
1287
- collection,
1288
- object)
1289
- assert_block(full_message) do
1290
- not collection.include?(object)
1291
- end
1292
- end
1293
- end
1294
-
1295
- ##
1296
- # Passes if +object+ is empty.
1297
- #
1298
- # Example:
1299
- # assert_empty("") # -> pass
1300
- # assert_empty([]) # -> pass
1301
- # assert_empty({}) # -> pass
1302
- # assert_empty(" ") # -> fail
1303
- # assert_empty([nil]) # -> fail
1304
- # assert_empty({1 => 2}) # -> fail
1305
- def assert_empty(object, message=nil)
1306
- _wrap_assertion do
1307
- assert_respond_to(object, :empty?,
1308
- "The object must respond to :empty?.")
1309
- full_message = build_message(message,
1310
- "<?> expected to be empty.",
1311
- object)
1312
- assert_block(full_message) do
1313
- object.empty?
1314
- end
1315
- end
1316
- end
1317
-
1318
- ##
1319
- # Passes if +object+ is not empty.
1320
- #
1321
- # Example:
1322
- # assert_not_empty(" ") # -> pass
1323
- # assert_not_empty([nil]) # -> pass
1324
- # assert_not_empty({1 => 2}) # -> pass
1325
- # assert_not_empty("") # -> fail
1326
- # assert_not_empty([]) # -> fail
1327
- # assert_not_empty({}) # -> fail
1328
- def assert_not_empty(object, message=nil)
1329
- _wrap_assertion do
1330
- assert_respond_to(object, :empty?,
1331
- "The object must respond to :empty?.")
1332
- full_message = build_message(message,
1333
- "<?> expected to not be empty.",
1334
- object)
1335
- assert_block(full_message) do
1336
- not object.empty?
1337
- end
1338
- end
1339
- end
1340
-
1341
- ##
1342
- # Builds a failure message. +head+ is added before the +template+ and
1343
- # +arguments+ replaces the '?'s positionally in the template.
1344
-
1345
- public
1346
- def build_message(head, template=nil, *arguments)
1347
- template &&= template.chomp
1348
- return AssertionMessage.new(head, template, arguments)
1349
- end
1350
-
1351
- private
1352
- def _wrap_assertion(&block)
1353
- @_assertion_wrapped ||= false
1354
- if @_assertion_wrapped
1355
- block.call
1356
- else
1357
- @_assertion_wrapped = true
1358
- begin
1359
- add_assertion
1360
- block.call
1361
- ensure
1362
- @_assertion_wrapped = false
1363
- end
1364
- end
1365
- end
1366
-
1367
- ##
1368
- # Called whenever an assertion is made. Define this in classes that
1369
- # include Test::Unit::Assertions to record assertion counts.
1370
-
1371
- private
1372
- def add_assertion
1373
- end
1374
-
1375
- ##
1376
- # Select whether or not to use the pretty-printer. If this option is set
1377
- # to false before any assertions are made, pp.rb will not be required.
1378
-
1379
- public
1380
- def self.use_pp=(value)
1381
- AssertionMessage.use_pp = value
1382
- end
1383
-
1384
- # :stopdoc:
1385
- private
1386
- def _assert_raise(assert_expected_exception, *args, &block)
1387
- _wrap_assertion do
1388
- if args.last.is_a?(String)
1389
- message = args.pop
1390
- else
1391
- message = ""
1392
- end
1393
-
1394
- assert_exception_helper = AssertExceptionHelper.new(self, args)
1395
- expected = assert_exception_helper.expected_exceptions
1396
- actual_exception = nil
1397
- full_message = build_message(message,
1398
- "<?> exception expected " +
1399
- "but none was thrown.",
1400
- expected)
1401
- assert_block(full_message) do
1402
- begin
1403
- yield
1404
- false
1405
- rescue Exception => actual_exception
1406
- true
1407
- end
1408
- end
1409
- assert_expected_exception.call(message, assert_exception_helper,
1410
- actual_exception)
1411
- actual_exception
1412
- end
1413
- end
1414
-
1415
- class AssertionMessage
1416
- @use_pp = true
1417
- class << self
1418
- attr_accessor :use_pp
1419
-
1420
- def literal(value)
1421
- Literal.new(value)
1422
- end
1423
-
1424
- def delayed_literal(&block)
1425
- DelayedLiteral.new(block)
1426
- end
1427
-
1428
- def maybe_container(value, &formatter)
1429
- MaybeContainer.new(value, &formatter)
1430
- end
1431
-
1432
- MAX_DIFF_TARGET_STRING_SIZE = 1000
1433
- def max_diff_target_string_size
1434
- size = ENV["TEST_UNIT_MAX_DIFF_TARGET_STRING_SIZE"]
1435
- if size
1436
- begin
1437
- size = Integer(size)
1438
- rescue ArgumentError
1439
- size = nil
1440
- end
1441
- end
1442
- size || MAX_DIFF_TARGET_STRING_SIZE
1443
- end
1444
-
1445
- def diff_target_string?(string)
1446
- if string.respond_to?(:bytesize)
1447
- string.bytesize < max_diff_target_string_size
1448
- else
1449
- string.size < max_diff_target_string_size
1450
- end
1451
- end
1452
-
1453
- def ensure_diffable_string(string)
1454
- if string.respond_to?(:encoding) and
1455
- !string.encoding.ascii_compatible?
1456
- string = string.dup.force_encoding("ASCII-8BIT")
1457
- end
1458
- string
1459
- end
1460
-
1461
- def prepare_for_diff(from, to)
1462
- if !from.is_a?(String) or !to.is_a?(String)
1463
- from = convert(from)
1464
- to = convert(to)
1465
- end
1466
-
1467
- if diff_target_string?(from) and diff_target_string?(to)
1468
- from = ensure_diffable_string(from)
1469
- to = ensure_diffable_string(to)
1470
- [from, to]
1471
- else
1472
- [nil, nil]
1473
- end
1474
- end
1475
-
1476
- def delayed_diff(from, to)
1477
- delayed_literal do
1478
- from, to = prepare_for_diff(from, to)
1479
-
1480
- diff = "" if from.nil? or to.nil?
1481
- diff ||= Diff.readable(from, to)
1482
- if /^[-+]/ !~ diff
1483
- diff = ""
1484
- elsif /^[ ?]/ =~ diff or /(?:.*\n){2,}/ =~ diff
1485
- diff = "\n\ndiff:\n#{diff}"
1486
- else
1487
- diff = ""
1488
- end
1489
-
1490
- if Diff.need_fold?(diff)
1491
- folded_diff = Diff.folded_readable(from, to)
1492
- diff << "\n\nfolded diff:\n#{folded_diff}"
1493
- end
1494
-
1495
- diff
1496
- end
1497
- end
1498
-
1499
- def convert(object)
1500
- case object
1501
- when Exception
1502
- <<EOM.chop
1503
- Class: <#{convert(object.class)}>
1504
- Message: <#{convert(object.message)}>
1505
- ---Backtrace---
1506
- #{Util::BacktraceFilter.filter_backtrace(object.backtrace).join("\n")}
1507
- ---------------
1508
- EOM
1509
- else
1510
- if use_pp
1511
- begin
1512
- require 'pp' unless defined?(PP)
1513
- if HashInspector.target?(object)
1514
- pp_target = HashInspector.new(object)
1515
- else
1516
- pp_target = object
1517
- end
1518
- begin
1519
- return PP.pp(pp_target, '').chomp
1520
- rescue NameError
1521
- end
1522
- rescue LoadError
1523
- self.use_pp = false
1524
- end
1525
- end
1526
- object.inspect
1527
- end
1528
- end
1529
- end
1530
-
1531
- class HashInspector
1532
- class << self
1533
- def target?(object)
1534
- object.is_a?(Hash) or object == ENV
1535
- end
1536
-
1537
- def normalize(object)
1538
- if target?(object)
1539
- new(object)
1540
- else
1541
- object
1542
- end
1543
- end
1544
- end
1545
-
1546
- def initialize(hash)
1547
- @hash = hash
1548
- end
1549
-
1550
- def inspect
1551
- @hash.inspect
1552
- end
1553
-
1554
- def pretty_print(q)
1555
- q.group(1, '{', '}') do
1556
- q.seplist(self, nil, :each_pair) do |k, v|
1557
- q.group do
1558
- q.pp(k)
1559
- q.text('=>')
1560
- q.group(1) do
1561
- q.breakable('')
1562
- q.pp(v)
1563
- end
1564
- end
1565
- end
1566
- end
1567
- end
1568
-
1569
- def pretty_print_cycle(q)
1570
- q.text(@hash.empty? ? '{}' : '{...}')
1571
- end
1572
-
1573
- def each_pair
1574
- keys = @hash.keys
1575
- begin
1576
- keys = keys.sort # FIXME: more cleverly
1577
- rescue ArgumentError
1578
- end
1579
- keys.each do |key|
1580
- yield(self.class.normalize(key),
1581
- self.class.normalize(@hash[key]))
1582
- end
1583
- end
1584
- end
1585
-
1586
- class Literal
1587
- def initialize(value)
1588
- @value = value
1589
- end
1590
-
1591
- def inspect
1592
- @value.to_s
1593
- end
1594
- end
1595
-
1596
- class DelayedLiteral
1597
- def initialize(value)
1598
- @value = value
1599
- end
1600
-
1601
- def inspect
1602
- @value.call.to_s
1603
- end
1604
- end
1605
-
1606
- class MaybeContainer
1607
- def initialize(value, &formatter)
1608
- @value = value
1609
- @formatter = formatter
1610
- end
1611
-
1612
- def inspect
1613
- if @value.is_a?(Array)
1614
- values = @value.collect do |value|
1615
- @formatter.call(AssertionMessage.convert(value))
1616
- end
1617
- "[#{values.join(', ')}]"
1618
- else
1619
- @formatter.call(AssertionMessage.convert(@value))
1620
- end
1621
- end
1622
- end
1623
-
1624
- class Template
1625
- def self.create(string)
1626
- parts = (string ? string.scan(/(?=[^\\])\?|(?:\\\?|[^\?])+/m) : [])
1627
- self.new(parts)
1628
- end
1629
-
1630
- attr_reader :count
1631
-
1632
- def initialize(parts)
1633
- @parts = parts
1634
- @count = parts.find_all{|e| e == '?'}.size
1635
- end
1636
-
1637
- def result(parameters)
1638
- raise "The number of parameters does not match the number of substitutions." if(parameters.size != count)
1639
- params = parameters.dup
1640
- @parts.collect{|e| e == '?' ? params.shift : e.gsub(/\\\?/m, '?')}.join('')
1641
- end
1642
- end
1643
-
1644
- include Util::BacktraceFilter
1645
-
1646
- def initialize(head, template_string, parameters)
1647
- @head = head
1648
- @template_string = template_string
1649
- @parameters = parameters
1650
- end
1651
-
1652
- def convert(object)
1653
- self.class.convert(object)
1654
- end
1655
-
1656
- def template
1657
- @template ||= Template.create(@template_string)
1658
- end
1659
-
1660
- def add_period(string)
1661
- (string =~ /\.\Z/ ? string : string + '.')
1662
- end
1663
-
1664
- def to_s
1665
- message_parts = []
1666
- if (@head)
1667
- head = @head.to_s
1668
- unless(head.empty?)
1669
- message_parts << add_period(head)
1670
- end
1671
- end
1672
- tail = template.result(@parameters.collect{|e| convert(e)})
1673
- message_parts << tail unless(tail.empty?)
1674
- message_parts.join("\n")
1675
- end
1676
- end
1677
-
1678
- class AssertExceptionHelper
1679
- class WrappedException
1680
- def initialize(exception)
1681
- @exception = exception
1682
- end
1683
-
1684
- def inspect
1685
- if default_inspect?
1686
- "#{@exception.class.inspect}(#{@exception.message.inspect})"
1687
- else
1688
- @exception.inspect
1689
- end
1690
- end
1691
-
1692
- def method_missing(name, *args, &block)
1693
- @exception.send(name, *args, &block)
1694
- end
1695
-
1696
- private
1697
- def default_inspect?
1698
- inspect_method = @exception.method(:inspect)
1699
- if inspect_method.respond_to?(:owner) and
1700
- inspect_method.owner == Exception
1701
- true
1702
- else
1703
- default_inspect_method = Exception.instance_method(:inspect)
1704
- default_inspect_method.bind(@exception).call == @exception.inspect
1705
- end
1706
- end
1707
- end
1708
-
1709
- def initialize(test_case, expected_exceptions)
1710
- @test_case = test_case
1711
- @expected_exceptions = expected_exceptions
1712
- @expected_classes, @expected_modules, @expected_objects =
1713
- split_expected_exceptions(expected_exceptions)
1714
- end
1715
-
1716
- def expected_exceptions
1717
- exceptions = @expected_exceptions.collect do |exception|
1718
- if exception.is_a?(Exception)
1719
- WrappedException.new(exception)
1720
- else
1721
- exception
1722
- end
1723
- end
1724
- if exceptions.size == 1
1725
- exceptions[0]
1726
- else
1727
- exceptions
1728
- end
1729
- end
1730
-
1731
- def expected?(actual_exception, equality=nil)
1732
- equality ||= :instance_of?
1733
- expected_class?(actual_exception, equality) or
1734
- expected_module?(actual_exception) or
1735
- expected_object?(actual_exception)
1736
- end
1737
-
1738
- private
1739
- def split_expected_exceptions(expected_exceptions)
1740
- exception_modules = []
1741
- exception_objects = []
1742
- exception_classes = []
1743
- expected_exceptions.each do |exception_type|
1744
- if exception_type.instance_of?(Module)
1745
- exception_modules << exception_type
1746
- elsif exception_type.is_a?(Exception)
1747
- exception_objects << exception_type
1748
- else
1749
- @test_case.send(:assert,
1750
- Exception >= exception_type,
1751
- "Should expect a class of exception, " +
1752
- "#{exception_type}")
1753
- exception_classes << exception_type
1754
- end
1755
- end
1756
- [exception_classes, exception_modules, exception_objects]
1757
- end
1758
-
1759
- def expected_class?(actual_exception, equality)
1760
- @expected_classes.any? do |expected_class|
1761
- actual_exception.send(equality, expected_class)
1762
- end
1763
- end
1764
-
1765
- def expected_module?(actual_exception)
1766
- @expected_modules.any? do |expected_module|
1767
- actual_exception.is_a?(expected_module)
1768
- end
1769
- end
1770
-
1771
- def expected_object?(actual_exception)
1772
- @expected_objects.any? do |expected_object|
1773
- expected_object == actual_exception or
1774
- fallback_exception_object_equal(expected_object, actual_exception)
1775
- end
1776
- end
1777
-
1778
- def fallback_exception_object_equal(expected_object, actual_exception)
1779
- owner = Util::MethodOwnerFinder.find(expected_object, :==)
1780
- if owner == Kernel or owner == Exception
1781
- expected_object.class == actual_exception.class and
1782
- expected_object.message == actual_exception.message
1783
- else
1784
- false
1785
- end
1786
- end
1787
- end
1788
-
1789
- # :startdoc:
1790
- end
1791
- end
1792
- end