win32-api 1.5.3-universal-mingw32 → 1.6.0-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (358) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +174 -169
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +24 -0
  5. data/README +129 -131
  6. data/Rakefile +185 -182
  7. data/appveyor.yml +42 -0
  8. data/ext/win32/api.c +1092 -1092
  9. data/lib/win32/api.rb +14 -8
  10. data/lib/win32/ruby21_32/win32/api.so +0 -0
  11. data/lib/win32/ruby21_64/win32/api.so +0 -0
  12. data/lib/win32/ruby22_32/win32/api.so +0 -0
  13. data/lib/win32/ruby22_64/win32/api.so +0 -0
  14. data/lib/win32/ruby23_32/win32/api.so +0 -0
  15. data/lib/win32/ruby23_64/win32/api.so +0 -0
  16. data/lib/win32/ruby2_32/win32/api.so +0 -0
  17. data/lib/win32/ruby2_64/win32/api.so +0 -0
  18. data/test/test_win32_api.rb +145 -145
  19. data/vendor/bundle/ruby/2.2.0/bin/devkit +23 -0
  20. data/vendor/bundle/ruby/2.2.0/bin/devkit.bat +6 -0
  21. data/vendor/bundle/ruby/2.2.0/bin/rake +23 -0
  22. data/vendor/bundle/ruby/2.2.0/bin/rake.bat +6 -0
  23. data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/CHANGELOG +55 -0
  24. data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/LICENSE +339 -0
  25. data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/README.md +73 -0
  26. data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/Rakefile +8 -0
  27. data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/colorize.gemspec +35 -0
  28. data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize.rb +12 -0
  29. data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize/class_methods.rb +116 -0
  30. data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize/instance_methods.rb +135 -0
  31. data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/test/test_colorize.rb +161 -0
  32. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Gemfile +4 -0
  33. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/LICENSE.txt +22 -0
  34. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/README.md +34 -0
  35. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Rakefile +1 -0
  36. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Rspec-example-matchers.txt +184 -0
  37. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/bin/devkit +87 -0
  38. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/devkit.gemspec +27 -0
  39. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit.rb +18 -0
  40. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/core.rb +53 -0
  41. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/identity.rb +78 -0
  42. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/ssh_identity.rb +53 -0
  43. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/version.rb +3 -0
  44. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/core_spec.rb +46 -0
  45. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/identity_spec.rb +1 -0
  46. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/ssh_identity_spec.rb +1 -0
  47. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit_spec.rb +5 -0
  48. data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/spec_helper.rb +8 -0
  49. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/AUTHORS +3 -0
  50. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/COPYING +339 -0
  51. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Changelog.md +415 -0
  52. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Gemfile +9 -0
  53. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/INSTALL +59 -0
  54. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/LICENSE +7 -0
  55. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/README.rdoc +74 -0
  56. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Rakefile +30 -0
  57. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/TODO +6 -0
  58. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/ansi_colors.rb +38 -0
  59. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/asking_for_arrays.rb +18 -0
  60. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/basic_usage.rb +75 -0
  61. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/color_scheme.rb +32 -0
  62. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/get_character.rb +12 -0
  63. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/limit.rb +12 -0
  64. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/menus.rb +65 -0
  65. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/overwrite.rb +19 -0
  66. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/page_and_wrap.rb +322 -0
  67. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/password.rb +7 -0
  68. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/repeat_entry.rb +21 -0
  69. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/trapping_eof.rb +22 -0
  70. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/using_readline.rb +17 -0
  71. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/highline.gemspec +37 -0
  72. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline.rb +1048 -0
  73. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/color_scheme.rb +134 -0
  74. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/compatibility.rb +16 -0
  75. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/import.rb +41 -0
  76. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/menu.rb +381 -0
  77. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/question.rb +480 -0
  78. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/simulate.rb +48 -0
  79. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/style.rb +192 -0
  80. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/version.rb +4 -0
  81. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/setup.rb +1360 -0
  82. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/site/highline.css +65 -0
  83. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/site/images/logo.png +0 -0
  84. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/site/index.html +58 -0
  85. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/string_methods.rb +32 -0
  86. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_color_scheme.rb +96 -0
  87. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_highline.rb +1402 -0
  88. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_import.rb +52 -0
  89. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_menu.rb +439 -0
  90. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_simulator.rb +23 -0
  91. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_string_highline.rb +38 -0
  92. data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_style.rb +578 -0
  93. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/BSDL +22 -0
  94. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/COPYING +57 -0
  95. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/Gemfile +9 -0
  96. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/LEGAL +4 -0
  97. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/README.rdoc +19 -0
  98. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/Rakefile +16 -0
  99. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/benchmarks/bm_yhpg.rb +59 -0
  100. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/benchmarks/helper.rb +8 -0
  101. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert.rb +338 -0
  102. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert/enable_tracepoint_events.rb +82 -0
  103. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert/version.rb +3 -0
  104. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/power_assert.gemspec +23 -0
  105. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/test/helper.rb +10 -0
  106. data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/test/test_power_assert.rb +512 -0
  107. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/CONTRIBUTING.rdoc +38 -0
  108. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/History.rdoc +719 -0
  109. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/MIT-LICENSE +21 -0
  110. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/Manifest.txt +154 -0
  111. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/README.rdoc +157 -0
  112. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/Rakefile +82 -0
  113. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/bin/rake +33 -0
  114. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/command_line_usage.rdoc +158 -0
  115. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/Rakefile1 +38 -0
  116. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/Rakefile2 +35 -0
  117. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/a.c +6 -0
  118. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/b.c +6 -0
  119. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/main.c +11 -0
  120. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/glossary.rdoc +42 -0
  121. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/jamis.rb +591 -0
  122. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/proto_rake.rdoc +127 -0
  123. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rake.1 +141 -0
  124. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rakefile.rdoc +624 -0
  125. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rational.rdoc +151 -0
  126. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.4.14.rdoc +23 -0
  127. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.4.15.rdoc +35 -0
  128. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.0.rdoc +53 -0
  129. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.3.rdoc +78 -0
  130. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.4.rdoc +46 -0
  131. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.6.0.rdoc +141 -0
  132. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.0.rdoc +119 -0
  133. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.1.rdoc +59 -0
  134. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.2.rdoc +121 -0
  135. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.3.rdoc +47 -0
  136. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.0.rdoc +114 -0
  137. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.2.rdoc +165 -0
  138. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.3.rdoc +112 -0
  139. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.4.rdoc +147 -0
  140. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.5.rdoc +53 -0
  141. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.6.rdoc +37 -0
  142. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.7.rdoc +55 -0
  143. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.0.rdoc +112 -0
  144. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.1.rdoc +52 -0
  145. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.2.2.rdoc +55 -0
  146. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.2.rdoc +49 -0
  147. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.3.rdoc +102 -0
  148. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.4.rdoc +60 -0
  149. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.5.rdoc +55 -0
  150. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.6.rdoc +64 -0
  151. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.0.rdoc +178 -0
  152. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.1.rdoc +58 -0
  153. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.2.rdoc +53 -0
  154. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.3.rdoc +191 -0
  155. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.1.0.rdoc +61 -0
  156. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake.rb +73 -0
  157. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb +787 -0
  158. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/backtrace.rb +23 -0
  159. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/clean.rb +76 -0
  160. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/cloneable.rb +16 -0
  161. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/compositepublisher.rb +21 -0
  162. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/ftptools.rb +137 -0
  163. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/sshpublisher.rb +60 -0
  164. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/cpu_counter.rb +120 -0
  165. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/default_loader.rb +14 -0
  166. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/dsl_definition.rb +194 -0
  167. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/early_time.rb +21 -0
  168. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_creation_task.rb +24 -0
  169. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_list.rb +436 -0
  170. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_task.rb +46 -0
  171. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_utils.rb +123 -0
  172. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/invocation_chain.rb +56 -0
  173. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/invocation_exception_mixin.rb +16 -0
  174. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/late_time.rb +17 -0
  175. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/linked_list.rb +111 -0
  176. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/loaders/makefile.rb +53 -0
  177. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/multi_task.rb +13 -0
  178. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/name_space.rb +38 -0
  179. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/packagetask.rb +199 -0
  180. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/phony.rb +15 -0
  181. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/private_reader.rb +20 -0
  182. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/promise.rb +99 -0
  183. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/pseudo_status.rb +29 -0
  184. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb +38 -0
  185. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rake_test_loader.rb +22 -0
  186. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
  187. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/scope.rb +42 -0
  188. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task.rb +391 -0
  189. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_argument_error.rb +7 -0
  190. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_arguments.rb +102 -0
  191. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_manager.rb +316 -0
  192. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/tasklib.rb +11 -0
  193. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/testtask.rb +204 -0
  194. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/thread_history_display.rb +48 -0
  195. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/thread_pool.rb +163 -0
  196. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/trace_output.rb +22 -0
  197. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/version.rb +7 -0
  198. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/win32.rb +50 -0
  199. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/rakelib/test_times.rake +25 -0
  200. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/file_creation.rb +34 -0
  201. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/helper.rb +134 -0
  202. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/support/rakefile_definitions.rb +476 -0
  203. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/support/ruby_runner.rb +34 -0
  204. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_private_reader.rb +42 -0
  205. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake.rb +40 -0
  206. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_application.rb +659 -0
  207. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_application_options.rb +468 -0
  208. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_backtrace.rb +119 -0
  209. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_clean.rb +61 -0
  210. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_cpu_counter.rb +68 -0
  211. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_definitions.rb +84 -0
  212. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_directory_task.rb +76 -0
  213. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_dsl.rb +40 -0
  214. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_early_time.rb +31 -0
  215. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_creation_task.rb +56 -0
  216. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_list.rb +687 -0
  217. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_list_path_map.rb +15 -0
  218. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_task.rb +197 -0
  219. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_utils.rb +318 -0
  220. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_ftp_file.rb +74 -0
  221. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_functional.rb +484 -0
  222. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_invocation_chain.rb +64 -0
  223. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_late_time.rb +18 -0
  224. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_linked_list.rb +84 -0
  225. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_makefile_loader.rb +46 -0
  226. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_multi_task.rb +64 -0
  227. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_name_space.rb +57 -0
  228. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_package_task.rb +79 -0
  229. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map.rb +168 -0
  230. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map_explode.rb +34 -0
  231. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map_partial.rb +18 -0
  232. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_pseudo_status.rb +21 -0
  233. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_rake_test_loader.rb +20 -0
  234. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_reduce_compat.rb +26 -0
  235. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_require.rb +40 -0
  236. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_rules.rb +388 -0
  237. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_scope.rb +44 -0
  238. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task.rb +430 -0
  239. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_argument_parsing.rb +119 -0
  240. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_arguments.rb +134 -0
  241. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_manager.rb +178 -0
  242. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_manager_argument_resolution.rb +19 -0
  243. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_with_arguments.rb +172 -0
  244. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_test_task.rb +130 -0
  245. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_thread_pool.rb +145 -0
  246. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_top_level_functions.rb +71 -0
  247. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_win32.rb +72 -0
  248. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_thread_history_display.rb +101 -0
  249. data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_trace_output.rb +52 -0
  250. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/COPYING +64 -0
  251. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/GPL +339 -0
  252. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/LGPL +502 -0
  253. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/PSFL +271 -0
  254. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/README.md +101 -0
  255. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/Rakefile +71 -0
  256. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test-unit.rb +34 -0
  257. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit.rb +505 -0
  258. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/assertion-failed-error.rb +25 -0
  259. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/assertions.rb +2218 -0
  260. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/attribute-matcher.rb +26 -0
  261. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/attribute.rb +158 -0
  262. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/auto-runner-loader.rb +17 -0
  263. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/autorunner.rb +536 -0
  264. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/code-snippet-fetcher.rb +58 -0
  265. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector.rb +73 -0
  266. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/descendant.rb +19 -0
  267. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/dir.rb +108 -0
  268. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/load.rb +202 -0
  269. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/objectspace.rb +34 -0
  270. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/xml.rb +249 -0
  271. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/color-scheme.rb +198 -0
  272. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/color.rb +134 -0
  273. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/data.rb +262 -0
  274. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/diff.rb +746 -0
  275. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/error.rb +158 -0
  276. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/exception-handler.rb +82 -0
  277. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/failure.rb +169 -0
  278. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/fault-location-detector.rb +100 -0
  279. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/fixture.rb +295 -0
  280. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/notification.rb +136 -0
  281. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/omission.rb +195 -0
  282. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/pending.rb +154 -0
  283. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/priority.rb +192 -0
  284. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/console.rb +59 -0
  285. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/emacs.rb +8 -0
  286. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/xml.rb +15 -0
  287. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/test-suite-creator.rb +89 -0
  288. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testcase.rb +811 -0
  289. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testresult.rb +132 -0
  290. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testsuite.rb +175 -0
  291. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/console/outputlevel.rb +15 -0
  292. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/console/testrunner.rb +693 -0
  293. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/emacs/testrunner.rb +49 -0
  294. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunner.rb +53 -0
  295. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunnermediator.rb +114 -0
  296. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunnerutilities.rb +41 -0
  297. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/xml/testrunner.rb +224 -0
  298. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/backtracefilter.rb +59 -0
  299. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/method-owner-finder.rb +28 -0
  300. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/observable.rb +90 -0
  301. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/output.rb +31 -0
  302. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/procwrapper.rb +48 -0
  303. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/version.rb +5 -0
  304. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/adder.rb +13 -0
  305. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/subtracter.rb +12 -0
  306. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_adder.rb +20 -0
  307. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_subtracter.rb +20 -0
  308. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_user.rb +23 -0
  309. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test-descendant.rb +178 -0
  310. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test-load.rb +442 -0
  311. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test_dir.rb +406 -0
  312. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test_objectspace.rb +100 -0
  313. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header-label.csv +3 -0
  314. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header-label.tsv +3 -0
  315. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header.csv +3 -0
  316. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header.tsv +3 -0
  317. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/no-header.csv +2 -0
  318. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/no-header.tsv +2 -0
  319. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/plus.csv +3 -0
  320. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/run-test.rb +22 -0
  321. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-assertions.rb +2160 -0
  322. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-attribute-matcher.rb +38 -0
  323. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-attribute.rb +123 -0
  324. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-code-snippet.rb +37 -0
  325. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-color-scheme.rb +82 -0
  326. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-color.rb +47 -0
  327. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-data.rb +303 -0
  328. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-diff.rb +518 -0
  329. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-emacs-runner.rb +60 -0
  330. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-error.rb +26 -0
  331. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-failure.rb +33 -0
  332. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-fault-location-detector.rb +163 -0
  333. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-fixture.rb +713 -0
  334. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-notification.rb +33 -0
  335. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-omission.rb +81 -0
  336. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-pending.rb +70 -0
  337. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-priority.rb +173 -0
  338. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-case.rb +1171 -0
  339. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-result.rb +113 -0
  340. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-suite-creator.rb +97 -0
  341. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-suite.rb +150 -0
  342. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/testunit-test-util.rb +31 -0
  343. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/ui/test_testrunmediator.rb +20 -0
  344. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test-method-owner-finder.rb +38 -0
  345. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test-output.rb +11 -0
  346. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_backtracefilter.rb +52 -0
  347. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_observable.rb +102 -0
  348. data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_procwrapper.rb +36 -0
  349. data/vendor/bundle/ruby/2.2.0/specifications/colorize-0.7.7.gemspec +38 -0
  350. data/vendor/bundle/ruby/2.2.0/specifications/devkit-0.1.0.gemspec +46 -0
  351. data/vendor/bundle/ruby/2.2.0/specifications/highline-1.7.8.gemspec +37 -0
  352. data/vendor/bundle/ruby/2.2.0/specifications/power_assert-0.3.0.gemspec +41 -0
  353. data/vendor/bundle/ruby/2.2.0/specifications/rake-11.1.2.gemspec +43 -0
  354. data/vendor/bundle/ruby/2.2.0/specifications/test-unit-3.1.9.gemspec +47 -0
  355. data/win32-api.gemspec +27 -27
  356. metadata +345 -5
  357. data/lib/win32/ruby18/win32/api.so +0 -0
  358. data/lib/win32/ruby19/win32/api.so +0 -0
@@ -0,0 +1,100 @@
1
+ # Author:: Nathaniel Talbott.
2
+ # Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
3
+ # License:: Ruby license.
4
+
5
+ require 'test/unit'
6
+ require 'test/unit/collector/objectspace'
7
+
8
+ module Test
9
+ module Unit
10
+ module Collector
11
+ class TC_ObjectSpace < TestCase
12
+ def setup
13
+ @tc1 = Class.new(TestCase) do
14
+ def self.name
15
+ "tc_1"
16
+ end
17
+ def test_1
18
+ end
19
+ def test_2
20
+ end
21
+ end
22
+
23
+ @tc2 = Class.new(TestCase) do
24
+ def self.name
25
+ "tc_2"
26
+ end
27
+ def test_0
28
+ end
29
+ end
30
+
31
+ @no_tc = Class.new do
32
+ def test_4
33
+ end
34
+ end
35
+
36
+ @object_space = {Class => [@tc1, @tc2, @no_tc], String => ['']}
37
+ def @object_space.each_object(type)
38
+ self[type].each{|item| yield(item) }
39
+ end
40
+
41
+ @c = ObjectSpace.new(@object_space)
42
+ end
43
+
44
+ def full_suite(name=ObjectSpace::NAME)
45
+ expected = TestSuite.new(name)
46
+ expected << (TestSuite.new(@tc1.name) << @tc1.new('test_1') << @tc1.new('test_2'))
47
+ expected << (TestSuite.new(@tc2.name) << @tc2.new('test_0'))
48
+ end
49
+
50
+ def empty_suite
51
+ TestSuite.new(ObjectSpace::NAME)
52
+ end
53
+
54
+ def test_basic_collection
55
+ assert_equal(full_suite("name"), @c.collect("name"))
56
+
57
+ @c.filter = []
58
+ assert_equal(full_suite("name"), @c.collect("name"))
59
+ end
60
+
61
+ def test_filtered_collection
62
+ @c.filter = proc{false}
63
+ assert_equal(empty_suite, @c.collect)
64
+
65
+ @c.filter = proc{true}
66
+ assert_equal(full_suite, @c.collect)
67
+
68
+ @c.filter = proc{nil}
69
+ assert_equal(full_suite, @c.collect)
70
+
71
+ @c.filter = [proc{false}, proc{true}]
72
+ assert_equal(empty_suite, @c.collect)
73
+
74
+ @c.filter = [proc{true}, proc{false}]
75
+ assert_equal(empty_suite, @c.collect)
76
+
77
+ @c.filter = [proc{nil}, proc{false}]
78
+ assert_equal(empty_suite, @c.collect)
79
+
80
+ @c.filter = [proc{nil}, proc{true}]
81
+ assert_equal(full_suite, @c.collect)
82
+
83
+ expected = TestSuite.new(ObjectSpace::NAME)
84
+ expected << (TestSuite.new(@tc1.name) << @tc1.new('test_1'))
85
+ expected << (TestSuite.new(@tc2.name) << @tc2.new('test_0'))
86
+ @c.filter = proc{|test| ['test_1', 'test_0'].include?(test.method_name)}
87
+ assert_equal(expected, @c.collect)
88
+
89
+ expected = TestSuite.new(ObjectSpace::NAME)
90
+ TestSuite.new(@tc1.name) << @tc1.new('test_1')
91
+ TestSuite.new(@tc2.name) << @tc2.new('test_0')
92
+ @c.filter = [proc{|t| t.method_name == 'test_1' ? true : nil},
93
+ proc{|t| t.method_name == 'test_0' ? true : nil},
94
+ proc{false}]
95
+ assert_equal(empty_suite, @c.collect)
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,3 @@
1
+ label,expected,label
2
+ upper case,HELLO,HELLO
3
+ lower case,Hello,hello
@@ -0,0 +1,3 @@
1
+ label expected label
2
+ upper case HELLO HELLO
3
+ lower case Hello hello
@@ -0,0 +1,3 @@
1
+ label,expected,target
2
+ empty string,true,""
3
+ plain string,false,hello
@@ -0,0 +1,3 @@
1
+ label expected target
2
+ empty string true ""
3
+ plain string false hello
@@ -0,0 +1,2 @@
1
+ empty string,true,""
2
+ plain string,false,hello
@@ -0,0 +1,2 @@
1
+ empty string true ""
2
+ plain string false hello
@@ -0,0 +1,3 @@
1
+ label,expected,augend,addend
2
+ positive positive,4,3,1
3
+ positive negative,-1,1,-2
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $VERBOSE = true
4
+
5
+ $KCODE = "utf8" unless "".respond_to?(:encoding)
6
+
7
+ base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
8
+ lib_dir = File.join(base_dir, "lib")
9
+ test_dir = File.join(base_dir, "test")
10
+
11
+ $LOAD_PATH.unshift(lib_dir)
12
+
13
+ require 'test/unit'
14
+
15
+ test_unit_notify_base_dir = File.join(base_dir, "..", "test-unit-notify")
16
+ test_unit_notify_base_dir = File.expand_path(test_unit_notify_base_dir)
17
+ if File.exist?(test_unit_notify_base_dir)
18
+ $LOAD_PATH.unshift(File.join(test_unit_notify_base_dir, "lib"))
19
+ require 'test/unit/notify'
20
+ end
21
+
22
+ exit Test::Unit::AutoRunner.run(true, test_dir)
@@ -0,0 +1,2160 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Author:: Nathaniel Talbott.
4
+ # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
5
+ # Copyright (c) 2009-2014 Kouhei Sutou. All rights reserved.
6
+ # License:: Ruby license.
7
+
8
+ require 'test/unit'
9
+ require "testunit-test-util"
10
+
11
+ module Test
12
+ module Unit
13
+ module AssertionCheckable
14
+ include TestUnitTestUtil
15
+
16
+ private
17
+ def check(value, message="")
18
+ add_assertion
19
+ raise AssertionFailedError.new(message) unless value
20
+ end
21
+
22
+ def check_assertions(expect_fail, options={})
23
+ expected_message = options[:expected_message]
24
+ actual_message_normalizer = options[:actual_message_normalizer]
25
+ return_value_expected = options[:return_value_expected]
26
+ @actual_assertion_count = 0
27
+ failed = true
28
+ actual_message = nil
29
+ @catch_assertions = true
30
+ return_value = nil
31
+ begin
32
+ return_value = yield
33
+ failed = false
34
+ rescue AssertionFailedError => error
35
+ actual_message = error.message
36
+ end
37
+ @catch_assertions = false
38
+
39
+ if expect_fail
40
+ message = "Should have failed, but didn't"
41
+ else
42
+ message = "Should not have failed, but did with message\n" +
43
+ "<#{actual_message}>"
44
+ end
45
+ check(expect_fail == failed, message)
46
+
47
+ message = "Should have made one assertion but made\n" +
48
+ "<#{@actual_assertion_count}>"
49
+ check(1 == @actual_assertion_count, message)
50
+
51
+ if expect_fail
52
+ if actual_message_normalizer
53
+ actual_message = actual_message_normalizer.call(actual_message)
54
+ end
55
+ case expected_message
56
+ when String
57
+ check(expected_message == actual_message,
58
+ "Should have the correct message.\n" +
59
+ "<#{expected_message.inspect}> expected but was\n" +
60
+ "<#{actual_message.inspect}>")
61
+ when Regexp
62
+ check(expected_message =~ actual_message,
63
+ "The message should match correctly.\n" +
64
+ "</#{expected_message.source}/> expected to match\n" +
65
+ "<#{actual_message.inspect}>")
66
+ else
67
+ check(false,
68
+ "Incorrect expected message type in assert_nothing_failed")
69
+ end
70
+ else
71
+ case return_value_expected
72
+ when :dont_care
73
+ # do nothing
74
+ when true
75
+ check(!return_value.nil?, "Should return a value")
76
+ else
77
+ check(return_value.nil?,
78
+ "Should not return a value but returned <#{return_value}>")
79
+ end
80
+ end
81
+
82
+ return_value
83
+ end
84
+
85
+ def check_nothing_fails(return_value_expected=false, &proc)
86
+ check_assertions(false,
87
+ {:expected_message => nil,
88
+ :return_value_expected => return_value_expected},
89
+ &proc)
90
+ end
91
+
92
+ def check_fail(expected_message, options={}, &proc)
93
+ check_assertions(true,
94
+ options.merge(:expected_message => expected_message),
95
+ &proc)
96
+ end
97
+
98
+ def check_fail_exception(expected_message, options={}, &proc)
99
+ normalizer = lambda do |actual_message|
100
+ actual_message.gsub(/(^[^:\n]+:\d+:.+\n?)+\z/, "")
101
+ end
102
+ check_assertions(true,
103
+ options.merge(:expected_message => expected_message,
104
+ :actual_message_normalizer => normalizer),
105
+ &proc)
106
+ end
107
+
108
+ def inspect_tag(tag)
109
+ tag.inspect
110
+ end
111
+
112
+ def add_failure(message, location=caller, options=nil)
113
+ unless @catch_assertions
114
+ super
115
+ end
116
+ end
117
+
118
+ def add_assertion
119
+ if @catch_assertions
120
+ @actual_assertion_count += 1
121
+ else
122
+ super
123
+ end
124
+ end
125
+ end
126
+
127
+ class TestAssertions < TestCase
128
+ include AssertionCheckable
129
+
130
+ class TestAssertBlock < self
131
+ def test_pass_without_message
132
+ check_nothing_fails {
133
+ assert_block {true}
134
+ }
135
+ end
136
+
137
+ def test_pass_with_message
138
+ check_nothing_fails {
139
+ assert_block("successful assert_block") {true}
140
+ }
141
+ end
142
+
143
+ def test_failure_without_message
144
+ check_fail("assert_block failed.") {
145
+ assert_block {false}
146
+ }
147
+ end
148
+
149
+ def test_failure_with_message
150
+ check_fail("failed assert_block") {
151
+ assert_block("failed assert_block") {false}
152
+ }
153
+ end
154
+ end
155
+
156
+ class TestAssertEqual < self
157
+ class TestSuccess < self
158
+ def test_without_message
159
+ check_nothing_fails {
160
+ assert_equal("string1", "string1")
161
+ }
162
+ end
163
+
164
+ def test_with_message
165
+ check_nothing_fails {
166
+ assert_equal("string1", "string1", "successful assert_equal")
167
+ }
168
+ end
169
+ end
170
+
171
+ class TestFailure < self
172
+ def test_without_message
173
+ message = <<-EOM.chomp
174
+ <"string1"> expected but was
175
+ <"string2">.
176
+
177
+ diff:
178
+ - string1
179
+ ? ^
180
+ + string2
181
+ ? ^
182
+ EOM
183
+ check_fail(message) {
184
+ assert_equal("string1", "string2")
185
+ }
186
+ end
187
+
188
+ def test_with_message
189
+ message = <<-EOM.chomp
190
+ failed assert_equal.
191
+ <"string1"> expected but was
192
+ <"string2">.
193
+
194
+ diff:
195
+ - string1
196
+ ? ^
197
+ + string2
198
+ ? ^
199
+ EOM
200
+ check_fail(message) {
201
+ assert_equal("string1", "string2", "failed assert_equal")
202
+ }
203
+ end
204
+
205
+ def test_with_message_proc
206
+ message = <<-EOM.chomp
207
+ failed assert_equal.
208
+ <"string1"> expected but was
209
+ <"string2">.
210
+
211
+ diff:
212
+ - string1
213
+ ? ^
214
+ + string2
215
+ ? ^
216
+ EOM
217
+ check_fail(message) do
218
+ assert_equal("string1", "string2", lambda {"failed assert_equal"})
219
+ end
220
+ end
221
+ end
222
+
223
+ class TestSystemMessage < self
224
+ def test_different_type
225
+ message = <<-EOM.chomp
226
+ <"111111"> expected but was
227
+ <111111>.
228
+
229
+ diff:
230
+ - "111111"
231
+ ? - -
232
+ + 111111
233
+ EOM
234
+ check_fail(message) do
235
+ assert_equal("111111", 111111)
236
+ end
237
+ end
238
+
239
+ def test_long_line
240
+ expected = ["0123456789",
241
+ "1123456789",
242
+ "2123456789",
243
+ "3123456789",
244
+ "4123456789",
245
+ "5123456789",
246
+ "6123456789",
247
+ "7123456789",
248
+ "8123456789"].join
249
+ actual = ["0000000000",
250
+ "1123456789",
251
+ "2123456789",
252
+ "3123456789",
253
+ "4123456789",
254
+ "5123456789",
255
+ "6123456789",
256
+ "7123456789",
257
+ "8123456789"].join
258
+ message = <<-EOM.chomp
259
+ <"#{expected}"> expected but was
260
+ <"#{actual}">.
261
+
262
+ diff:
263
+ - #{expected}
264
+ ? ^^^^^^^^^
265
+ + #{actual}
266
+ ? ^^^^^^^^^
267
+
268
+ folded diff:
269
+ - 012345678911234567892123456789312345678941234567895123456789612345678971234567
270
+ ? ^^^^^^^^^
271
+ + 000000000011234567892123456789312345678941234567895123456789612345678971234567
272
+ ? ^^^^^^^^^
273
+ 898123456789
274
+ EOM
275
+ check_fail(message) do
276
+ assert_equal(expected, actual)
277
+ end
278
+ end
279
+
280
+ def test_too_small_difference
281
+ message = <<-EOM.chomp
282
+ <1> expected but was
283
+ <2>.
284
+ EOM
285
+ check_fail(message) do
286
+ assert_equal(1, 2)
287
+ end
288
+ end
289
+
290
+ def test_same_inspected_objects
291
+ now = Time.now
292
+ now_without_usec = Time.at(now.to_i)
293
+ message = <<-EOM.chomp
294
+ <#{now.inspect}> expected but was
295
+ <#{now.inspect}>.
296
+ EOM
297
+ check_fail(message) do
298
+ assert_equal(now, now_without_usec)
299
+ end
300
+ end
301
+
302
+ def test_multi_lines_result
303
+ message = <<-EOM.chomp
304
+ <#{"a\nb".inspect}> expected but was
305
+ <#{"x".inspect}>.
306
+
307
+ diff:
308
+ + x
309
+ - a
310
+ - b
311
+ EOM
312
+ check_fail(message) do
313
+ assert_equal("a\nb", "x")
314
+ end
315
+ end
316
+
317
+ def test_large_string
318
+ message = <<-EOM.chomp
319
+ <#{("a\n" + "x" * 997).inspect}> expected but was
320
+ <#{"x".inspect}>.
321
+
322
+ diff:
323
+ + x
324
+ - a
325
+ - #{"x" * 997}
326
+
327
+ folded diff:
328
+ + x
329
+ - a
330
+ #{(["- " + ("x" * 78)] * 12).join("\n")}
331
+ - #{"x" * 61}
332
+ EOM
333
+ check_fail(message) do
334
+ assert_equal("a\n" + "x" * 997, "x")
335
+ end
336
+
337
+ message = <<-EOM.chomp
338
+ <#{("a\n" + "x" * 998).inspect}> expected but was
339
+ <#{"x".inspect}>.
340
+ EOM
341
+ check_fail(message) do
342
+ assert_equal("a\n" + "x" * 998, "x")
343
+ end
344
+ end
345
+
346
+ def test_max_diff_target_string_size
347
+ key = "TEST_UNIT_MAX_DIFF_TARGET_STRING_SIZE"
348
+ before_value = ENV[key]
349
+ ENV[key] = "100"
350
+ begin
351
+ message = <<-EOM.chomp
352
+ <#{("a\n" + "x" * 97).inspect}> expected but was
353
+ <#{"x".inspect}>.
354
+
355
+ diff:
356
+ + x
357
+ - a
358
+ - #{"x" * 97}
359
+
360
+ folded diff:
361
+ + x
362
+ - a
363
+ #{(["- " + ("x" * 78)]).join("\n")}
364
+ - #{"x" * 19}
365
+ EOM
366
+ check_fail(message) do
367
+ assert_equal("a\n" + "x" * 97, "x")
368
+ end
369
+
370
+ message = <<-EOM.chomp
371
+ <#{("a\n" + "x" * 98).inspect}> expected but was
372
+ <#{"x".inspect}>.
373
+ EOM
374
+ check_fail(message) do
375
+ assert_equal("a\n" + "x" * 98, "x")
376
+ end
377
+ ensure
378
+ ENV[key] = before_value
379
+ end
380
+ end
381
+
382
+ def test_different_encoding
383
+ utf8_string = "こんにちは"
384
+ unless utf8_string.respond_to?(:force_encoding)
385
+ omit("encoding test is for Ruby >= 1.9")
386
+ end
387
+ ascii_8bit_string = utf8_string.dup.force_encoding("ascii-8bit")
388
+ message = <<-EOM.chomp
389
+ <#{utf8_string.inspect}>("UTF-8") expected but was
390
+ <#{ascii_8bit_string.inspect}>("ASCII-8BIT").
391
+ EOM
392
+ check_fail(message) do
393
+ assert_equal(utf8_string, ascii_8bit_string)
394
+ end
395
+ end
396
+
397
+ def test_different_hash
398
+ designers = {
399
+ "Ruby" => "Matz",
400
+ "Lisp" => "John McCarthy",
401
+ }
402
+ categories = {
403
+ "LL" => ["Ruby", "Python"],
404
+ "Heavy" => ["C", "C++"],
405
+ }
406
+ message = <<-EOM.chomp
407
+ <{"Lisp"=>"John McCarthy", "Ruby"=>"Matz"}> expected but was
408
+ <{"Heavy"=>["C", "C++"], "LL"=>["Ruby", "Python"]}>.
409
+ EOM
410
+ check_fail(message) do
411
+ assert_equal(designers, categories)
412
+ end
413
+ end
414
+
415
+ def test_recursive_hash
416
+ alice = {"name" => "Alice"}
417
+ bob = {"name" => "Bob"}
418
+ alice["followers"] = [bob]
419
+ bob["followers"] = [alice]
420
+ message = <<-EOM.chomp
421
+ <{"followers"=>[{"followers"=>[{...}], "name"=>"Bob"}], "name"=>"Alice"}> expected but was
422
+ <{"followers"=>[{"followers"=>[{...}], "name"=>"Alice"}], "name"=>"Bob"}>.
423
+
424
+ diff:
425
+ - {"followers"=>[{"followers"=>[{...}], "name"=>"Bob"}], "name"=>"Alice"}
426
+ ? -----------------
427
+ + {"followers"=>[{"followers"=>[{...}], "name"=>"Alice"}], "name"=>"Bob"}
428
+ ? +++++++++++++++++
429
+ EOM
430
+ check_fail(message) do
431
+ assert_equal(alice, bob)
432
+ end
433
+ end
434
+
435
+ def test_numeric
436
+ numeric_family_class = Class.new(Numeric) do
437
+ def inspect
438
+ "inspect is called"
439
+ end
440
+
441
+ def to_s
442
+ "to_s is called"
443
+ end
444
+ end
445
+ numeric = numeric_family_class.new
446
+
447
+ message = <<-MESSAGE.chomp
448
+ <to_s is called> expected but was
449
+ <"must be failed">.
450
+ MESSAGE
451
+ check_fail(message) do
452
+ assert_equal(numeric, "must be failed")
453
+ end
454
+ end
455
+ end
456
+ end
457
+
458
+ def test_assert_raise_success
459
+ return_value = nil
460
+ check_nothing_fails(true) do
461
+ return_value = assert_raise(RuntimeError) do
462
+ raise "Error"
463
+ end
464
+ end
465
+ check(return_value.kind_of?(Exception),
466
+ "Should have returned the exception " +
467
+ "from a successful assert_raise")
468
+ check(return_value.message == "Error",
469
+ "Should have returned the correct exception " +
470
+ "from a successful assert_raise")
471
+
472
+ check_nothing_fails(true) do
473
+ assert_raise(ArgumentError, "successful assert_raise") do
474
+ raise ArgumentError.new("Error")
475
+ end
476
+ end
477
+
478
+ check_nothing_fails(true) do
479
+ assert_raise(RuntimeError) do
480
+ raise "Error"
481
+ end
482
+ end
483
+
484
+ check_nothing_fails(true) do
485
+ assert_raise(RuntimeError, "successful assert_raise") do
486
+ raise "Error"
487
+ end
488
+ end
489
+
490
+ check_nothing_fails(true) do
491
+ assert_raise do
492
+ raise Exception, "Any exception"
493
+ end
494
+ end
495
+ end
496
+
497
+ def test_assert_raise_fail
498
+ check_fail("<RuntimeError> exception expected but none was thrown.") do
499
+ assert_raise(RuntimeError) do
500
+ 1 + 1
501
+ end
502
+ end
503
+
504
+ message = <<-EOM.chomp
505
+ failed assert_raise.
506
+ <ArgumentError> exception expected but was
507
+ <RuntimeError(<Error>)>.
508
+ EOM
509
+ check_fail_exception(message) do
510
+ assert_raise(ArgumentError, "failed assert_raise") do
511
+ raise "Error"
512
+ end
513
+ end
514
+
515
+ message = <<-EOM
516
+ Should expect a class of exception, Object.
517
+ <false> is not true.
518
+ EOM
519
+ check_fail(message.chomp) do
520
+ assert_nothing_raised(Object) do
521
+ 1 + 1
522
+ end
523
+ end
524
+ end
525
+
526
+ def test_assert_raise_module
527
+ exceptions = [ArgumentError, TypeError]
528
+ modules = [Math, Comparable]
529
+ rescues = exceptions + modules
530
+
531
+ exceptions.each do |exc|
532
+ return_value = nil
533
+ check_nothing_fails(true) do
534
+ return_value = assert_raise(*rescues) do
535
+ raise exc, "Error"
536
+ end
537
+ end
538
+ check(return_value.instance_of?(exc),
539
+ "Should have returned #{exc} but was #{return_value.class}")
540
+ check(return_value.message == "Error",
541
+ "Should have returned the correct exception " +
542
+ "from a successful assert_raise")
543
+ end
544
+
545
+ modules.each do |mod|
546
+ return_value = nil
547
+ check_nothing_fails(true) do
548
+ return_value = assert_raise(*rescues) do
549
+ raise Exception.new("Error").extend(mod)
550
+ end
551
+ end
552
+ check(mod === return_value,
553
+ "Should have returned #{mod}")
554
+ check(return_value.message == "Error",
555
+ "Should have returned the correct exception " +
556
+ "from a successful assert_raise")
557
+ end
558
+
559
+ check_fail("<[ArgumentError, TypeError, Math, Comparable]> exception " +
560
+ "expected but none was thrown.") do
561
+ assert_raise(*rescues) do
562
+ 1 + 1
563
+ end
564
+ end
565
+
566
+ message = <<-EOM.chomp
567
+ failed assert_raise.
568
+ <[ArgumentError, TypeError]> exception expected but was
569
+ <RuntimeError(<Error>)>.
570
+ EOM
571
+ check_fail_exception(message) do
572
+ assert_raise(ArgumentError, TypeError, "failed assert_raise") do
573
+ raise "Error"
574
+ end
575
+ end
576
+ end
577
+
578
+ def test_assert_raise_instance
579
+ return_value = nil
580
+ check_nothing_fails(true) do
581
+ return_value = assert_raise(RuntimeError.new("Error")) do
582
+ raise "Error"
583
+ end
584
+ end
585
+ check(return_value.kind_of?(Exception),
586
+ "Should have returned the exception " +
587
+ "from a successful assert_raise")
588
+ check(return_value.message == "Error",
589
+ "Should have returned the correct exception " +
590
+ "from a successful assert_raise")
591
+
592
+ message = <<-EOM.chomp
593
+ <RuntimeError(<XXX>)> exception expected but was
594
+ <RuntimeError(<Error>)>.
595
+
596
+ diff:
597
+ - RuntimeError(<XXX>)
598
+ ? ^^^
599
+ + RuntimeError(<Error>)
600
+ ? ^^^^^
601
+ EOM
602
+ check_fail_exception(message) do
603
+ return_value = assert_raise(RuntimeError.new("XXX")) do
604
+ raise "Error"
605
+ end
606
+ end
607
+
608
+ different_error_class = Class.new(StandardError)
609
+ message = <<-EOM.chomp
610
+ <#{different_error_class.inspect}(<Error>)> exception expected but was
611
+ <RuntimeError(<Error>)>.
612
+ EOM
613
+ check_fail_exception(message) do
614
+ assert_raise(different_error_class.new("Error")) do
615
+ raise "Error"
616
+ end
617
+ end
618
+
619
+ different_error = different_error_class.new("Error")
620
+ def different_error.inspect
621
+ "DifferentError: \"Error\""
622
+ end
623
+ message = <<-EOM.chomp
624
+ <DifferentError: "Error"> exception expected but was
625
+ <RuntimeError(<Error>)>.
626
+ EOM
627
+ check_fail_exception(message) do
628
+ assert_raise(different_error) do
629
+ raise "Error"
630
+ end
631
+ end
632
+
633
+ check_nothing_fails(true) do
634
+ assert_raise(different_error_class.new("Error"),
635
+ RuntimeError.new("Error"),
636
+ RuntimeError.new("XXX")) do
637
+ raise "Error"
638
+ end
639
+ end
640
+ end
641
+
642
+ def test_assert_instance_of
643
+ check_nothing_fails {
644
+ assert_instance_of(String, "string")
645
+ }
646
+ check_nothing_fails {
647
+ assert_instance_of(String, "string", "successful assert_instance_of")
648
+ }
649
+ check_nothing_fails {
650
+ assert_instance_of(String, "string", "successful assert_instance_of")
651
+ }
652
+ check_fail(%Q{<"string"> expected to be instance_of?\n<Hash> but was\n<String>.}) {
653
+ assert_instance_of(Hash, "string")
654
+ }
655
+ check_fail(%Q{failed assert_instance_of.\n<"string"> expected to be instance_of?\n<Hash> but was\n<String>.}) {
656
+ assert_instance_of(Hash, "string", "failed assert_instance_of")
657
+ }
658
+
659
+ check_nothing_fails do
660
+ assert_instance_of([Fixnum, NilClass], 100)
661
+ end
662
+ check_fail(%Q{<"string"> expected to be instance_of?\n[<Fixnum>, <NilClass>] but was\n<String>.}) do
663
+ assert_instance_of([Fixnum, NilClass], "string")
664
+ end
665
+ check_fail(%Q{<100> expected to be instance_of?\n[<Numeric>, <NilClass>] but was\n<Fixnum>.}) do
666
+ assert_instance_of([Numeric, NilClass], 100)
667
+ end
668
+ end
669
+
670
+ def test_assert_not_instance_of
671
+ check_nothing_fails {
672
+ assert_not_instance_of(NilClass, "string")
673
+ }
674
+ check_nothing_fails {
675
+ assert_not_instance_of(NilClass, "string", "successful assert_instance_of")
676
+ }
677
+ check_fail(%Q{<"string"> expected to not be instance_of?\n<String> but was.}) {
678
+ assert_not_instance_of(String, "string")
679
+ }
680
+ check_fail(%Q{failed assert.\n<"string"> expected to not be instance_of?\n<String> but was.}) {
681
+ assert_not_instance_of(String, "string", "failed assert")
682
+ }
683
+
684
+ check_nothing_fails do
685
+ assert_not_instance_of([Numeric, NilClass], 100)
686
+ end
687
+ check_fail(%Q{<100> expected to not be instance_of?\n[<Fixnum>, <NilClass>] but was.}) do
688
+ assert_not_instance_of([Fixnum, NilClass], 100)
689
+ end
690
+ check_fail(%Q{<"str"> expected to not be instance_of?\n[<Numeric>, <String>] but was.}) do
691
+ assert_not_instance_of([Numeric, String], 'str')
692
+ end
693
+ end
694
+
695
+ def test_assert_nil
696
+ check_nothing_fails {
697
+ assert_nil(nil)
698
+ }
699
+ check_nothing_fails {
700
+ assert_nil(nil, "successful assert_nil")
701
+ }
702
+ check_nothing_fails {
703
+ assert_nil(nil, "successful assert_nil")
704
+ }
705
+ check_fail(%Q{<"string"> expected to be nil.}) {
706
+ assert_nil("string")
707
+ }
708
+ check_fail(%Q{failed assert_nil.\n<"string"> expected to be nil.}) {
709
+ assert_nil("string", "failed assert_nil")
710
+ }
711
+ end
712
+
713
+ def test_assert_not_nil
714
+ check_nothing_fails{assert_not_nil(false)}
715
+ check_nothing_fails{assert_not_nil(false, "message")}
716
+ check_fail("<nil> expected to not be nil."){assert_not_nil(nil)}
717
+ check_fail("message.\n<nil> expected to not be nil.") {assert_not_nil(nil, "message")}
718
+ end
719
+
720
+ def test_assert_kind_of
721
+ check_nothing_fails {
722
+ assert_kind_of(Module, Array)
723
+ }
724
+ check_nothing_fails {
725
+ assert_kind_of(Object, "string", "successful assert_kind_of")
726
+ }
727
+ check_nothing_fails {
728
+ assert_kind_of(String, "string", "successful assert_kind_of")
729
+ }
730
+ check_nothing_fails {
731
+ assert_kind_of(Comparable, 1)
732
+ }
733
+ check_fail(%Q{<"string"> expected to be kind_of?\n<Class> but was\n<String>.}) {
734
+ assert_kind_of(Class, "string")
735
+ }
736
+ check_fail(%Q{failed assert_kind_of.\n<"string"> expected to be kind_of?\n<Class> but was\n<String>.}) {
737
+ assert_kind_of(Class, "string", "failed assert_kind_of")
738
+ }
739
+
740
+ check_nothing_fails do
741
+ assert_kind_of([Fixnum, NilClass], 100)
742
+ end
743
+ check_fail(%Q{<"string"> expected to be kind_of?\n[<Fixnum>, <NilClass>] but was\n<String>.}) do
744
+ assert_kind_of([Fixnum, NilClass], "string")
745
+ end
746
+ end
747
+
748
+ def test_assert_not_kind_of
749
+ check_nothing_fails {
750
+ assert_not_kind_of(Class, 42)
751
+ }
752
+ check_nothing_fails {
753
+ assert_not_kind_of(Symbol, "string", "successful assert_not_kind_of")
754
+ }
755
+ check_nothing_fails {
756
+ assert_not_kind_of(Integer, 1.1)
757
+ }
758
+ check_fail(%Q{<1> expected to not be kind_of?\n<Integer> but was.}) {
759
+ assert_not_kind_of(Integer, 1)
760
+ }
761
+ check_fail(%Q{failed assert_not_kind_of.\n<"string"> expected to not be kind_of?\n<String> but was.}) {
762
+ assert_not_kind_of(String, "string", "failed assert_not_kind_of")
763
+ }
764
+
765
+ check_nothing_fails do
766
+ assert_not_kind_of([String, NilClass], 100)
767
+ end
768
+ check_fail(%Q{<100> expected to not be kind_of?\n[<Fixnum>, <NilClass>] but was.}) do
769
+ assert_not_kind_of([Fixnum, NilClass], 100)
770
+ end
771
+ end
772
+
773
+ def test_assert_match
774
+ check_nothing_fails {
775
+ assert_match(/strin./, "string")
776
+ }
777
+ check_nothing_fails {
778
+ assert_match("strin", "string")
779
+ }
780
+ check_nothing_fails {
781
+ assert_match(/strin./, "string", "successful assert_match")
782
+ }
783
+ check_nothing_fails {
784
+ assert_match(/strin./, "string", "successful assert_match")
785
+ }
786
+ check_fail(%Q{</slin./> expected to be =~\n<"string">.}) {
787
+ assert_match(/slin./, "string")
788
+ }
789
+ check_fail(%Q{</strin\\./> expected to be =~\n<"string">.}) {
790
+ assert_match("strin.", "string")
791
+ }
792
+ check_fail(%Q{failed assert_match.\n</slin./> expected to be =~\n<"string">.}) {
793
+ assert_match(/slin./, "string", "failed assert_match")
794
+ }
795
+ end
796
+
797
+ def test_assert_same
798
+ thing = "thing"
799
+ check_nothing_fails {
800
+ assert_same(thing, thing)
801
+ }
802
+ check_nothing_fails {
803
+ assert_same(thing, thing, "successful assert_same")
804
+ }
805
+ check_nothing_fails {
806
+ assert_same(thing, thing, "successful assert_same")
807
+ }
808
+ thing2 = "thing"
809
+ check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
810
+ assert_same(thing, thing2)
811
+ }
812
+ check_fail(%Q{failed assert_same.\n<"thing">\nwith id <#{thing.__id__}> expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
813
+ assert_same(thing, thing2, "failed assert_same")
814
+ }
815
+ end
816
+
817
+ def test_assert_nothing_raised
818
+ check_nothing_fails(:dont_care) {
819
+ assert_nothing_raised {
820
+ 1 + 1
821
+ }
822
+ }
823
+ check_nothing_fails(:dont_care) {
824
+ assert_nothing_raised("successful assert_nothing_raised") {
825
+ 1 + 1
826
+ }
827
+ }
828
+ check_nothing_fails(:dont_care) {
829
+ assert_nothing_raised("successful assert_nothing_raised") {
830
+ 1 + 1
831
+ }
832
+ }
833
+ check_nothing_fails(:dont_care) {
834
+ begin
835
+ assert_nothing_raised(RuntimeError, StandardError, Comparable, "successful assert_nothing_raised") {
836
+ raise ZeroDivisionError.new("ArgumentError")
837
+ }
838
+ rescue ZeroDivisionError
839
+ end
840
+ }
841
+ check_fail("Should expect a class of exception, Object.\n<false> is not true.") {
842
+ assert_nothing_raised(Object) {
843
+ 1 + 1
844
+ }
845
+ }
846
+ expected_message = <<-EOM.chomp
847
+ Exception raised:
848
+ RuntimeError(<Error>)
849
+ EOM
850
+ check_fail_exception(expected_message) {
851
+ assert_nothing_raised {
852
+ raise "Error"
853
+ }
854
+ }
855
+ expected_message = <<-EOM.chomp
856
+ failed assert_nothing_raised.
857
+ Exception raised:
858
+ RuntimeError(<Error>)
859
+ EOM
860
+ check_fail_exception(expected_message) {
861
+ assert_nothing_raised("failed assert_nothing_raised") {
862
+ raise "Error"
863
+ }
864
+ }
865
+ expected_message = <<-EOM.chomp
866
+ Exception raised:
867
+ RuntimeError(<Error>)
868
+ EOM
869
+ check_fail_exception(expected_message) {
870
+ assert_nothing_raised(StandardError, RuntimeError) {
871
+ raise "Error"
872
+ }
873
+ }
874
+ check_fail("Failure.") do
875
+ assert_nothing_raised do
876
+ flunk("Failure")
877
+ end
878
+ end
879
+ end
880
+
881
+ def test_flunk
882
+ check_fail("Flunked.") {
883
+ flunk
884
+ }
885
+ check_fail("flunk message.") {
886
+ flunk("flunk message")
887
+ }
888
+ end
889
+
890
+ def test_assert_not_same
891
+ thing = "thing"
892
+ thing2 = "thing"
893
+ check_nothing_fails {
894
+ assert_not_same(thing, thing2)
895
+ }
896
+ check_nothing_fails {
897
+ assert_not_same(thing, thing2, "message")
898
+ }
899
+ check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) {
900
+ assert_not_same(thing, thing)
901
+ }
902
+ check_fail(%Q{message.\n<"thing">\nwith id <#{thing.__id__}> expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) {
903
+ assert_not_same(thing, thing, "message")
904
+ }
905
+ end
906
+
907
+ def test_assert_not_equal
908
+ check_nothing_fails {
909
+ assert_not_equal("string1", "string2")
910
+ }
911
+ check_nothing_fails {
912
+ assert_not_equal("string1", "string2", "message")
913
+ }
914
+ check_fail(%Q{<"string"> expected to be != to\n<"string">.}) {
915
+ assert_not_equal("string", "string")
916
+ }
917
+ check_fail(%Q{message.\n<"string"> expected to be != to\n<"string">.}) {
918
+ assert_not_equal("string", "string", "message")
919
+ }
920
+ end
921
+
922
+ def test_assert_not_match_pass
923
+ check_nothing_fails do
924
+ assert_not_match(/sling/, "string")
925
+ end
926
+ end
927
+
928
+ def test_assert_not_match_pass_with_message
929
+ check_nothing_fails do
930
+ assert_not_match(/sling/, "string", "message")
931
+ end
932
+ end
933
+
934
+ def test_assert_not_match_fail_not_regexp
935
+ check_fail("<REGEXP> in assert_not_match(<REGEXP>, ...) " +
936
+ "should be a Regexp.\n" +
937
+ "<\"asdf\"> expected to be instance_of?\n" +
938
+ "<Regexp> but was\n" +
939
+ "<String>.") do
940
+ assert_not_match("asdf", "asdf")
941
+ end
942
+ end
943
+
944
+ def test_assert_not_match_fail_match
945
+ check_fail("</string/> expected to not match\n" +
946
+ "<\"string\">.") do
947
+ assert_not_match(/string/, "string")
948
+ end
949
+ end
950
+
951
+ def test_assert_not_match_fail_match_with_message
952
+ check_fail("message.\n" +
953
+ "</string/> expected to not match\n" +
954
+ "<\"string\">.") do
955
+ assert_not_match(/string/, "string", "message")
956
+ end
957
+ end
958
+
959
+ def test_assert_no_match
960
+ check_nothing_fails{assert_no_match(/sling/, "string")}
961
+ check_nothing_fails{assert_no_match(/sling/, "string", "message")}
962
+ check_fail(%Q{The first argument to assert_no_match should be a Regexp.\n<"asdf"> expected to be instance_of?\n<Regexp> but was\n<String>.}) do
963
+ assert_no_match("asdf", "asdf")
964
+ end
965
+ check_fail(%Q{</string/> expected to not match\n<"string">.}) do
966
+ assert_no_match(/string/, "string")
967
+ end
968
+ check_fail(%Q{message.\n</string/> expected to not match\n<"string">.}) do
969
+ assert_no_match(/string/, "string", "message")
970
+ end
971
+ end
972
+
973
+ def test_assert_throw
974
+ check_nothing_fails do
975
+ assert_throw(:thing, "message") do
976
+ throw :thing
977
+ end
978
+ end
979
+
980
+ tag = :thing2
981
+ check_fail("message.\n" +
982
+ "<:thing> expected to be thrown but\n" +
983
+ "<#{inspect_tag(tag)}> was thrown.") do
984
+ assert_throw(:thing, "message") do
985
+ throw :thing2
986
+ end
987
+ end
988
+ check_fail("message.\n" +
989
+ "<:thing> should have been thrown.") do
990
+ assert_throw(:thing, "message") do
991
+ 1 + 1
992
+ end
993
+ end
994
+ end
995
+
996
+ def test_assert_nothing_thrown
997
+ check_nothing_fails do
998
+ assert_nothing_thrown("message") do
999
+ 1 + 1
1000
+ end
1001
+ end
1002
+
1003
+ tag = :thing
1004
+ inspected = inspect_tag(tag)
1005
+ check_fail("message.\n" +
1006
+ "<#{inspected}> was thrown when nothing was expected.") do
1007
+ assert_nothing_thrown("message") do
1008
+ throw tag
1009
+ end
1010
+ end
1011
+ end
1012
+
1013
+ def test_assert_operator
1014
+ check_nothing_fails {
1015
+ assert_operator("thing", :==, "thing", "message")
1016
+ }
1017
+ check_fail(%Q{<0.15>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to?(:to_str).}) do
1018
+ assert_operator("thing", 0.15, "thing")
1019
+ end
1020
+ check_fail(%Q{message.\n<"thing1"> expected to be\n==\n<"thing2">.}) {
1021
+ assert_operator("thing1", :==, "thing2", "message")
1022
+ }
1023
+ end
1024
+
1025
+ def test_assert_not_operator
1026
+ check_nothing_fails {
1027
+ assert_not_operator("thing", :==, "Thing", "message")
1028
+ }
1029
+ check_fail(%Q{<42>\ngiven as the operator for #assert_not_operator must be a Symbol or #respond_to?(:to_str).}) do
1030
+ assert_not_operator("thing", 42, "message")
1031
+ end
1032
+ check_fail(%Q{message.\n<0> expected to not be\n==\n<0.0>.}) {
1033
+ assert_not_operator(0, :==, 0.0, "message")
1034
+ }
1035
+ end
1036
+
1037
+ def test_assert_respond_to
1038
+ check_nothing_fails {
1039
+ assert_respond_to("thing", :to_s, "message")
1040
+ }
1041
+ check_nothing_fails {
1042
+ assert_respond_to("thing", "to_s", "message")
1043
+ }
1044
+ check_fail("<0.15>.kind_of?(Symbol) or\n" +
1045
+ "<0.15>.respond_to?(:to_str) expected") {
1046
+ assert_respond_to("thing", 0.15)
1047
+ }
1048
+ check_fail("message.\n" +
1049
+ "<:symbol>.respond_to?(:nonexistence) expected\n" +
1050
+ "(Class: <Symbol>)") {
1051
+ assert_respond_to(:symbol, :nonexistence, "message")
1052
+ }
1053
+ end
1054
+
1055
+ def test_assert_not_respond_to_pass_symbol
1056
+ check_nothing_fails do
1057
+ assert_not_respond_to("thing", :nonexistent, "message")
1058
+ end
1059
+ end
1060
+
1061
+ def test_assert_not_respond_to_pass_string
1062
+ check_nothing_fails do
1063
+ assert_not_respond_to("thing", :nonexistent, "message")
1064
+ end
1065
+ end
1066
+
1067
+ def test_assert_not_respond_to_fail_number
1068
+ check_fail("<0.15>.kind_of?(Symbol) or\n" +
1069
+ "<0.15>.respond_to?(:to_str) expected") do
1070
+ assert_respond_to("thing", 0.15)
1071
+ end
1072
+ end
1073
+
1074
+ def tset_assert_not_respond_to_fail_existence
1075
+ check_fail("message.\n" +
1076
+ "!<:symbol>.respond_to?(:to_s) expected\n" +
1077
+ "(Class: <Symbol>)") do
1078
+ assert_respond_to(:symbol, :to_s, "message")
1079
+ end
1080
+ end
1081
+
1082
+ def test_assert_send
1083
+ object = Object.new
1084
+ class << object
1085
+ private
1086
+ def return_argument(argument, bogus)
1087
+ return argument
1088
+ end
1089
+ end
1090
+ check_nothing_fails do
1091
+ assert_send([object, :return_argument, true, "bogus"], "message")
1092
+ end
1093
+
1094
+ inspected_object = AssertionMessage.convert(object)
1095
+ expected_message = <<-EOM
1096
+ message.
1097
+ <#{inspected_object}> expected to respond to
1098
+ <return_argument(*[false, "bogus"])> with a true value but was
1099
+ <false>.
1100
+ EOM
1101
+ check_fail(expected_message.chomp) do
1102
+ assert_send([object, :return_argument, false, "bogus"], "message")
1103
+ end
1104
+ end
1105
+
1106
+ def test_condition_invariant
1107
+ object = Object.new
1108
+ def object.inspect
1109
+ @changed = true
1110
+ end
1111
+ def object.==(other)
1112
+ @changed ||= false
1113
+ return (!@changed)
1114
+ end
1115
+ check_nothing_fails do
1116
+ assert_equal(object, object, "message")
1117
+ end
1118
+ end
1119
+
1120
+ def test_assert_boolean
1121
+ check_nothing_fails do
1122
+ assert_boolean(true)
1123
+ end
1124
+ check_nothing_fails do
1125
+ assert_boolean(false)
1126
+ end
1127
+
1128
+ check_fail("<true> or <false> expected but was\n<1>") do
1129
+ assert_boolean(1)
1130
+ end
1131
+
1132
+ check_fail("<true> or <false> expected but was\n<nil>") do
1133
+ assert_boolean(nil)
1134
+ end
1135
+
1136
+ check_fail("message.\n<true> or <false> expected but was\n<\"XXX\">") do
1137
+ assert_boolean("XXX", "message")
1138
+ end
1139
+ end
1140
+
1141
+ def test_assert_true
1142
+ check_nothing_fails do
1143
+ assert_true(true)
1144
+ end
1145
+
1146
+ check_fail("<true> expected but was\n<false>") do
1147
+ assert_true(false)
1148
+ end
1149
+
1150
+ check_fail("<true> expected but was\n<1>") do
1151
+ assert_true(1)
1152
+ end
1153
+
1154
+ check_fail("message.\n<true> expected but was\n<nil>") do
1155
+ assert_true(nil, "message")
1156
+ end
1157
+ end
1158
+
1159
+ def test_assert_false
1160
+ check_nothing_fails do
1161
+ assert_false(false)
1162
+ end
1163
+
1164
+ check_fail("<false> expected but was\n<true>") do
1165
+ assert_false(true)
1166
+ end
1167
+
1168
+ check_fail("<false> expected but was\n<nil>") do
1169
+ assert_false(nil)
1170
+ end
1171
+
1172
+ check_fail("message.\n<false> expected but was\n<:false>") do
1173
+ assert_false(:false, "message")
1174
+ end
1175
+ end
1176
+
1177
+ def test_assert_compare
1178
+ check_nothing_fails do
1179
+ assert_compare(1.4, "<", 10.0)
1180
+ end
1181
+
1182
+ check_nothing_fails do
1183
+ assert_compare(2, "<=", 2)
1184
+ end
1185
+
1186
+ check_nothing_fails do
1187
+ assert_compare(14, ">=", 10.0)
1188
+ end
1189
+
1190
+ check_nothing_fails do
1191
+ assert_compare(14, ">", 13.9)
1192
+ end
1193
+
1194
+ expected_message = <<-EOM
1195
+ <15> < <10> should be true
1196
+ <15> expected less than
1197
+ <10>.
1198
+ EOM
1199
+ check_fail(expected_message.chomp) do
1200
+ assert_compare(15, "<", 10)
1201
+ end
1202
+
1203
+ expected_message = <<-EOM
1204
+ <15> <= <10> should be true
1205
+ <15> expected less than or equal to
1206
+ <10>.
1207
+ EOM
1208
+ check_fail(expected_message.chomp) do
1209
+ assert_compare(15, "<=", 10)
1210
+ end
1211
+
1212
+ expected_message = <<-EOM
1213
+ <10> > <15> should be true
1214
+ <10> expected greater than
1215
+ <15>.
1216
+ EOM
1217
+ check_fail(expected_message.chomp) do
1218
+ assert_compare(10, ">", 15)
1219
+ end
1220
+
1221
+ expected_message = <<-EOM
1222
+ <10> >= <15> should be true
1223
+ <10> expected greater than or equal to
1224
+ <15>.
1225
+ EOM
1226
+ check_fail(expected_message.chomp) do
1227
+ assert_compare(10, ">=", 15)
1228
+ end
1229
+ end
1230
+
1231
+ def test_assert_fail_assertion
1232
+ check_nothing_fails do
1233
+ assert_fail_assertion do
1234
+ flunk
1235
+ end
1236
+ end
1237
+
1238
+ check_fail("Failed assertion was expected.") do
1239
+ assert_fail_assertion do
1240
+ end
1241
+ end
1242
+ end
1243
+
1244
+ def test_assert_raise_message
1245
+ check_nothing_fails do
1246
+ assert_raise_message("Raise!") do
1247
+ raise "Raise!"
1248
+ end
1249
+ end
1250
+
1251
+ check_nothing_fails do
1252
+ assert_raise_message("Raise!") do
1253
+ raise Exception, "Raise!"
1254
+ end
1255
+ end
1256
+
1257
+ check_nothing_fails do
1258
+ assert_raise_message(/raise/i) do
1259
+ raise "Raise!"
1260
+ end
1261
+ end
1262
+
1263
+ expected_message = <<-EOM
1264
+ <"Expected message"> exception message expected but was
1265
+ <"Actual message">.
1266
+ EOM
1267
+ check_fail(expected_message.chomp) do
1268
+ assert_raise_message("Expected message") do
1269
+ raise "Actual message"
1270
+ end
1271
+ end
1272
+
1273
+ expected_message = <<-EOM
1274
+ <"Expected message"> exception message expected but none was thrown.
1275
+ EOM
1276
+ check_fail(expected_message.chomp) do
1277
+ assert_raise_message("Expected message") do
1278
+ end
1279
+ end
1280
+ end
1281
+
1282
+ def test_assert_raise_kind_of
1283
+ check_nothing_fails(true) do
1284
+ assert_raise_kind_of(SystemCallError) do
1285
+ raise Errno::EACCES
1286
+ end
1287
+ end
1288
+
1289
+ expected_message = <<-EOM.chomp
1290
+ <SystemCallError> family exception expected but was
1291
+ <RuntimeError(<XXX>)>.
1292
+ EOM
1293
+ check_fail_exception(expected_message) do
1294
+ assert_raise_kind_of(SystemCallError) do
1295
+ raise RuntimeError, "XXX"
1296
+ end
1297
+ end
1298
+ end
1299
+
1300
+ def test_assert_const_defined
1301
+ check_nothing_fails do
1302
+ assert_const_defined(Test, :Unit)
1303
+ end
1304
+
1305
+ check_nothing_fails do
1306
+ assert_const_defined(Test, "Unit")
1307
+ end
1308
+
1309
+ check_fail("<Test>.const_defined?(<:Nonexistence>) expected.") do
1310
+ assert_const_defined(Test, :Nonexistence)
1311
+ end
1312
+ end
1313
+
1314
+ def test_assert_not_const_defined
1315
+ check_nothing_fails do
1316
+ assert_not_const_defined(Test, :Nonexistence)
1317
+ end
1318
+
1319
+ check_fail("!<Test>.const_defined?(<:Unit>) expected.") do
1320
+ assert_not_const_defined(Test, :Unit)
1321
+ end
1322
+
1323
+ check_fail("!<Test>.const_defined?(<\"Unit\">) expected.") do
1324
+ assert_not_const_defined(Test, "Unit")
1325
+ end
1326
+ end
1327
+
1328
+ def test_assert_predicate
1329
+ check_nothing_fails do
1330
+ assert_predicate([], :empty?)
1331
+ end
1332
+
1333
+ check_fail("<[1]>.empty? is true value expected but was\n<false>") do
1334
+ assert_predicate([1], :empty?)
1335
+ end
1336
+
1337
+ check_fail("<[1]>.respond_to?(:nonexistent?) expected\n" +
1338
+ "(Class: <Array>)") do
1339
+ assert_predicate([1], :nonexistent?)
1340
+ end
1341
+ end
1342
+
1343
+ def test_assert_not_predicate
1344
+ check_nothing_fails do
1345
+ assert_not_predicate([1], :empty?)
1346
+ end
1347
+
1348
+ check_fail("<[]>.empty? is false value expected but was\n<true>") do
1349
+ assert_not_predicate([], :empty?)
1350
+ end
1351
+
1352
+ check_fail("<[]>.respond_to?(:nonexistent?) expected\n" +
1353
+ "(Class: <Array>)") do
1354
+ assert_not_predicate([], :nonexistent?)
1355
+ end
1356
+ end
1357
+
1358
+ def test_assert_alias_method
1359
+ object = Object.new
1360
+ class << object
1361
+ def original_method
1362
+ end
1363
+ alias_method :alias_method, :original_method
1364
+
1365
+ def other
1366
+ end
1367
+ end
1368
+
1369
+ check_nothing_fails do
1370
+ assert_alias_method(object, :alias_method, :original_method)
1371
+ end
1372
+
1373
+ check_nothing_fails do
1374
+ assert_alias_method(object, :original_method, :alias_method)
1375
+ end
1376
+
1377
+ check_fail("<#{object.method(:other).inspect}> is alias of\n" +
1378
+ "<#{object.method(:original_method).inspect}> expected") do
1379
+ assert_alias_method(object, :other, :original_method)
1380
+ end
1381
+
1382
+ inspected_object = AssertionMessage.convert(object)
1383
+ check_fail("<#{inspected_object}>.nonexistent doesn't exist\n" +
1384
+ "(Class: <Object>)") do
1385
+ assert_alias_method(object, :nonexistent, :original_method)
1386
+ end
1387
+
1388
+ check_fail("<#{inspected_object}>.nonexistent doesn't exist\n" +
1389
+ "(Class: <Object>)") do
1390
+ assert_alias_method(object, :alias_method, :nonexistent)
1391
+ end
1392
+ end
1393
+
1394
+ def test_assert_path_exist
1395
+ check_nothing_fails do
1396
+ assert_path_exist(__FILE__)
1397
+ end
1398
+
1399
+ nonexistent_file = __FILE__ + ".nonexistent"
1400
+ check_fail("<#{nonexistent_file.inspect}> expected to exist") do
1401
+ assert_path_exist(nonexistent_file)
1402
+ end
1403
+ end
1404
+
1405
+ def test_assert_path_not_exist
1406
+ nonexistent_file = __FILE__ + ".nonexistent"
1407
+ check_nothing_fails do
1408
+ assert_path_not_exist(nonexistent_file)
1409
+ end
1410
+
1411
+ check_fail("<#{__FILE__.inspect}> expected to not exist") do
1412
+ assert_path_not_exist(__FILE__)
1413
+ end
1414
+ end
1415
+ end
1416
+
1417
+ class TestAssert < TestCase
1418
+ include AssertionCheckable
1419
+
1420
+ def test_pass
1421
+ check_nothing_fails do
1422
+ assert(true)
1423
+ end
1424
+ end
1425
+
1426
+ def test_pass_neither_false_or_nil
1427
+ check_nothing_fails do
1428
+ assert("a")
1429
+ end
1430
+ end
1431
+
1432
+ def test_pass_with_message
1433
+ check_nothing_fails do
1434
+ assert(true, "successful assert")
1435
+ end
1436
+ end
1437
+
1438
+ def test_pass_block
1439
+ check_nothing_fails do
1440
+ assert do
1441
+ true
1442
+ end
1443
+ end
1444
+ end
1445
+
1446
+ def test_fail_nil
1447
+ check_fail("<nil> is not true.") do
1448
+ assert(nil)
1449
+ end
1450
+ end
1451
+
1452
+ def test_fail_false
1453
+ check_fail("<false> is not true.") do
1454
+ assert(false)
1455
+ end
1456
+ end
1457
+
1458
+ def test_fail_false_with_message
1459
+ check_fail("failed assert.\n" +
1460
+ "<false> is not true.") do
1461
+ assert(false, "failed assert")
1462
+ end
1463
+ end
1464
+
1465
+ def test_fail_with_assertion_message
1466
+ check_fail("user message.\n" +
1467
+ "placeholder <:in> message") do
1468
+ assert(false, build_message("user message",
1469
+ "placeholder <?> message",
1470
+ :in))
1471
+ end
1472
+ end
1473
+
1474
+ def test_fail_block
1475
+ check_fail(//) do
1476
+ assert do
1477
+ 0.odd?
1478
+ end
1479
+ end
1480
+ end
1481
+
1482
+ def test_error_invalid_message_true
1483
+ check_fail("assertion message must be String, Proc or " +
1484
+ "Test::Unit::Assertions::AssertionMessage: " +
1485
+ "<true>(<TrueClass>)") do
1486
+ begin
1487
+ assert(true, true)
1488
+ rescue ArgumentError
1489
+ raise AssertionFailedError, $!.message
1490
+ end
1491
+ end
1492
+ end
1493
+
1494
+ def test_error_wrong_number_of_arguments
1495
+ check_fail("wrong number of arguments (0 for 1..2)") do
1496
+ begin
1497
+ assert
1498
+ rescue ArgumentError
1499
+ raise AssertionFailedError, $!.message
1500
+ end
1501
+ end
1502
+ end
1503
+
1504
+ class TestBlock < self
1505
+ def test_with_message
1506
+ if defined?(PowerAssert)
1507
+ system_message = <<-MESSAGE
1508
+ 1 == 2
1509
+ MESSAGE
1510
+ else
1511
+ system_message = "<false> is not true."
1512
+ end
1513
+ check_fail("user message.\n#{system_message}") do
1514
+ assert("user message") do
1515
+ 1 == 2
1516
+ end
1517
+ end
1518
+ end
1519
+ end
1520
+ end
1521
+
1522
+ class TestRefute < TestCase
1523
+ include AssertionCheckable
1524
+
1525
+ class TestPass < self
1526
+ def test_nil
1527
+ check_nothing_fails do
1528
+ refute(nil)
1529
+ end
1530
+ end
1531
+
1532
+ def test_false
1533
+ check_nothing_fails do
1534
+ refute(false)
1535
+ end
1536
+ end
1537
+
1538
+ def test_with_message
1539
+ check_nothing_fails do
1540
+ refute(nil, "successful refute")
1541
+ end
1542
+ end
1543
+ end
1544
+
1545
+ class TestFailure < self
1546
+ def test_true
1547
+ check_fail("<true> is neither nil or false.") do
1548
+ refute(true)
1549
+ end
1550
+ end
1551
+
1552
+ def test_with_message
1553
+ check_fail("failed refute.\n" +
1554
+ "<true> is neither nil or false.") do
1555
+ refute(true, "failed refute")
1556
+ end
1557
+ end
1558
+
1559
+ def test_fail_with_assertion_message
1560
+ check_fail("user message.\n" +
1561
+ "placeholder <:in> message") do
1562
+ refute(true, build_message("user message",
1563
+ "placeholder <?> message",
1564
+ :in))
1565
+ end
1566
+ end
1567
+
1568
+ def test_error_invalid_message_true
1569
+ check_fail("assertion message must be String, Proc or " +
1570
+ "Test::Unit::Assertions::AssertionMessage: " +
1571
+ "<false>(<FalseClass>)") do
1572
+ begin
1573
+ refute(true, false)
1574
+ rescue ArgumentError
1575
+ raise AssertionFailedError, $!.message
1576
+ end
1577
+ end
1578
+ end
1579
+ end
1580
+ end
1581
+
1582
+ class TestAssertInDelta < TestCase
1583
+ include AssertionCheckable
1584
+
1585
+ def test_pass
1586
+ check_nothing_fails do
1587
+ assert_in_delta(1.4, 1.4, 0)
1588
+ end
1589
+ end
1590
+
1591
+ def test_pass_without_delta
1592
+ check_nothing_fails do
1593
+ assert_in_delta(1.401, 1.402)
1594
+ end
1595
+ end
1596
+
1597
+ def test_pass_with_message
1598
+ check_nothing_fails do
1599
+ assert_in_delta(0.5, 0.4, 0.1, "message")
1600
+ end
1601
+ end
1602
+
1603
+ def test_pass_float_like_object
1604
+ check_nothing_fails do
1605
+ float_thing = Object.new
1606
+ def float_thing.to_f
1607
+ 0.2
1608
+ end
1609
+ assert_in_delta(0.1, float_thing, 0.1)
1610
+ end
1611
+ end
1612
+
1613
+ def test_pass_string_expected
1614
+ check_nothing_fails do
1615
+ assert_in_delta("0.5", 0.4, 0.1)
1616
+ end
1617
+ end
1618
+
1619
+ def test_fail_with_message
1620
+ check_fail("message.\n" +
1621
+ "<0.5> -/+ <0.05> expected to include\n" +
1622
+ "<0.4>.\n" +
1623
+ "\n" +
1624
+ "Relation:\n" +
1625
+ "<<0.4> < <0.5>-<0.05>[0.45] <= <0.5>+<0.05>[0.55]>") do
1626
+ assert_in_delta(0.5, 0.4, 0.05, "message")
1627
+ end
1628
+ end
1629
+
1630
+ def test_fail_because_not_float_like_object
1631
+ object = Object.new
1632
+ inspected_object = AssertionMessage.convert(object)
1633
+ check_fail("The arguments must respond to to_f; " +
1634
+ "the first float did not.\n" +
1635
+ "<#{inspected_object}>.respond_to?(:to_f) expected\n" +
1636
+ "(Class: <Object>)") do
1637
+ assert_in_delta(object, 0.4, 0.1)
1638
+ end
1639
+ end
1640
+
1641
+ def test_fail_because_negaitve_delta
1642
+ check_fail("The delta should not be negative.\n" +
1643
+ "<-0.1> expected to be\n>=\n<0.0>.") do
1644
+ assert_in_delta(0.5, 0.4, -0.1, "message")
1645
+ end
1646
+ end
1647
+
1648
+ def test_fail_without_delta
1649
+ check_fail("<1.402> -/+ <0.001> expected to include\n" +
1650
+ "<1.404>.\n" +
1651
+ "\n" +
1652
+ "Relation:\n" +
1653
+ "<" +
1654
+ "<1.402>-<0.001>[#{1.402 - 0.001}] <= " +
1655
+ "<1.402>+<0.001>[#{1.402 + 0.001}] < " +
1656
+ "<1.404>" +
1657
+ ">") do
1658
+ assert_in_delta(1.402, 1.404)
1659
+ end
1660
+ end
1661
+ end
1662
+
1663
+ class TestAssertNotInDelta < Test::Unit::TestCase
1664
+ include AssertionCheckable
1665
+
1666
+ def test_pass
1667
+ check_nothing_fails do
1668
+ assert_not_in_delta(1.42, 1.44, 0.01)
1669
+ end
1670
+ end
1671
+
1672
+ def test_pass_without_delta
1673
+ check_nothing_fails do
1674
+ assert_not_in_delta(1.402, 1.404)
1675
+ end
1676
+ end
1677
+
1678
+ def test_pass_with_message
1679
+ check_nothing_fails do
1680
+ assert_not_in_delta(0.5, 0.4, 0.09, "message")
1681
+ end
1682
+ end
1683
+
1684
+ def test_pass_float_like_object
1685
+ check_nothing_fails do
1686
+ float_thing = Object.new
1687
+ def float_thing.to_f
1688
+ 0.2
1689
+ end
1690
+ assert_not_in_delta(0.1, float_thing, 0.09)
1691
+ end
1692
+ end
1693
+
1694
+ def test_pass_string_epxected
1695
+ check_nothing_fails do
1696
+ assert_not_in_delta("0.5", 0.4, 0.09)
1697
+ end
1698
+ end
1699
+
1700
+ def test_fail
1701
+ check_fail("<1.4> -/+ <0.11> expected to not include\n" +
1702
+ "<1.5>.\n" +
1703
+ "\n" +
1704
+ "Relation:\n" +
1705
+ "<" +
1706
+ "<1.4>-<0.11>[#{1.4 - 0.11}] <= " +
1707
+ "<1.5> <= " +
1708
+ "<1.4>+<0.11>[#{1.4 + 0.11}]" +
1709
+ ">") do
1710
+ assert_not_in_delta(1.4, 1.5, 0.11)
1711
+ end
1712
+ end
1713
+
1714
+ def test_fail_without_delta
1715
+ check_fail("<1.402> -/+ <0.001> expected to not include\n" +
1716
+ "<1.4021>.\n" +
1717
+ "\n" +
1718
+ "Relation:\n" +
1719
+ "<" +
1720
+ "<1.402>-<0.001>[#{1.402 - 0.001}] <= " +
1721
+ "<1.4021> <= " +
1722
+ "<1.402>+<0.001>[#{1.402 + 0.001}]" +
1723
+ ">") do
1724
+ assert_not_in_delta(1.402, 1.4021)
1725
+ end
1726
+ end
1727
+
1728
+ def test_fail_with_message
1729
+ check_fail("message.\n" +
1730
+ "<0.5> -/+ <0.11> expected to not include\n" +
1731
+ "<0.4>.\n" +
1732
+ "\n" +
1733
+ "Relation:\n" +
1734
+ "<" +
1735
+ "<0.5>-<0.11>[0.39] <= " +
1736
+ "<0.4> <= " +
1737
+ "<0.5>+<0.11>[0.61]" +
1738
+ ">") do
1739
+ assert_not_in_delta(0.5, 0.4, 0.11, "message")
1740
+ end
1741
+ end
1742
+
1743
+ def test_fail_because_not_float_like_object
1744
+ object = Object.new
1745
+ inspected_object = AssertionMessage.convert(object)
1746
+ check_fail("The arguments must respond to to_f; " +
1747
+ "the first float did not.\n" +
1748
+ "<#{inspected_object}>.respond_to?(:to_f) expected\n" +
1749
+ "(Class: <Object>)") do
1750
+ assert_not_in_delta(object, 0.4, 0.1)
1751
+ end
1752
+ end
1753
+
1754
+ def test_fail_because_negaitve_delta
1755
+ check_fail("The delta should not be negative.\n" +
1756
+ "<-0.11> expected to be\n>=\n<0.0>.") do
1757
+ assert_not_in_delta(0.5, 0.4, -0.11, "message")
1758
+ end
1759
+ end
1760
+ end
1761
+
1762
+ class TestAssertInEpsilon < TestCase
1763
+ include AssertionCheckable
1764
+
1765
+ def test_pass
1766
+ check_nothing_fails do
1767
+ assert_in_epsilon(10000, 9000, 0.1)
1768
+ end
1769
+ end
1770
+
1771
+ def test_pass_without_epsilon
1772
+ check_nothing_fails do
1773
+ assert_in_epsilon(10000, 9991)
1774
+ end
1775
+ end
1776
+
1777
+ def test_pass_with_message
1778
+ check_nothing_fails do
1779
+ assert_in_epsilon(10000, 9000, 0.1, "message")
1780
+ end
1781
+ end
1782
+
1783
+ def test_pass_float_like_object
1784
+ check_nothing_fails do
1785
+ float_thing = Object.new
1786
+ def float_thing.to_f
1787
+ 9000.0
1788
+ end
1789
+ assert_in_epsilon(10000, float_thing, 0.1)
1790
+ end
1791
+ end
1792
+
1793
+ def test_pass_string_expected
1794
+ check_nothing_fails do
1795
+ assert_in_epsilon("10000", 9000, 0.1)
1796
+ end
1797
+ end
1798
+
1799
+ def test_pass_zero_expected
1800
+ check_nothing_fails do
1801
+ assert_in_epsilon(0, 0.00000001)
1802
+ end
1803
+ end
1804
+
1805
+ def test_pass_minus_expected
1806
+ check_nothing_fails do
1807
+ assert_in_epsilon(-1, -1)
1808
+ end
1809
+ end
1810
+
1811
+ def test_fail_with_message
1812
+ check_fail("message.\n" +
1813
+ "<10000> -/+ (<10000> * <0.1>)[1000.0] " +
1814
+ "expected to include\n" +
1815
+ "<8999>.\n" +
1816
+ "\n" +
1817
+ "Relation:\n" +
1818
+ "<" +
1819
+ "<8999> < " +
1820
+ "<10000>-(<10000>*<0.1>)[9000.0] <= " +
1821
+ "<10000>+(<10000>*<0.1>)[11000.0]" +
1822
+ ">") do
1823
+ assert_in_epsilon(10000, 8999, 0.1, "message")
1824
+ end
1825
+ end
1826
+
1827
+ def test_fail_because_not_float_like_object
1828
+ object = Object.new
1829
+ inspected_object = AssertionMessage.convert(object)
1830
+ check_fail("The arguments must respond to to_f; " +
1831
+ "the first float did not.\n" +
1832
+ "<#{inspected_object}>.respond_to?(:to_f) expected\n" +
1833
+ "(Class: <Object>)") do
1834
+ assert_in_epsilon(object, 9000, 0.1)
1835
+ end
1836
+ end
1837
+
1838
+ def test_fail_because_negaitve_epsilon
1839
+ check_fail("The epsilon should not be negative.\n" +
1840
+ "<-0.1> expected to be\n>=\n<0.0>.") do
1841
+ assert_in_epsilon(10000, 9000, -0.1, "message")
1842
+ end
1843
+ end
1844
+
1845
+ def test_fail_without_epsilon
1846
+ check_fail("<10000> -/+ (<10000> * <0.001>)[10.0] " +
1847
+ "expected to include\n" +
1848
+ "<10011>.\n" +
1849
+ "\n" +
1850
+ "Relation:\n" +
1851
+ "<" +
1852
+ "<10000>-(<10000>*<0.001>)[9990.0] <= " +
1853
+ "<10000>+(<10000>*<0.001>)[10010.0] < " +
1854
+ "<10011>" +
1855
+ ">") do
1856
+ assert_in_epsilon(10000, 10011)
1857
+ end
1858
+ end
1859
+ end
1860
+
1861
+ class TestAssertNotInEpsilon < Test::Unit::TestCase
1862
+ include AssertionCheckable
1863
+
1864
+ def test_pass
1865
+ check_nothing_fails do
1866
+ assert_not_in_epsilon(10000, 8999, 0.1)
1867
+ end
1868
+ end
1869
+
1870
+ def test_pass_without_epsilon
1871
+ check_nothing_fails do
1872
+ assert_not_in_epsilon(10000, 9989)
1873
+ end
1874
+ end
1875
+
1876
+ def test_pass_with_message
1877
+ check_nothing_fails do
1878
+ assert_not_in_epsilon(10000, 8999, 0.1, "message")
1879
+ end
1880
+ end
1881
+
1882
+ def test_pass_float_like_object
1883
+ check_nothing_fails do
1884
+ float_thing = Object.new
1885
+ def float_thing.to_f
1886
+ 8999.0
1887
+ end
1888
+ assert_not_in_epsilon(10000, float_thing, 0.1)
1889
+ end
1890
+ end
1891
+
1892
+ def test_pass_string_epxected
1893
+ check_nothing_fails do
1894
+ assert_not_in_epsilon("10000", 8999, 0.1)
1895
+ end
1896
+ end
1897
+
1898
+ def test_fail
1899
+ check_fail("<10000> -/+ (<10000> * <0.1>)[1000.0] " +
1900
+ "expected to not include\n" +
1901
+ "<9000>.\n" +
1902
+ "\n" +
1903
+ "Relation:\n" +
1904
+ "<" +
1905
+ "<10000>-(<10000>*<0.1>)[9000.0] <= " +
1906
+ "<9000> <= " +
1907
+ "<10000>+(<10000>*<0.1>)[11000.0]" +
1908
+ ">") do
1909
+ assert_not_in_epsilon(10000, 9000, 0.1)
1910
+ end
1911
+ end
1912
+
1913
+ def test_fail_without_epsilon
1914
+ check_fail("<10000> -/+ (<10000> * <0.001>)[10.0] " +
1915
+ "expected to not include\n" +
1916
+ "<9990>.\n" +
1917
+ "\n" +
1918
+ "Relation:\n" +
1919
+ "<" +
1920
+ "<10000>-(<10000>*<0.001>)[9990.0] <= " +
1921
+ "<9990> <= " +
1922
+ "<10000>+(<10000>*<0.001>)[10010.0]" +
1923
+ ">") do
1924
+ assert_not_in_epsilon(10000, 9990)
1925
+ end
1926
+ end
1927
+
1928
+ def test_fail_with_message
1929
+ check_fail("message.\n" +
1930
+ "<10000> -/+ (<10000> * <0.1>)[1000.0] " +
1931
+ "expected to not include\n" +
1932
+ "<9000>.\n" +
1933
+ "\n" +
1934
+ "Relation:\n" +
1935
+ "<" +
1936
+ "<10000>-(<10000>*<0.1>)[9000.0] <= " +
1937
+ "<9000> <= " +
1938
+ "<10000>+(<10000>*<0.1>)[11000.0]" +
1939
+ ">") do
1940
+ assert_not_in_epsilon(10000, 9000, 0.1, "message")
1941
+ end
1942
+ end
1943
+
1944
+ def test_fail_because_not_float_like_object
1945
+ object = Object.new
1946
+ inspected_object = AssertionMessage.convert(object)
1947
+ check_fail("The arguments must respond to to_f; " +
1948
+ "the first float did not.\n" +
1949
+ "<#{inspected_object}>.respond_to?(:to_f) expected\n" +
1950
+ "(Class: <Object>)") do
1951
+ assert_not_in_epsilon(object, 9000, 0.1)
1952
+ end
1953
+ end
1954
+
1955
+ def test_fail_because_negaitve_epsilon
1956
+ check_fail("The epsilon should not be negative.\n" +
1957
+ "<-0.1> expected to be\n>=\n<0.0>.") do
1958
+ assert_not_in_epsilon(10000, 9000, -0.1, "message")
1959
+ end
1960
+ end
1961
+ end
1962
+
1963
+ class TestAssertInclude < Test::Unit::TestCase
1964
+ include AssertionCheckable
1965
+
1966
+ def test_pass
1967
+ check_nothing_fails do
1968
+ assert_include([1, 2, 3], 1)
1969
+ end
1970
+ end
1971
+
1972
+ def test_pass_with_message
1973
+ check_nothing_fails do
1974
+ assert_include([1, 2, 3], 1, "message")
1975
+ end
1976
+ end
1977
+
1978
+ def test_fail
1979
+ check_fail("<[1, 2, 3]> expected to include\n" +
1980
+ "<4>.") do
1981
+ assert_include([1, 2, 3], 4)
1982
+ end
1983
+ end
1984
+
1985
+ def test_fail_with_message
1986
+ check_fail("message.\n" +
1987
+ "<[1, 2, 3]> expected to include\n" +
1988
+ "<4>.") do
1989
+ assert_include([1, 2, 3], 4, "message")
1990
+ end
1991
+ end
1992
+
1993
+ def test_fail_because_not_collection_like_object
1994
+ object = Object.new
1995
+ inspected_object = AssertionMessage.convert(object)
1996
+ check_fail("The collection must respond to :include?.\n" +
1997
+ "<#{inspected_object}>.respond_to?(:include?) expected\n" +
1998
+ "(Class: <Object>)") do
1999
+ assert_include(object, 1)
2000
+ end
2001
+ end
2002
+ end
2003
+
2004
+ class TestAssertNotInclude < Test::Unit::TestCase
2005
+ include AssertionCheckable
2006
+
2007
+ def test_pass
2008
+ check_nothing_fails do
2009
+ assert_not_include([1, 2, 3], 5)
2010
+ end
2011
+ end
2012
+
2013
+ def test_pass_with_message
2014
+ check_nothing_fails do
2015
+ assert_not_include([1, 2, 3], 5, "message")
2016
+ end
2017
+ end
2018
+
2019
+ def test_fail
2020
+ check_fail("<[1, 2, 3]> expected to not include\n" +
2021
+ "<2>.") do
2022
+ assert_not_include([1, 2, 3], 2)
2023
+ end
2024
+ end
2025
+
2026
+ def test_fail_with_message
2027
+ check_fail("message.\n" +
2028
+ "<[1, 2, 3]> expected to not include\n" +
2029
+ "<2>.") do
2030
+ assert_not_include([1, 2, 3], 2, "message")
2031
+ end
2032
+ end
2033
+
2034
+ def test_fail_because_not_collection_like_object
2035
+ object = Object.new
2036
+ inspected_object = AssertionMessage.convert(object)
2037
+ check_fail("The collection must respond to :include?.\n" +
2038
+ "<#{inspected_object}>.respond_to?(:include?) expected\n" +
2039
+ "(Class: <Object>)") do
2040
+ assert_not_include(object, 1)
2041
+ end
2042
+ end
2043
+ end
2044
+
2045
+ class TestAssertEmpty < Test::Unit::TestCase
2046
+ include AssertionCheckable
2047
+
2048
+ def test_pass
2049
+ check_nothing_fails do
2050
+ assert_empty([])
2051
+ end
2052
+ end
2053
+
2054
+ def test_pass_with_message
2055
+ check_nothing_fails do
2056
+ assert_empty([], "message")
2057
+ end
2058
+ end
2059
+
2060
+ def test_fail
2061
+ check_fail("<[1]> expected to be empty.") do
2062
+ assert_empty([1])
2063
+ end
2064
+ end
2065
+
2066
+ def test_fail_with_message
2067
+ check_fail("message.\n" +
2068
+ "<[1]> expected to be empty.") do
2069
+ assert_empty([1], "message")
2070
+ end
2071
+ end
2072
+
2073
+ def test_fail_because_no_empty_method
2074
+ object = Object.new
2075
+ inspected_object = AssertionMessage.convert(object)
2076
+ check_fail("The object must respond to :empty?.\n" +
2077
+ "<#{inspected_object}>.respond_to?(:empty?) expected\n" +
2078
+ "(Class: <Object>)") do
2079
+ assert_empty(object)
2080
+ end
2081
+ end
2082
+ end
2083
+
2084
+ class TestAssertNotEmpty < Test::Unit::TestCase
2085
+ include AssertionCheckable
2086
+
2087
+ def test_pass
2088
+ check_nothing_fails do
2089
+ assert_not_empty([1])
2090
+ end
2091
+ end
2092
+
2093
+ def test_pass_with_message
2094
+ check_nothing_fails do
2095
+ assert_not_empty([1], "message")
2096
+ end
2097
+ end
2098
+
2099
+ def test_fail
2100
+ check_fail("<[]> expected to not be empty.") do
2101
+ assert_not_empty([])
2102
+ end
2103
+ end
2104
+
2105
+ def test_fail_with_message
2106
+ check_fail("message.\n" +
2107
+ "<[]> expected to not be empty.") do
2108
+ assert_not_empty([], "message")
2109
+ end
2110
+ end
2111
+
2112
+ def test_fail_because_no_empty_method
2113
+ object = Object.new
2114
+ inspected_object = AssertionMessage.convert(object)
2115
+ check_fail("The object must respond to :empty?.\n" +
2116
+ "<#{inspected_object}>.respond_to?(:empty?) expected\n" +
2117
+ "(Class: <Object>)") do
2118
+ assert_not_empty(object)
2119
+ end
2120
+ end
2121
+ end
2122
+
2123
+ class TestAssertNotSend < Test::Unit::TestCase
2124
+ include AssertionCheckable
2125
+
2126
+ def test_pass
2127
+ check_nothing_fails do
2128
+ assert_not_send([[1, 2], :member?, 4], "message")
2129
+ end
2130
+ end
2131
+
2132
+ def test_fail
2133
+ expected_message = <<-EOM
2134
+ message.
2135
+ <[1, 2]> expected to respond to
2136
+ <member?(*[2])> with not a true value but was
2137
+ <true>.
2138
+ EOM
2139
+ check_fail(expected_message.chomp) do
2140
+ assert_not_send([[1, 2], :member?, 2], "message")
2141
+ end
2142
+ end
2143
+ end
2144
+
2145
+ class TestTemplate < Test::Unit::TestCase
2146
+ def test_incompatible_encoding_by_diff
2147
+ need_encoding
2148
+ assert_raise(AssertionFailedError) do
2149
+ assert_equal("UTF-8の日本語\n" * 3,
2150
+ ("Shift_JISの日本語\n" * 3).force_encoding("ASCII-8BIT"))
2151
+ end
2152
+ end
2153
+
2154
+ private
2155
+ def need_encoding
2156
+ omit("need Encoding") unless Object.const_defined?(:Encoding)
2157
+ end
2158
+ end
2159
+ end
2160
+ end