rbs 3.6.1 → 3.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -2
  3. data/.github/workflows/dependabot.yml +1 -1
  4. data/.github/workflows/ruby.yml +34 -10
  5. data/.github/workflows/windows.yml +20 -3
  6. data/.gitignore +1 -0
  7. data/.rubocop.yml +26 -1
  8. data/CHANGELOG.md +241 -0
  9. data/Rakefile +54 -4
  10. data/config.yml +317 -0
  11. data/core/array.rbs +1756 -1591
  12. data/core/basic_object.rbs +38 -35
  13. data/core/comparable.rbs +1 -1
  14. data/core/complex.rbs +166 -94
  15. data/core/data.rbs +2 -2
  16. data/core/dir.rbs +2 -18
  17. data/core/encoding.rbs +12 -32
  18. data/core/enumerable.rbs +270 -266
  19. data/core/enumerator.rbs +14 -4
  20. data/core/env.rbs +1 -1
  21. data/core/errno.rbs +33 -16
  22. data/core/errors.rbs +6 -2
  23. data/core/exception.rbs +342 -167
  24. data/core/fiber.rbs +3 -2
  25. data/core/file.rbs +26 -75
  26. data/core/float.rbs +125 -72
  27. data/core/gc.rbs +158 -42
  28. data/core/hash.rbs +122 -143
  29. data/core/integer.rbs +79 -50
  30. data/core/io/buffer.rbs +49 -43
  31. data/core/io.rbs +108 -151
  32. data/core/kernel.rbs +341 -209
  33. data/core/match_data.rbs +76 -2
  34. data/core/math.rbs +0 -36
  35. data/core/method.rbs +2 -2
  36. data/core/module.rbs +32 -27
  37. data/core/nil_class.rbs +2 -2
  38. data/core/numeric.rbs +101 -104
  39. data/core/object.rbs +1 -5
  40. data/core/object_space/weak_key_map.rbs +3 -4
  41. data/core/object_space.rbs +3 -3
  42. data/core/proc.rbs +82 -14
  43. data/core/process.rbs +110 -58
  44. data/core/ractor.rbs +57 -4
  45. data/core/range.rbs +114 -87
  46. data/core/rational.rbs +0 -2
  47. data/core/rbs/unnamed/argf.rbs +237 -36
  48. data/core/rbs/unnamed/env_class.rbs +35 -53
  49. data/core/rbs/unnamed/random.rbs +1 -2
  50. data/core/regexp.rbs +10 -56
  51. data/core/ruby_vm.rbs +88 -9
  52. data/core/rubygems/config_file.rbs +3 -0
  53. data/core/rubygems/errors.rbs +3 -6
  54. data/core/rubygems/platform.rbs +0 -9
  55. data/core/rubygems/rubygems.rbs +3 -6
  56. data/core/rubygems/version.rbs +8 -8
  57. data/core/set.rbs +4 -16
  58. data/core/string.rbs +271 -264
  59. data/core/struct.rbs +6 -18
  60. data/core/symbol.rbs +14 -21
  61. data/core/thread.rbs +32 -35
  62. data/core/time.rbs +131 -50
  63. data/core/trace_point.rbs +124 -113
  64. data/core/true_class.rbs +0 -1
  65. data/core/unbound_method.rbs +1 -1
  66. data/core/warning.rbs +9 -2
  67. data/docs/architecture.md +1 -1
  68. data/docs/syntax.md +17 -10
  69. data/ext/rbs_extension/extconf.rb +11 -0
  70. data/ext/rbs_extension/location.c +61 -29
  71. data/ext/rbs_extension/location.h +4 -3
  72. data/ext/rbs_extension/main.c +23 -1
  73. data/ext/rbs_extension/parser.c +506 -517
  74. data/ext/rbs_extension/parserstate.c +109 -30
  75. data/ext/rbs_extension/parserstate.h +6 -4
  76. data/ext/rbs_extension/rbs_extension.h +1 -10
  77. data/{ext/rbs_extension → include/rbs}/constants.h +21 -19
  78. data/include/rbs/ruby_objs.h +72 -0
  79. data/include/rbs/util/rbs_constant_pool.h +219 -0
  80. data/include/rbs.h +7 -0
  81. data/lib/rbs/annotate/annotations.rb +3 -3
  82. data/lib/rbs/annotate/rdoc_source.rb +2 -2
  83. data/lib/rbs/ast/declarations.rb +9 -4
  84. data/lib/rbs/ast/directives.rb +10 -0
  85. data/lib/rbs/ast/members.rb +2 -0
  86. data/lib/rbs/ast/type_param.rb +2 -12
  87. data/lib/rbs/cli/diff.rb +3 -3
  88. data/lib/rbs/cli/validate.rb +2 -1
  89. data/lib/rbs/cli.rb +16 -16
  90. data/lib/rbs/collection/config/lockfile_generator.rb +58 -8
  91. data/lib/rbs/collection/config.rb +5 -3
  92. data/lib/rbs/collection/sources/rubygems.rb +1 -1
  93. data/lib/rbs/collection.rb +1 -0
  94. data/lib/rbs/definition.rb +51 -34
  95. data/lib/rbs/definition_builder/ancestor_builder.rb +5 -3
  96. data/lib/rbs/definition_builder.rb +83 -24
  97. data/lib/rbs/environment.rb +33 -18
  98. data/lib/rbs/environment_loader.rb +6 -1
  99. data/lib/rbs/errors.rb +24 -0
  100. data/lib/rbs/locator.rb +2 -0
  101. data/lib/rbs/method_type.rb +2 -0
  102. data/lib/rbs/namespace.rb +1 -0
  103. data/lib/rbs/parser_aux.rb +40 -3
  104. data/lib/rbs/prototype/rb.rb +20 -12
  105. data/lib/rbs/prototype/rbi.rb +11 -6
  106. data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
  107. data/lib/rbs/prototype/runtime.rb +7 -5
  108. data/lib/rbs/subtractor.rb +3 -3
  109. data/lib/rbs/test/hook.rb +47 -42
  110. data/lib/rbs/test/type_check.rb +7 -5
  111. data/lib/rbs/type_name.rb +14 -9
  112. data/lib/rbs/types.rb +63 -14
  113. data/lib/rbs/unit_test/spy.rb +4 -2
  114. data/lib/rbs/unit_test/type_assertions.rb +19 -13
  115. data/lib/rbs/unit_test/with_aliases.rb +3 -1
  116. data/lib/rbs/validator.rb +7 -1
  117. data/lib/rbs/version.rb +1 -1
  118. data/lib/rbs/writer.rb +10 -5
  119. data/lib/rbs.rb +1 -0
  120. data/lib/rdoc_plugin/parser.rb +2 -2
  121. data/rbs.gemspec +6 -2
  122. data/sig/ancestor_graph.rbs +5 -5
  123. data/sig/annotate/rdoc_source.rbs +2 -0
  124. data/sig/cli.rbs +2 -0
  125. data/sig/collection/config/lockfile_generator.rbs +9 -1
  126. data/sig/declarations.rbs +10 -3
  127. data/sig/definition.rbs +80 -12
  128. data/sig/definition_builder.rbs +18 -4
  129. data/sig/directives.rbs +17 -1
  130. data/sig/environment.rbs +3 -1
  131. data/sig/errors.rbs +19 -0
  132. data/sig/namespace.rbs +2 -3
  133. data/sig/parser.rbs +5 -1
  134. data/sig/prototype/rb.rbs +1 -1
  135. data/sig/resolver/constant_resolver.rbs +2 -2
  136. data/sig/resolver/context.rbs +1 -1
  137. data/sig/subtractor.rbs +1 -1
  138. data/sig/test/type_check.rbs +2 -2
  139. data/sig/type_alias_dependency.rbs +2 -2
  140. data/sig/type_alias_regularity.rbs +6 -6
  141. data/sig/type_param.rbs +4 -4
  142. data/sig/typename.rbs +8 -5
  143. data/sig/types.rbs +1 -1
  144. data/sig/unit_test/spy.rbs +2 -0
  145. data/sig/unit_test/type_assertions.rbs +2 -0
  146. data/sig/use_map.rbs +1 -1
  147. data/sig/validator.rbs +6 -2
  148. data/sig/vendorer.rbs +1 -1
  149. data/sig/writer.rbs +1 -1
  150. data/{ext/rbs_extension → src}/constants.c +35 -36
  151. data/src/ruby_objs.c +799 -0
  152. data/src/util/rbs_constant_pool.c +342 -0
  153. data/stdlib/base64/0/base64.rbs +0 -9
  154. data/stdlib/benchmark/0/benchmark.rbs +11 -2
  155. data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
  156. data/stdlib/cgi/0/core.rbs +60 -3
  157. data/stdlib/cgi/0/manifest.yaml +1 -0
  158. data/stdlib/coverage/0/coverage.rbs +0 -3
  159. data/stdlib/csv/0/csv.rbs +18 -58
  160. data/stdlib/csv/0/manifest.yaml +1 -0
  161. data/stdlib/date/0/date.rbs +27 -42
  162. data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -6
  163. data/stdlib/digest/0/digest.rbs +25 -2
  164. data/stdlib/erb/0/erb.rbs +0 -1
  165. data/stdlib/etc/0/etc.rbs +51 -34
  166. data/stdlib/fileutils/0/fileutils.rbs +3 -44
  167. data/stdlib/io-console/0/io-console.rbs +69 -15
  168. data/stdlib/ipaddr/0/ipaddr.rbs +16 -4
  169. data/stdlib/json/0/json.rbs +107 -120
  170. data/stdlib/logger/0/log_device.rbs +1 -1
  171. data/stdlib/logger/0/logger.rbs +3 -18
  172. data/stdlib/minitest/0/kernel.rbs +2 -2
  173. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
  174. data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
  175. data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
  176. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
  177. data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
  178. data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
  179. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  180. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  181. data/stdlib/minitest/0/minitest/mock.rbs +9 -5
  182. data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
  183. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
  184. data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
  185. data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
  186. data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
  187. data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
  188. data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
  189. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
  190. data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
  191. data/stdlib/minitest/0/minitest/spec.rbs +1 -1
  192. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
  193. data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
  194. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +1 -1
  195. data/stdlib/minitest/0/minitest/test.rbs +7 -14
  196. data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
  197. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  198. data/stdlib/minitest/0/minitest/unit.rbs +1 -2
  199. data/stdlib/minitest/0/minitest.rbs +41 -892
  200. data/stdlib/monitor/0/monitor.rbs +13 -4
  201. data/stdlib/net-http/0/net-http.rbs +42 -109
  202. data/stdlib/nkf/0/nkf.rbs +30 -0
  203. data/stdlib/objspace/0/objspace.rbs +1 -2
  204. data/stdlib/observable/0/observable.rbs +1 -1
  205. data/stdlib/open-uri/0/manifest.yaml +1 -0
  206. data/stdlib/open-uri/0/open-uri.rbs +52 -0
  207. data/stdlib/open3/0/open3.rbs +0 -8
  208. data/stdlib/openssl/0/manifest.yaml +1 -0
  209. data/stdlib/openssl/0/openssl.rbs +235 -143
  210. data/stdlib/optparse/0/optparse.rbs +58 -18
  211. data/stdlib/pathname/0/pathname.rbs +2 -8
  212. data/stdlib/pp/0/pp.rbs +3 -1
  213. data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
  214. data/stdlib/pstore/0/pstore.rbs +0 -6
  215. data/stdlib/psych/0/core_ext.rbs +12 -0
  216. data/stdlib/psych/0/psych.rbs +15 -4
  217. data/stdlib/pty/0/pty.rbs +46 -4
  218. data/stdlib/rdoc/0/code_object.rbs +0 -4
  219. data/stdlib/rdoc/0/markup.rbs +10 -12
  220. data/stdlib/rdoc/0/rdoc.rbs +13 -8
  221. data/stdlib/resolv/0/resolv.rbs +21 -12
  222. data/stdlib/ripper/0/ripper.rbs +0 -2
  223. data/stdlib/securerandom/0/securerandom.rbs +7 -2
  224. data/stdlib/shellwords/0/shellwords.rbs +11 -12
  225. data/stdlib/singleton/0/singleton.rbs +0 -1
  226. data/stdlib/socket/0/addrinfo.rbs +1 -2
  227. data/stdlib/socket/0/basic_socket.rbs +0 -5
  228. data/stdlib/socket/0/socket.rbs +32 -27
  229. data/stdlib/socket/0/tcp_server.rbs +0 -3
  230. data/stdlib/socket/0/tcp_socket.rbs +36 -3
  231. data/stdlib/socket/0/udp_socket.rbs +0 -1
  232. data/stdlib/socket/0/unix_server.rbs +0 -3
  233. data/stdlib/socket/0/unix_socket.rbs +4 -2
  234. data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +1 -1
  235. data/stdlib/strscan/0/string_scanner.rbs +1265 -422
  236. data/stdlib/tempfile/0/tempfile.rbs +135 -28
  237. data/stdlib/time/0/time.rbs +48 -35
  238. data/stdlib/timeout/0/timeout.rbs +11 -8
  239. data/stdlib/tmpdir/0/tmpdir.rbs +10 -3
  240. data/stdlib/tsort/0/tsort.rbs +0 -4
  241. data/stdlib/uri/0/common.rbs +28 -30
  242. data/stdlib/uri/0/ftp.rbs +1 -1
  243. data/stdlib/uri/0/generic.rbs +22 -18
  244. data/stdlib/uri/0/http.rbs +2 -2
  245. data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
  246. data/stdlib/zlib/0/buf_error.rbs +1 -70
  247. data/stdlib/zlib/0/data_error.rbs +1 -70
  248. data/stdlib/zlib/0/deflate.rbs +8 -72
  249. data/stdlib/zlib/0/error.rbs +1 -70
  250. data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
  251. data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
  252. data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
  253. data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
  254. data/stdlib/zlib/0/gzip_file.rbs +1 -71
  255. data/stdlib/zlib/0/gzip_reader.rbs +3 -74
  256. data/stdlib/zlib/0/gzip_writer.rbs +1 -70
  257. data/stdlib/zlib/0/inflate.rbs +4 -71
  258. data/stdlib/zlib/0/mem_error.rbs +1 -70
  259. data/stdlib/zlib/0/need_dict.rbs +1 -70
  260. data/stdlib/zlib/0/stream_end.rbs +1 -70
  261. data/stdlib/zlib/0/stream_error.rbs +1 -70
  262. data/stdlib/zlib/0/version_error.rbs +1 -70
  263. data/stdlib/zlib/0/zlib.rbs +0 -2
  264. data/stdlib/zlib/0/zstream.rbs +4 -72
  265. metadata +17 -13
  266. data/ext/rbs_extension/ruby_objs.c +0 -602
  267. data/ext/rbs_extension/ruby_objs.h +0 -51
  268. data/stdlib/minitest/0/manifest.yaml +0 -2
@@ -8,6 +8,10 @@
8
8
  # See Minitest::Runnable for an example.
9
9
  #
10
10
  module Minitest::Assertions
11
+ self.@diff: untyped
12
+
13
+ @skip: untyped
14
+
11
15
  def self.inspect: () -> "UNDEFINED"
12
16
 
13
17
  # <!--
@@ -94,6 +98,8 @@ module Minitest::Assertions
94
98
  #
95
99
  def assert_empty: (untyped obj, ?untyped? msg) -> untyped
96
100
 
101
+ def _where: () -> untyped
102
+
97
103
  # <!--
98
104
  # rdoc-file=lib/minitest/assertions.rb
99
105
  # - assert_equal(exp, act, msg = nil)
@@ -195,7 +201,7 @@ module Minitest::Assertions
195
201
  #
196
202
  # See also: #assert_silent
197
203
  #
198
- def assert_output: (?untyped? stdout, ?untyped? stderr) { () -> untyped } -> untyped
204
+ def assert_output: (?untyped? stdout, ?untyped? stderr) ?{ () -> untyped } -> untyped
199
205
 
200
206
  # <!--
201
207
  # rdoc-file=lib/minitest/assertions.rb
@@ -205,6 +211,25 @@ module Minitest::Assertions
205
211
  #
206
212
  def assert_path_exists: (untyped path, ?untyped? msg) -> untyped
207
213
 
214
+ # <!--
215
+ # rdoc-file=lib/minitest/assertions.rb
216
+ # - assert_pattern() { || ... }
217
+ # -->
218
+ # For testing with pattern matching (only supported with Ruby 3.0 and later)
219
+ #
220
+ # # pass
221
+ # assert_pattern { [1,2,3] => [Integer, Integer, Integer] }
222
+ #
223
+ # # fail "length mismatch (given 3, expected 1)"
224
+ # assert_pattern { [1,2,3] => [Integer] }
225
+ #
226
+ # The bare `=>` pattern will raise a NoMatchingPatternError on failure, which
227
+ # would normally be counted as a test error. This assertion rescues
228
+ # NoMatchingPatternError and generates a test failure. Any other exception will
229
+ # be raised as normal and generate a test error.
230
+ #
231
+ def assert_pattern: () ?{ () -> untyped } -> untyped
232
+
208
233
  # <!--
209
234
  # rdoc-file=lib/minitest/assertions.rb
210
235
  # - assert_predicate(o1, op, msg = nil)
@@ -243,15 +268,16 @@ module Minitest::Assertions
243
268
  #
244
269
  # assert_equal 'This is really bad', error.message
245
270
  #
246
- def assert_raises: (*untyped exp) { () -> untyped } -> untyped
271
+ def assert_raises: (*untyped exp) ?{ () -> untyped } -> untyped
247
272
 
248
273
  # <!--
249
274
  # rdoc-file=lib/minitest/assertions.rb
250
- # - assert_respond_to(obj, meth, msg = nil)
275
+ # - assert_respond_to(obj, meth, msg = nil, include_all: false)
251
276
  # -->
252
- # Fails unless `obj` responds to `meth`.
277
+ # Fails unless `obj` responds to `meth`. include_all defaults to false to match
278
+ # Object#respond_to?
253
279
  #
254
- def assert_respond_to: (untyped obj, untyped meth, ?untyped? msg) -> untyped
280
+ def assert_respond_to: (untyped obj, untyped meth, ?untyped? msg, ?include_all: bool) -> untyped
255
281
 
256
282
  # <!--
257
283
  # rdoc-file=lib/minitest/assertions.rb
@@ -338,7 +364,7 @@ module Minitest::Assertions
338
364
 
339
365
  # <!--
340
366
  # rdoc-file=lib/minitest/assertions.rb
341
- # - fail_after(y,m,d,msg)
367
+ # - fail_after(y, m, d, msg)
342
368
  # -->
343
369
  # Fails after a given date (in the local time zone). This allows you to put
344
370
  # time-bombs in your tests if you need to keep something around until a later
@@ -360,7 +386,7 @@ module Minitest::Assertions
360
386
  # -->
361
387
  # Returns a proc that will output `msg` along with the default message.
362
388
  #
363
- def message: (?untyped? msg, ?untyped? ending) ?{ () -> untyped } -> untyped
389
+ def message: (?untyped? msg, ?untyped? ending) { (?) -> untyped } -> untyped
364
390
 
365
391
  # <!--
366
392
  # rdoc-file=lib/minitest/assertions.rb
@@ -455,6 +481,24 @@ module Minitest::Assertions
455
481
  #
456
482
  def refute_nil: (untyped obj, ?untyped? msg) -> untyped
457
483
 
484
+ # <!--
485
+ # rdoc-file=lib/minitest/assertions.rb
486
+ # - refute_pattern() { || ... }
487
+ # -->
488
+ # For testing with pattern matching (only supported with Ruby 3.0 and later)
489
+ #
490
+ # # pass
491
+ # refute_pattern { [1,2,3] => [String] }
492
+ #
493
+ # # fail "NoMatchingPatternError expected, but nothing was raised."
494
+ # refute_pattern { [1,2,3] => [Integer, Integer, Integer] }
495
+ #
496
+ # This assertion expects a NoMatchingPatternError exception, and will fail if
497
+ # none is raised. Any other exceptions will be raised as normal and generate a
498
+ # test error.
499
+ #
500
+ def refute_pattern: () ?{ () -> untyped } -> untyped
501
+
458
502
  # <!--
459
503
  # rdoc-file=lib/minitest/assertions.rb
460
504
  # - refute_operator(o1, op, o2 = UNDEFINED, msg = nil)
@@ -490,11 +534,12 @@ module Minitest::Assertions
490
534
 
491
535
  # <!--
492
536
  # rdoc-file=lib/minitest/assertions.rb
493
- # - refute_respond_to(obj, meth, msg = nil)
537
+ # - refute_respond_to(obj, meth, msg = nil, include_all: false)
494
538
  # -->
495
- # Fails if `obj` responds to the message `meth`.
539
+ # Fails if `obj` responds to the message `meth`. include_all defaults to false
540
+ # to match Object#respond_to?
496
541
  #
497
- def refute_respond_to: (untyped obj, untyped meth, ?untyped? msg) -> untyped
542
+ def refute_respond_to: (untyped obj, untyped meth, ?untyped? msg, ?include_all: bool) -> untyped
498
543
 
499
544
  # <!--
500
545
  # rdoc-file=lib/minitest/assertions.rb
@@ -506,16 +551,16 @@ module Minitest::Assertions
506
551
 
507
552
  # <!--
508
553
  # rdoc-file=lib/minitest/assertions.rb
509
- # - skip(msg = nil, bt = caller)
554
+ # - skip(msg = nil, _ignored = nil)
510
555
  # -->
511
556
  # Skips the current run. If run in verbose-mode, the skipped run gets listed at
512
557
  # the end of the run but doesn't cause a failure exit code.
513
558
  #
514
- def skip: (?untyped? msg, ?untyped bt) -> untyped
559
+ def skip: (?untyped? msg, ?untyped? _ignored) -> untyped
515
560
 
516
561
  # <!--
517
562
  # rdoc-file=lib/minitest/assertions.rb
518
- # - skip_until(y,m,d,msg)
563
+ # - skip_until(y, m, d, msg)
519
564
  # -->
520
565
  # Skips the current run until a given date (in the local time zone). This allows
521
566
  # you to put some fixes on hold until a later date, but still holds you
@@ -4,6 +4,8 @@
4
4
  # See Minitest.backtrace_filter=.
5
5
  #
6
6
  class Minitest::BacktraceFilter
7
+ def initialize: (?untyped regexp) -> void
8
+
7
9
  # <!--
8
10
  # rdoc-file=lib/minitest.rb
9
11
  # - filter(bt)
@@ -12,5 +14,10 @@ class Minitest::BacktraceFilter
12
14
  # $MT_DEBUG (env).
13
15
  #
14
16
  def filter: (untyped bt) -> (::Array["No backtrace"] | untyped)
17
+
18
+ # <!-- rdoc-file=lib/minitest.rb -->
19
+ # The regular expression to use to filter backtraces. Defaults to `MT_RE`.
20
+ #
21
+ attr_accessor regexp: untyped
15
22
  MT_RE: Regexp
16
23
  end
@@ -12,7 +12,7 @@ class Minitest::BenchSpec < ::Minitest::Benchmark
12
12
  #
13
13
  # See ::bench_performance_linear for an example of how to use this.
14
14
  #
15
- def self.bench: (untyped name) ?{ () -> untyped } -> untyped
15
+ def self.bench: (untyped name) { (?) -> untyped } -> untyped
16
16
 
17
17
  # <!--
18
18
  # rdoc-file=lib/minitest/benchmark.rb
@@ -26,7 +26,7 @@ class Minitest::BenchSpec < ::Minitest::Benchmark
26
26
  #
27
27
  # See Minitest::Benchmark#bench_range for more details.
28
28
  #
29
- def self.bench_range: () ?{ () -> untyped } -> untyped
29
+ def self.bench_range: () ?{ (?) -> untyped } -> untyped
30
30
 
31
31
  # <!--
32
32
  # rdoc-file=lib/minitest/benchmark.rb
@@ -40,7 +40,7 @@ class Minitest::BenchSpec < ::Minitest::Benchmark
40
40
  # end
41
41
  # end
42
42
  #
43
- def self.bench_performance_linear: (untyped name, ?::Float threshold) ?{ () -> untyped } -> untyped
43
+ def self.bench_performance_linear: (untyped name, ?::Float threshold) { (?) -> untyped } -> untyped
44
44
 
45
45
  # <!--
46
46
  # rdoc-file=lib/minitest/benchmark.rb
@@ -54,7 +54,7 @@ class Minitest::BenchSpec < ::Minitest::Benchmark
54
54
  # end
55
55
  # end
56
56
  #
57
- def self.bench_performance_constant: (untyped name, ?::Float threshold) ?{ () -> untyped } -> untyped
57
+ def self.bench_performance_constant: (untyped name, ?::Float threshold) { (?) -> untyped } -> untyped
58
58
 
59
59
  # <!--
60
60
  # rdoc-file=lib/minitest/benchmark.rb
@@ -68,7 +68,7 @@ class Minitest::BenchSpec < ::Minitest::Benchmark
68
68
  # end
69
69
  # end
70
70
  #
71
- def self.bench_performance_exponential: (untyped name, ?::Float threshold) ?{ () -> untyped } -> untyped
71
+ def self.bench_performance_exponential: (untyped name, ?::Float threshold) { (?) -> untyped } -> untyped
72
72
 
73
73
  # <!--
74
74
  # rdoc-file=lib/minitest/benchmark.rb
@@ -82,7 +82,7 @@ class Minitest::BenchSpec < ::Minitest::Benchmark
82
82
  # end
83
83
  # end
84
84
  #
85
- def self.bench_performance_logarithmic: (untyped name, ?::Float threshold) ?{ () -> untyped } -> untyped
85
+ def self.bench_performance_logarithmic: (untyped name, ?::Float threshold) { (?) -> untyped } -> untyped
86
86
 
87
87
  # <!--
88
88
  # rdoc-file=lib/minitest/benchmark.rb
@@ -96,7 +96,7 @@ class Minitest::BenchSpec < ::Minitest::Benchmark
96
96
  # end
97
97
  # end
98
98
  #
99
- def self.bench_performance_power: (untyped name, ?::Float threshold) ?{ () -> untyped } -> untyped
100
- include Minitest::Spec::DSL::InstanceMethods
99
+ def self.bench_performance_power: (untyped name, ?::Float threshold) { (?) -> untyped } -> untyped
101
100
  extend Minitest::Spec::DSL
101
+ include Minitest::Spec::DSL::InstanceMethods
102
102
  end
@@ -5,6 +5,7 @@
5
5
  # See Minitest::Assertions
6
6
  #
7
7
  class Minitest::Benchmark < ::Minitest::Test
8
+ self.@io: untyped
8
9
  def self.io: () -> untyped
9
10
  def io: () -> untyped
10
11
  def self.run: (untyped reporter, ?::Hash[untyped, untyped] options) -> untyped
@@ -63,7 +64,7 @@ class Minitest::Benchmark < ::Minitest::Test
63
64
  # end
64
65
  # end
65
66
  #
66
- def assert_performance: (untyped validation) ?{ () -> untyped } -> untyped
67
+ def assert_performance: (untyped validation) { (?) -> untyped } -> untyped
67
68
 
68
69
  # <!--
69
70
  # rdoc-file=lib/minitest/benchmark.rb
@@ -91,7 +92,7 @@ class Minitest::Benchmark < ::Minitest::Test
91
92
  # end
92
93
  # end
93
94
  #
94
- def assert_performance_constant: (?::Float threshold) ?{ () -> untyped } -> untyped
95
+ def assert_performance_constant: (?::Float threshold) { (?) -> untyped } -> untyped
95
96
 
96
97
  # <!--
97
98
  # rdoc-file=lib/minitest/benchmark.rb
@@ -112,7 +113,7 @@ class Minitest::Benchmark < ::Minitest::Test
112
113
  # end
113
114
  # end
114
115
  #
115
- def assert_performance_exponential: (?::Float threshold) ?{ () -> untyped } -> untyped
116
+ def assert_performance_exponential: (?::Float threshold) { (?) -> untyped } -> untyped
116
117
 
117
118
  # <!--
118
119
  # rdoc-file=lib/minitest/benchmark.rb
@@ -133,7 +134,7 @@ class Minitest::Benchmark < ::Minitest::Test
133
134
  # end
134
135
  # end
135
136
  #
136
- def assert_performance_logarithmic: (?::Float threshold) ?{ () -> untyped } -> untyped
137
+ def assert_performance_logarithmic: (?::Float threshold) { (?) -> untyped } -> untyped
137
138
 
138
139
  # <!--
139
140
  # rdoc-file=lib/minitest/benchmark.rb
@@ -154,7 +155,7 @@ class Minitest::Benchmark < ::Minitest::Test
154
155
  # end
155
156
  # end
156
157
  #
157
- def assert_performance_linear: (?::Float threshold) ?{ () -> untyped } -> untyped
158
+ def assert_performance_linear: (?::Float threshold) { (?) -> untyped } -> untyped
158
159
 
159
160
  # <!--
160
161
  # rdoc-file=lib/minitest/benchmark.rb
@@ -175,7 +176,7 @@ class Minitest::Benchmark < ::Minitest::Test
175
176
  # end
176
177
  # end
177
178
  #
178
- def assert_performance_power: (?::Float threshold) ?{ () -> untyped } -> untyped
179
+ def assert_performance_power: (?::Float threshold) { (?) -> untyped } -> untyped
179
180
 
180
181
  # <!--
181
182
  # rdoc-file=lib/minitest/benchmark.rb
@@ -183,7 +184,7 @@ class Minitest::Benchmark < ::Minitest::Test
183
184
  # -->
184
185
  # Takes an array of x/y pairs and calculates the general R^2 value.
185
186
  #
186
- # See: http://en.wikipedia.org/wiki/Coefficient_of_determination
187
+ # See: https://en.wikipedia.org/wiki/Coefficient_of_determination
187
188
  #
188
189
  def fit_error: (untyped xys) { (untyped) -> untyped } -> untyped
189
190
 
@@ -195,9 +196,9 @@ class Minitest::Benchmark < ::Minitest::Test
195
196
  #
196
197
  # Takes x and y values and returns [a, b, r^2].
197
198
  #
198
- # See: http://mathworld.wolfram.com/LeastSquaresFittingExponential.html
199
+ # See: https://mathworld.wolfram.com/LeastSquaresFittingExponential.html
199
200
  #
200
- def fit_exponential: (untyped xs, untyped ys) -> untyped
201
+ def fit_exponential: (untyped xs, untyped ys) -> ::Array[untyped]
201
202
 
202
203
  # <!--
203
204
  # rdoc-file=lib/minitest/benchmark.rb
@@ -207,9 +208,9 @@ class Minitest::Benchmark < ::Minitest::Test
207
208
  #
208
209
  # Takes x and y values and returns [a, b, r^2].
209
210
  #
210
- # See: http://mathworld.wolfram.com/LeastSquaresFittingLogarithmic.html
211
+ # See: https://mathworld.wolfram.com/LeastSquaresFittingLogarithmic.html
211
212
  #
212
- def fit_logarithmic: (untyped xs, untyped ys) -> untyped
213
+ def fit_logarithmic: (untyped xs, untyped ys) -> ::Array[untyped]
213
214
 
214
215
  # <!--
215
216
  # rdoc-file=lib/minitest/benchmark.rb
@@ -219,9 +220,9 @@ class Minitest::Benchmark < ::Minitest::Test
219
220
  #
220
221
  # Takes x and y values and returns [a, b, r^2].
221
222
  #
222
- # See: http://mathworld.wolfram.com/LeastSquaresFitting.html
223
+ # See: https://mathworld.wolfram.com/LeastSquaresFitting.html
223
224
  #
224
- def fit_linear: (untyped xs, untyped ys) -> untyped
225
+ def fit_linear: (untyped xs, untyped ys) -> ::Array[untyped]
225
226
 
226
227
  # <!--
227
228
  # rdoc-file=lib/minitest/benchmark.rb
@@ -231,9 +232,9 @@ class Minitest::Benchmark < ::Minitest::Test
231
232
  #
232
233
  # Takes x and y values and returns [a, b, r^2].
233
234
  #
234
- # See: http://mathworld.wolfram.com/LeastSquaresFittingPowerLaw.html
235
+ # See: https://mathworld.wolfram.com/LeastSquaresFittingPowerLaw.html
235
236
  #
236
- def fit_power: (untyped xs, untyped ys) -> untyped
237
+ def fit_power: (untyped xs, untyped ys) -> ::Array[untyped]
237
238
 
238
239
  # <!--
239
240
  # rdoc-file=lib/minitest/benchmark.rb
@@ -245,7 +246,7 @@ class Minitest::Benchmark < ::Minitest::Test
245
246
  # sigma([1, 2, 3]) # => 1 + 2 + 3 => 6
246
247
  # sigma([1, 2, 3]) { |n| n ** 2 } # => 1 + 4 + 9 => 14
247
248
  #
248
- def sigma: (untyped enum) ?{ () -> untyped } -> untyped
249
+ def sigma: (untyped enum) ?{ (?) -> untyped } -> untyped
249
250
 
250
251
  # <!--
251
252
  # rdoc-file=lib/minitest/benchmark.rb
@@ -0,0 +1,13 @@
1
+ # <!-- rdoc-file=lib/minitest/compress.rb -->
2
+ # Compresses backtraces.
3
+ #
4
+ module Minitest::Compress
5
+ # <!--
6
+ # rdoc-file=lib/minitest/compress.rb
7
+ # - compress(orig)
8
+ # -->
9
+ # Takes a backtrace (array of strings) and compresses repeating cycles in it to
10
+ # make it more readable.
11
+ #
12
+ def compress: (untyped orig) -> untyped
13
+ end
@@ -0,0 +1,3 @@
1
+ module Minitest::ErrorOnWarning
2
+ def warn: (untyped message, ?category: untyped?) -> untyped
3
+ end
@@ -4,15 +4,19 @@
4
4
  # All mock objects are an instance of Mock
5
5
  #
6
6
  class Minitest::Mock
7
+ @@KW_WARNED: untyped
8
+ @delegator: untyped
9
+ @expected_calls: untyped
10
+ @actual_calls: untyped
7
11
  alias __respond_to? respond_to?
8
12
  def initialize: (?untyped? delegator) -> void
9
13
 
10
14
  # <!--
11
15
  # rdoc-file=lib/minitest/mock.rb
12
- # - expect(name, retval, args = [], &blk)
16
+ # - expect(name, retval, args = [], **kwargs, &blk)
13
17
  # -->
14
- # Expect that method `name` is called, optionally with `args` or a `blk`, and
15
- # returns `retval`.
18
+ # Expect that method `name` is called, optionally with `args` (and `kwargs` or a
19
+ # `blk`), and returns `retval`.
16
20
  #
17
21
  # @mock.expect(:meaning_of_life, 42)
18
22
  # @mock.meaning_of_life # => 42
@@ -44,7 +48,7 @@ class Minitest::Mock
44
48
  # @mock.ordinal_increment # => 'second'
45
49
  # @mock.ordinal_increment # => raises MockExpectationError "No more expects available for :ordinal_increment"
46
50
  #
47
- def expect: (untyped name, untyped retval, ?untyped args) ?{ () -> untyped } -> self
51
+ def expect: (untyped name, untyped retval, ?untyped args, **untyped kwargs) ?{ (?) -> untyped } -> self
48
52
  def __call: (untyped name, untyped data) -> untyped
49
53
 
50
54
  # <!--
@@ -55,6 +59,6 @@ class Minitest::Mock
55
59
  # if the mock object was not called as expected.
56
60
  #
57
61
  def verify: () -> true
58
- def method_missing: (untyped sym, *untyped args) ?{ () -> untyped } -> untyped
62
+ def method_missing: (untyped sym, *untyped args, **untyped kwargs) { (?) -> untyped } -> untyped
59
63
  def respond_to?: (untyped sym, ?bool include_private) -> (true | untyped)
60
64
  end
@@ -2,6 +2,10 @@
2
2
  # The engine used to run multiple tests in parallel.
3
3
  #
4
4
  class Minitest::Parallel::Executor
5
+ @size: untyped
6
+ @queue: untyped
7
+ @pool: untyped
8
+
5
9
  # <!--
6
10
  # rdoc-file=lib/minitest/parallel.rb
7
11
  # - new(size)
@@ -1,5 +1,4 @@
1
1
  module Minitest::Parallel::Test::ClassMethods
2
- # :nodoc:
3
2
  def run_one_method: (untyped klass, untyped method_name, untyped reporter) -> untyped
4
3
 
5
4
  def test_order: () -> :parallel
@@ -2,6 +2,14 @@
2
2
  # Show your testing pride!
3
3
  #
4
4
  class Minitest::PrideIO
5
+ self.@pride: untyped
6
+ @io: untyped
7
+ # stolen from /System/Library/Perl/5.10.0/Term/ANSIColor.pm
8
+ # also reference https://en.wikipedia.org/wiki/ANSI_escape_code
9
+ @colors: untyped
10
+ @size: untyped
11
+ @index: untyped
12
+
5
13
  # <!--
6
14
  # rdoc-file=lib/minitest/pride_plugin.rb
7
15
  # - pride!()
@@ -4,6 +4,8 @@
4
4
  # (Inspired by lolcat, but with clean math)
5
5
  #
6
6
  class Minitest::PrideLOL < ::Minitest::PrideIO
7
+ @colors: untyped
8
+ @index: untyped
7
9
  def initialize: (untyped io) -> void
8
10
 
9
11
  # <!--
@@ -6,6 +6,6 @@
6
6
  # composite and replace it with your own.
7
7
  #
8
8
  class Minitest::ProgressReporter < ::Minitest::Reporter
9
- def prerecord: (untyped klass, untyped name) -> (untyped | nil)
9
+ def prerecord: (untyped klass, untyped name) -> (nil | untyped)
10
10
  def record: (untyped result) -> untyped
11
11
  end
@@ -48,4 +48,6 @@ module Minitest::Reportable
48
48
  # Did this run error?
49
49
  #
50
50
  def error?: () -> untyped
51
+
52
+ BASE_DIR: String
51
53
  end
@@ -6,6 +6,11 @@
6
6
  # Runnable.runnables.
7
7
  #
8
8
  class Minitest::Runnable
9
+ @@runnables: untyped
10
+ @@marshal_dump_warned: untyped
11
+ self.@_info_handler: untyped
12
+ @NAME: untyped
13
+ @metadata: untyped
9
14
  def time_it: () { () -> untyped } -> untyped
10
15
 
11
16
  # <!--
@@ -52,7 +57,16 @@ class Minitest::Runnable
52
57
  # Minitest::ParallelTest::ClassMethods for an example.
53
58
  #
54
59
  def self.run_one_method: (untyped klass, untyped method_name, untyped reporter) -> untyped
55
- def self.with_info_handler: (untyped reporter) ?{ () -> untyped } -> untyped
60
+
61
+ # <!--
62
+ # rdoc-file=lib/minitest.rb
63
+ # - test_order()
64
+ # -->
65
+ # Defines the order to run tests (:random by default). Override this or use a
66
+ # convenience method to change it for your tests.
67
+ #
68
+ def self.test_order: () -> :random
69
+ def self.with_info_handler: (untyped reporter) { (?) -> untyped } -> untyped
56
70
  def self.on_signal: (untyped name, untyped action) { () -> untyped } -> untyped
57
71
 
58
72
  # <!--
@@ -76,6 +90,19 @@ class Minitest::Runnable
76
90
  def failure: () -> untyped
77
91
  def initialize: (untyped name) -> void
78
92
 
93
+ # <!-- rdoc-file=lib/minitest.rb -->
94
+ # Sets metadata, mainly used for `Result.from`.
95
+ #
96
+ def metadata: () -> untyped
97
+
98
+ # <!--
99
+ # rdoc-file=lib/minitest.rb
100
+ # - metadata?()
101
+ # -->
102
+ # Returns true if metadata exists.
103
+ #
104
+ def metadata?: () -> untyped
105
+
79
106
  # <!--
80
107
  # rdoc-file=lib/minitest.rb
81
108
  # - run()
@@ -127,5 +154,10 @@ class Minitest::Runnable
127
154
  # The time it took to run.
128
155
  #
129
156
  attr_accessor time: untyped
157
+
158
+ # <!-- rdoc-file=lib/minitest.rb -->
159
+ # Sets metadata, mainly used for `Result.from`.
160
+ #
161
+ attr_writer metadata: untyped
130
162
  SIGNALS: Hash[String, Integer]
131
163
  end
@@ -28,7 +28,7 @@ module Minitest::Spec::DSL::InstanceMethods
28
28
  # value(1 + 1).must_equal 2
29
29
  # expect(1 + 1).must_equal 2
30
30
  #
31
- def _: (?untyped? value) ?{ () -> untyped } -> untyped
31
+ def _: (?untyped? value) ?{ (?) -> untyped } -> untyped
32
32
 
33
33
  # <!--
34
34
  # rdoc-file=lib/minitest/spec.rb
@@ -2,6 +2,10 @@
2
2
  # Oh look! A Minitest::Spec::DSL module! Eat your heart out DHH.
3
3
  #
4
4
  module Minitest::Spec::DSL
5
+ @children: untyped
6
+
7
+ @specs: untyped
8
+
5
9
  # <!--
6
10
  # rdoc-file=lib/minitest/spec.rb
7
11
  # - register_spec_type(*args, &block)
@@ -20,7 +24,7 @@ module Minitest::Spec::DSL
20
24
  # desc.superclass == ActiveRecord::Base
21
25
  # end
22
26
  #
23
- def register_spec_type: (*untyped args) ?{ () -> untyped } -> untyped
27
+ def register_spec_type: (*untyped args) ?{ (?) -> untyped } -> untyped
24
28
 
25
29
  # <!--
26
30
  # rdoc-file=lib/minitest/spec.rb
@@ -48,7 +52,7 @@ module Minitest::Spec::DSL
48
52
  #
49
53
  # Equivalent to Minitest::Test#setup.
50
54
  #
51
- def before: (?untyped? _type) ?{ () -> untyped } -> untyped
55
+ def before: (?untyped? _type) { (?) -> untyped } -> untyped
52
56
 
53
57
  # <!--
54
58
  # rdoc-file=lib/minitest/spec.rb
@@ -60,7 +64,7 @@ module Minitest::Spec::DSL
60
64
  #
61
65
  # Equivalent to Minitest::Test#teardown.
62
66
  #
63
- def after: (?untyped? _type) ?{ () -> untyped } -> untyped
67
+ def after: (?untyped? _type) { (?) -> untyped } -> untyped
64
68
 
65
69
  # <!--
66
70
  # rdoc-file=lib/minitest/spec.rb
@@ -76,7 +80,7 @@ module Minitest::Spec::DSL
76
80
  # Hint: If you *do* want inheritance, use minitest/test. You can mix and match
77
81
  # between assertions and expectations as much as you want.
78
82
  #
79
- def it: (?::String desc) ?{ () -> untyped } -> untyped
83
+ def it: (?::String desc) ?{ (?) -> untyped } -> untyped
80
84
 
81
85
  # <!--
82
86
  # rdoc-file=lib/minitest/spec.rb
@@ -86,7 +90,7 @@ module Minitest::Spec::DSL
86
90
  #
87
91
  # Why use let instead of def? I honestly don't know.
88
92
  #
89
- def let: (untyped name) ?{ () -> untyped } -> untyped
93
+ def let: (untyped name) { (?) -> untyped } -> untyped
90
94
 
91
95
  # <!--
92
96
  # rdoc-file=lib/minitest/spec.rb
@@ -95,7 +99,7 @@ module Minitest::Spec::DSL
95
99
  # Another lazy man's accessor generator. Made even more lazy by setting the name
96
100
  # for you to `subject`.
97
101
  #
98
- def subject: () ?{ () -> untyped } -> untyped
102
+ def subject: () { (?) -> untyped } -> untyped
99
103
 
100
104
  def create: (untyped name, untyped desc) -> untyped
101
105
 
@@ -6,6 +6,6 @@
6
6
  class Minitest::Spec < ::Minitest::Test
7
7
  def self.current: () -> untyped
8
8
  def initialize: (untyped name) -> void
9
- include Minitest::Spec::DSL::InstanceMethods
10
9
  extend Minitest::Spec::DSL
10
+ include Minitest::Spec::DSL::InstanceMethods
11
11
  end
@@ -69,6 +69,11 @@ class Minitest::StatisticsReporter < ::Minitest::Reporter
69
69
  #
70
70
  attr_accessor errors: untyped
71
71
 
72
+ # <!-- rdoc-file=lib/minitest.rb -->
73
+ # Total number of tests that warned.
74
+ #
75
+ attr_accessor warnings: untyped
76
+
72
77
  # <!-- rdoc-file=lib/minitest.rb -->
73
78
  # Total number of tests that where skipped.
74
79
  #
@@ -13,13 +13,6 @@ class Minitest::SummaryReporter < ::Minitest::StatisticsReporter
13
13
  def aggregated_results: (untyped io) -> untyped
14
14
  def to_s: () -> untyped
15
15
  def summary: () -> untyped
16
-
17
- # <!--
18
- # rdoc-file=lib/minitest.rb
19
- # - binary_string()
20
- # -->
21
- #
22
- private def binary_string: () -> untyped
23
16
  attr_accessor sync: untyped
24
17
  attr_accessor old_sync: untyped
25
18
  end
@@ -35,7 +35,7 @@ module Minitest::Test::LifecycleHooks
35
35
  # end
36
36
  # end
37
37
  #
38
- # class MiniTest::Test
38
+ # class Minitest::Test
39
39
  # include MyMinitestPlugin
40
40
  # end
41
41
  #