ruby-lsp 0.0.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +6 -0
  3. data/.rubocop.yml +25 -0
  4. data/CHANGELOG.md +35 -0
  5. data/Gemfile +10 -6
  6. data/Gemfile.lock +63 -16
  7. data/README.md +41 -0
  8. data/Rakefile +8 -1
  9. data/VERSION +1 -1
  10. data/bin/console +19 -0
  11. data/bin/tapioca +29 -0
  12. data/dev.yml +3 -0
  13. data/exe/ruby-lsp +19 -4
  14. data/lib/ruby-lsp.rb +2 -1
  15. data/lib/ruby_lsp/cli.rb +13 -5
  16. data/lib/ruby_lsp/document.rb +43 -14
  17. data/lib/ruby_lsp/handler.rb +107 -37
  18. data/lib/ruby_lsp/internal.rb +7 -0
  19. data/lib/ruby_lsp/requests/base_request.rb +18 -5
  20. data/lib/ruby_lsp/requests/code_actions.rb +20 -8
  21. data/lib/ruby_lsp/requests/diagnostics.rb +25 -7
  22. data/lib/ruby_lsp/requests/document_highlight.rb +113 -0
  23. data/lib/ruby_lsp/requests/document_symbol.rb +56 -16
  24. data/lib/ruby_lsp/requests/folding_ranges.rb +70 -34
  25. data/lib/ruby_lsp/requests/formatting.rb +24 -14
  26. data/lib/ruby_lsp/requests/selection_ranges.rb +18 -4
  27. data/lib/ruby_lsp/requests/semantic_highlighting.rb +187 -34
  28. data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +16 -3
  29. data/lib/ruby_lsp/requests/support/rubocop_diagnostics_runner.rb +61 -0
  30. data/lib/ruby_lsp/requests/support/rubocop_formatting_runner.rb +50 -0
  31. data/lib/ruby_lsp/requests/support/selection_range.rb +4 -0
  32. data/lib/ruby_lsp/requests/support/semantic_token_encoder.rb +24 -3
  33. data/lib/ruby_lsp/requests/support/syntax_error_diagnostic.rb +6 -0
  34. data/lib/ruby_lsp/requests.rb +13 -1
  35. data/lib/ruby_lsp/store.rb +20 -3
  36. data/rakelib/check_docs.rake +34 -6
  37. data/ruby-lsp.gemspec +7 -5
  38. data/sorbet/config +4 -0
  39. data/sorbet/rbi/.rubocop.yml +8 -0
  40. data/sorbet/rbi/gems/ansi@1.5.0.rbi +338 -0
  41. data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
  42. data/sorbet/rbi/gems/builder@3.2.4.rbi +418 -0
  43. data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
  44. data/sorbet/rbi/gems/debug@1.5.0.rbi +1273 -0
  45. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +867 -0
  46. data/sorbet/rbi/gems/io-console@0.5.11.rbi +8 -0
  47. data/sorbet/rbi/gems/irb@1.4.1.rbi +376 -0
  48. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +7325 -0
  49. data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
  50. data/sorbet/rbi/gems/minitest-reporters@1.5.0.rbi +612 -0
  51. data/sorbet/rbi/gems/minitest@5.15.0.rbi +994 -0
  52. data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
  53. data/sorbet/rbi/gems/parser@3.1.2.0.rbi +3968 -0
  54. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +734 -0
  55. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  56. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
  57. data/sorbet/rbi/gems/rake@13.0.6.rbi +1853 -0
  58. data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
  59. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1854 -0
  60. data/sorbet/rbi/gems/reline@0.3.1.rbi +1274 -0
  61. data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
  62. data/sorbet/rbi/gems/rubocop-ast@1.18.0.rbi +4180 -0
  63. data/sorbet/rbi/gems/rubocop-minitest@0.20.0.rbi +1369 -0
  64. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +246 -0
  65. data/sorbet/rbi/gems/rubocop-shopify@2.6.0.rbi +8 -0
  66. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +652 -0
  67. data/sorbet/rbi/gems/rubocop@1.30.0.rbi +36729 -0
  68. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
  69. data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
  70. data/sorbet/rbi/gems/syntax_tree@2.7.1.rbi +6777 -0
  71. data/sorbet/rbi/gems/tapioca@0.8.1.rbi +1972 -0
  72. data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
  73. data/sorbet/rbi/gems/unicode-display_width@2.1.0.rbi +27 -0
  74. data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
  75. data/sorbet/rbi/gems/webrick@1.7.0.rbi +1779 -0
  76. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +289 -0
  77. data/sorbet/rbi/gems/yard@0.9.27.rbi +13048 -0
  78. data/sorbet/rbi/shims/fiddle.rbi +4 -0
  79. data/sorbet/rbi/shims/hash.rbi +6 -0
  80. data/sorbet/rbi/shims/rdoc.rbi +4 -0
  81. data/sorbet/tapioca/config.yml +13 -0
  82. data/sorbet/tapioca/require.rb +7 -0
  83. metadata +62 -13
  84. data/lib/ruby_lsp/requests/rubocop_request.rb +0 -49
  85. data/shipit.production.yml +0 -1
@@ -0,0 +1,994 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `minitest` gem.
5
+ # Please instead update this file by running `bin/tapioca gem minitest`.
6
+
7
+ # :include: README.rdoc
8
+ module Minitest
9
+ class << self
10
+ # Internal run method. Responsible for telling all Runnable
11
+ # sub-classes to run.
12
+ def __run(reporter, options); end
13
+
14
+ # A simple hook allowing you to run a block of code after everything
15
+ # is done running. Eg:
16
+ #
17
+ # Minitest.after_run { p $debugging_info }
18
+ def after_run(&block); end
19
+
20
+ # Registers Minitest to run at process exit
21
+ def autorun; end
22
+
23
+ def backtrace_filter; end
24
+ def backtrace_filter=(_arg0); end
25
+ def clock_time; end
26
+ def extensions; end
27
+ def extensions=(_arg0); end
28
+ def filter_backtrace(bt); end
29
+ def info_signal; end
30
+ def info_signal=(_arg0); end
31
+ def init_plugins(options); end
32
+ def load_plugins; end
33
+ def parallel_executor; end
34
+ def parallel_executor=(_arg0); end
35
+ def process_args(args = T.unsafe(nil)); end
36
+ def reporter; end
37
+ def reporter=(_arg0); end
38
+
39
+ # This is the top-level run method. Everything starts from here. It
40
+ # tells each Runnable sub-class to run, and each of those are
41
+ # responsible for doing whatever they do.
42
+ #
43
+ # The overall structure of a run looks like this:
44
+ #
45
+ # Minitest.autorun
46
+ # Minitest.run(args)
47
+ # Minitest.__run(reporter, options)
48
+ # Runnable.runnables.each
49
+ # runnable.run(reporter, options)
50
+ # self.runnable_methods.each
51
+ # self.run_one_method(self, runnable_method, reporter)
52
+ # Minitest.run_one_method(klass, runnable_method)
53
+ # klass.new(runnable_method).run
54
+ def run(args = T.unsafe(nil)); end
55
+
56
+ def run_one_method(klass, method_name); end
57
+ end
58
+ end
59
+
60
+ # Defines the API for Reporters. Subclass this and override whatever
61
+ # you want. Go nuts.
62
+ class Minitest::AbstractReporter
63
+ include ::Mutex_m
64
+
65
+ def lock; end
66
+ def locked?; end
67
+
68
+ # Did this run pass?
69
+ #
70
+ # @return [Boolean]
71
+ def passed?; end
72
+
73
+ # About to start running a test. This allows a reporter to show
74
+ # that it is starting or that we are in the middle of a test run.
75
+ def prerecord(klass, name); end
76
+
77
+ # Output and record the result of the test. Call
78
+ # {result#result_code}[rdoc-ref:Runnable#result_code] to get the
79
+ # result character string. Stores the result of the run if the run
80
+ # did not pass.
81
+ def record(result); end
82
+
83
+ # Outputs the summary of the run.
84
+ def report; end
85
+
86
+ # Starts reporting on the run.
87
+ def start; end
88
+
89
+ def synchronize(&block); end
90
+ def try_lock; end
91
+ def unlock; end
92
+ end
93
+
94
+ # Represents run failures.
95
+ class Minitest::Assertion < ::Exception
96
+ def error; end
97
+
98
+ # Where was this run before an assertion was raised?
99
+ def location; end
100
+
101
+ def result_code; end
102
+ def result_label; end
103
+ end
104
+
105
+ # Minitest Assertions. All assertion methods accept a +msg+ which is
106
+ # printed if the assertion fails.
107
+ #
108
+ # Protocol: Nearly everything here boils up to +assert+, which
109
+ # expects to be able to increment an instance accessor named
110
+ # +assertions+. This is not provided by Assertions and must be
111
+ # provided by the thing including Assertions. See Minitest::Runnable
112
+ # for an example.
113
+ module Minitest::Assertions
114
+ def _synchronize; end
115
+
116
+ # Fails unless +test+ is truthy.
117
+ def assert(test, msg = T.unsafe(nil)); end
118
+
119
+ # Fails unless +obj+ is empty.
120
+ def assert_empty(obj, msg = T.unsafe(nil)); end
121
+
122
+ # Fails unless <tt>exp == act</tt> printing the difference between
123
+ # the two, if possible.
124
+ #
125
+ # If there is no visible difference but the assertion fails, you
126
+ # should suspect that your #== is buggy, or your inspect output is
127
+ # missing crucial details. For nicer structural diffing, set
128
+ # Minitest::Test.make_my_diffs_pretty!
129
+ #
130
+ # For floats use assert_in_delta.
131
+ #
132
+ # See also: Minitest::Assertions.diff
133
+ def assert_equal(exp, act, msg = T.unsafe(nil)); end
134
+
135
+ # For comparing Floats. Fails unless +exp+ and +act+ are within +delta+
136
+ # of each other.
137
+ #
138
+ # assert_in_delta Math::PI, (22.0 / 7.0), 0.01
139
+ def assert_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end
140
+
141
+ # For comparing Floats. Fails unless +exp+ and +act+ have a relative
142
+ # error less than +epsilon+.
143
+ def assert_in_epsilon(exp, act, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end
144
+
145
+ # Fails unless +collection+ includes +obj+.
146
+ def assert_includes(collection, obj, msg = T.unsafe(nil)); end
147
+
148
+ # Fails unless +obj+ is an instance of +cls+.
149
+ def assert_instance_of(cls, obj, msg = T.unsafe(nil)); end
150
+
151
+ # Fails unless +obj+ is a kind of +cls+.
152
+ def assert_kind_of(cls, obj, msg = T.unsafe(nil)); end
153
+
154
+ # Fails unless +matcher+ <tt>=~</tt> +obj+.
155
+ def assert_match(matcher, obj, msg = T.unsafe(nil)); end
156
+
157
+ # Fails unless +obj+ is nil
158
+ def assert_nil(obj, msg = T.unsafe(nil)); end
159
+
160
+ # For testing with binary operators. Eg:
161
+ #
162
+ # assert_operator 5, :<=, 4
163
+ def assert_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end
164
+
165
+ # Fails if stdout or stderr do not output the expected results.
166
+ # Pass in nil if you don't care about that streams output. Pass in
167
+ # "" if you require it to be silent. Pass in a regexp if you want
168
+ # to pattern match.
169
+ #
170
+ # assert_output(/hey/) { method_with_output }
171
+ #
172
+ # NOTE: this uses #capture_io, not #capture_subprocess_io.
173
+ #
174
+ # See also: #assert_silent
175
+ def assert_output(stdout = T.unsafe(nil), stderr = T.unsafe(nil)); end
176
+
177
+ # Fails unless +path+ exists.
178
+ def assert_path_exists(path, msg = T.unsafe(nil)); end
179
+
180
+ # For testing with predicates. Eg:
181
+ #
182
+ # assert_predicate str, :empty?
183
+ #
184
+ # This is really meant for specs and is front-ended by assert_operator:
185
+ #
186
+ # str.must_be :empty?
187
+ def assert_predicate(o1, op, msg = T.unsafe(nil)); end
188
+
189
+ # Fails unless the block raises one of +exp+. Returns the
190
+ # exception matched so you can check the message, attributes, etc.
191
+ #
192
+ # +exp+ takes an optional message on the end to help explain
193
+ # failures and defaults to StandardError if no exception class is
194
+ # passed. Eg:
195
+ #
196
+ # assert_raises(CustomError) { method_with_custom_error }
197
+ #
198
+ # With custom error message:
199
+ #
200
+ # assert_raises(CustomError, 'This should have raised CustomError') { method_with_custom_error }
201
+ #
202
+ # Using the returned object:
203
+ #
204
+ # error = assert_raises(CustomError) do
205
+ # raise CustomError, 'This is really bad'
206
+ # end
207
+ #
208
+ # assert_equal 'This is really bad', error.message
209
+ def assert_raises(*exp); end
210
+
211
+ # Fails unless +obj+ responds to +meth+.
212
+ def assert_respond_to(obj, meth, msg = T.unsafe(nil)); end
213
+
214
+ # Fails unless +exp+ and +act+ are #equal?
215
+ def assert_same(exp, act, msg = T.unsafe(nil)); end
216
+
217
+ # +send_ary+ is a receiver, message and arguments.
218
+ #
219
+ # Fails unless the call returns a true value
220
+ def assert_send(send_ary, m = T.unsafe(nil)); end
221
+
222
+ # Fails if the block outputs anything to stderr or stdout.
223
+ #
224
+ # See also: #assert_output
225
+ def assert_silent; end
226
+
227
+ # Fails unless the block throws +sym+
228
+ def assert_throws(sym, msg = T.unsafe(nil)); end
229
+
230
+ # Captures $stdout and $stderr into strings:
231
+ #
232
+ # out, err = capture_io do
233
+ # puts "Some info"
234
+ # warn "You did a bad thing"
235
+ # end
236
+ #
237
+ # assert_match %r%info%, out
238
+ # assert_match %r%bad%, err
239
+ #
240
+ # NOTE: For efficiency, this method uses StringIO and does not
241
+ # capture IO for subprocesses. Use #capture_subprocess_io for
242
+ # that.
243
+ def capture_io; end
244
+
245
+ # Captures $stdout and $stderr into strings, using Tempfile to
246
+ # ensure that subprocess IO is captured as well.
247
+ #
248
+ # out, err = capture_subprocess_io do
249
+ # system "echo Some info"
250
+ # system "echo You did a bad thing 1>&2"
251
+ # end
252
+ #
253
+ # assert_match %r%info%, out
254
+ # assert_match %r%bad%, err
255
+ #
256
+ # NOTE: This method is approximately 10x slower than #capture_io so
257
+ # only use it when you need to test the output of a subprocess.
258
+ def capture_subprocess_io; end
259
+
260
+ # Returns a diff between +exp+ and +act+. If there is no known
261
+ # diff command or if it doesn't make sense to diff the output
262
+ # (single line, short output), then it simply returns a basic
263
+ # comparison between the two.
264
+ #
265
+ # See +things_to_diff+ for more info.
266
+ def diff(exp, act); end
267
+
268
+ # Returns details for exception +e+
269
+ def exception_details(e, msg); end
270
+
271
+ # Fails after a given date (in the local time zone). This allows
272
+ # you to put time-bombs in your tests if you need to keep
273
+ # something around until a later date lest you forget about it.
274
+ def fail_after(y, m, d, msg); end
275
+
276
+ # Fails with +msg+.
277
+ def flunk(msg = T.unsafe(nil)); end
278
+
279
+ # Returns a proc that will output +msg+ along with the default message.
280
+ def message(msg = T.unsafe(nil), ending = T.unsafe(nil), &default); end
281
+
282
+ # This returns a human-readable version of +obj+. By default
283
+ # #inspect is called. You can override this to use #pretty_inspect
284
+ # if you want.
285
+ #
286
+ # See Minitest::Test.make_my_diffs_pretty!
287
+ def mu_pp(obj); end
288
+
289
+ # This returns a diff-able more human-readable version of +obj+.
290
+ # This differs from the regular mu_pp because it expands escaped
291
+ # newlines and makes hex-values (like object_ids) generic. This
292
+ # uses mu_pp to do the first pass and then cleans it up.
293
+ def mu_pp_for_diff(obj); end
294
+
295
+ # used for counting assertions
296
+ def pass(_msg = T.unsafe(nil)); end
297
+
298
+ # Fails if +test+ is truthy.
299
+ def refute(test, msg = T.unsafe(nil)); end
300
+
301
+ # Fails if +obj+ is empty.
302
+ def refute_empty(obj, msg = T.unsafe(nil)); end
303
+
304
+ # Fails if <tt>exp == act</tt>.
305
+ #
306
+ # For floats use refute_in_delta.
307
+ def refute_equal(exp, act, msg = T.unsafe(nil)); end
308
+
309
+ # For comparing Floats. Fails if +exp+ is within +delta+ of +act+.
310
+ #
311
+ # refute_in_delta Math::PI, (22.0 / 7.0)
312
+ def refute_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end
313
+
314
+ # For comparing Floats. Fails if +exp+ and +act+ have a relative error
315
+ # less than +epsilon+.
316
+ def refute_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end
317
+
318
+ # Fails if +collection+ includes +obj+.
319
+ def refute_includes(collection, obj, msg = T.unsafe(nil)); end
320
+
321
+ # Fails if +obj+ is an instance of +cls+.
322
+ def refute_instance_of(cls, obj, msg = T.unsafe(nil)); end
323
+
324
+ # Fails if +obj+ is a kind of +cls+.
325
+ def refute_kind_of(cls, obj, msg = T.unsafe(nil)); end
326
+
327
+ # Fails if +matcher+ <tt>=~</tt> +obj+.
328
+ def refute_match(matcher, obj, msg = T.unsafe(nil)); end
329
+
330
+ # Fails if +obj+ is nil.
331
+ def refute_nil(obj, msg = T.unsafe(nil)); end
332
+
333
+ # Fails if +o1+ is not +op+ +o2+. Eg:
334
+ #
335
+ # refute_operator 1, :>, 2 #=> pass
336
+ # refute_operator 1, :<, 2 #=> fail
337
+ def refute_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end
338
+
339
+ # Fails if +path+ exists.
340
+ def refute_path_exists(path, msg = T.unsafe(nil)); end
341
+
342
+ # For testing with predicates.
343
+ #
344
+ # refute_predicate str, :empty?
345
+ #
346
+ # This is really meant for specs and is front-ended by refute_operator:
347
+ #
348
+ # str.wont_be :empty?
349
+ def refute_predicate(o1, op, msg = T.unsafe(nil)); end
350
+
351
+ # Fails if +obj+ responds to the message +meth+.
352
+ def refute_respond_to(obj, meth, msg = T.unsafe(nil)); end
353
+
354
+ # Fails if +exp+ is the same (by object identity) as +act+.
355
+ def refute_same(exp, act, msg = T.unsafe(nil)); end
356
+
357
+ # Skips the current run. If run in verbose-mode, the skipped run
358
+ # gets listed at the end of the run but doesn't cause a failure
359
+ # exit code.
360
+ #
361
+ # @raise [Minitest::Skip]
362
+ def skip(msg = T.unsafe(nil), bt = T.unsafe(nil)); end
363
+
364
+ # Skips the current run until a given date (in the local time
365
+ # zone). This allows you to put some fixes on hold until a later
366
+ # date, but still holds you accountable and prevents you from
367
+ # forgetting it.
368
+ def skip_until(y, m, d, msg); end
369
+
370
+ # Was this testcase skipped? Meant for #teardown.
371
+ #
372
+ # @return [Boolean]
373
+ def skipped?; end
374
+
375
+ # Returns things to diff [expect, butwas], or [nil, nil] if nothing to diff.
376
+ #
377
+ # Criterion:
378
+ #
379
+ # 1. Strings include newlines or escaped newlines, but not both.
380
+ # 2. or: String lengths are > 30 characters.
381
+ # 3. or: Strings are equal to each other (but maybe different encodings?).
382
+ # 4. and: we found a diff executable.
383
+ def things_to_diff(exp, act); end
384
+
385
+ class << self
386
+ # Returns the diff command to use in #diff. Tries to intelligently
387
+ # figure out what diff to use.
388
+ def diff; end
389
+
390
+ # Set the diff command to use in #diff.
391
+ def diff=(o); end
392
+ end
393
+ end
394
+
395
+ Minitest::Assertions::E = T.let(T.unsafe(nil), String)
396
+ Minitest::Assertions::UNDEFINED = T.let(T.unsafe(nil), Object)
397
+
398
+ # The standard backtrace filter for minitest.
399
+ #
400
+ # See Minitest.backtrace_filter=.
401
+ class Minitest::BacktraceFilter
402
+ # Filter +bt+ to something useful. Returns the whole thing if
403
+ # $DEBUG (ruby) or $MT_DEBUG (env).
404
+ def filter(bt); end
405
+ end
406
+
407
+ Minitest::BacktraceFilter::MT_RE = T.let(T.unsafe(nil), Regexp)
408
+
409
+ # Dispatch to multiple reporters as one.
410
+ class Minitest::CompositeReporter < ::Minitest::AbstractReporter
411
+ # @return [CompositeReporter] a new instance of CompositeReporter
412
+ def initialize(*reporters); end
413
+
414
+ # Add another reporter to the mix.
415
+ def <<(reporter); end
416
+
417
+ def io; end
418
+
419
+ # @return [Boolean]
420
+ def passed?; end
421
+
422
+ def prerecord(klass, name); end
423
+ def record(result); end
424
+ def report; end
425
+
426
+ # The list of reporters to dispatch to.
427
+ def reporters; end
428
+
429
+ # The list of reporters to dispatch to.
430
+ def reporters=(_arg0); end
431
+
432
+ def start; end
433
+ end
434
+
435
+ Minitest::ENCS = T.let(T.unsafe(nil), TrueClass)
436
+
437
+ # Provides a simple set of guards that you can use in your tests
438
+ # to skip execution if it is not applicable. These methods are
439
+ # mixed into Test as both instance and class methods so you
440
+ # can use them inside or outside of the test methods.
441
+ #
442
+ # def test_something_for_mri
443
+ # skip "bug 1234" if jruby?
444
+ # # ...
445
+ # end
446
+ #
447
+ # if windows? then
448
+ # # ... lots of test methods ...
449
+ # end
450
+ module Minitest::Guard
451
+ # Is this running on jruby?
452
+ #
453
+ # @return [Boolean]
454
+ def jruby?(platform = T.unsafe(nil)); end
455
+
456
+ # Is this running on maglev?
457
+ #
458
+ # @return [Boolean]
459
+ def maglev?(platform = T.unsafe(nil)); end
460
+
461
+ # Is this running on mri?
462
+ #
463
+ # @return [Boolean]
464
+ def mri?(platform = T.unsafe(nil)); end
465
+
466
+ # Is this running on macOS?
467
+ #
468
+ # @return [Boolean]
469
+ def osx?(platform = T.unsafe(nil)); end
470
+
471
+ # Is this running on rubinius?
472
+ #
473
+ # @return [Boolean]
474
+ def rubinius?(platform = T.unsafe(nil)); end
475
+
476
+ # Is this running on windows?
477
+ #
478
+ # @return [Boolean]
479
+ def windows?(platform = T.unsafe(nil)); end
480
+ end
481
+
482
+ module Minitest::Parallel; end
483
+
484
+ # The engine used to run multiple tests in parallel.
485
+ class Minitest::Parallel::Executor
486
+ # Create a parallel test executor of with +size+ workers.
487
+ #
488
+ # @return [Executor] a new instance of Executor
489
+ def initialize(size); end
490
+
491
+ # Add a job to the queue
492
+ def <<(work); end
493
+
494
+ # Shuts down the pool of workers by signalling them to quit and
495
+ # waiting for them all to finish what they're currently working
496
+ # on.
497
+ def shutdown; end
498
+
499
+ # The size of the pool of workers.
500
+ def size; end
501
+
502
+ # Start the executor
503
+ def start; end
504
+ end
505
+
506
+ module Minitest::Parallel::Test
507
+ def _synchronize; end
508
+ end
509
+
510
+ module Minitest::Parallel::Test::ClassMethods
511
+ def run_one_method(klass, method_name, reporter); end
512
+ def test_order; end
513
+ end
514
+
515
+ # A very simple reporter that prints the "dots" during the run.
516
+ #
517
+ # This is added to the top-level CompositeReporter at the start of
518
+ # the run. If you want to change the output of minitest via a
519
+ # plugin, pull this out of the composite and replace it with your
520
+ # own.
521
+ class Minitest::ProgressReporter < ::Minitest::Reporter
522
+ def prerecord(klass, name); end
523
+ def record(result); end
524
+ end
525
+
526
+ # Shared code for anything that can get passed to a Reporter. See
527
+ # Minitest::Test & Minitest::Result.
528
+ module Minitest::Reportable
529
+ # @raise [NotImplementedError]
530
+ def class_name; end
531
+
532
+ # Did this run error?
533
+ #
534
+ # @return [Boolean]
535
+ def error?; end
536
+
537
+ # The location identifier of this test. Depends on a method
538
+ # existing called class_name.
539
+ def location; end
540
+
541
+ # Did this run pass?
542
+ #
543
+ # Note: skipped runs are not considered passing, but they don't
544
+ # cause the process to exit non-zero.
545
+ #
546
+ # @return [Boolean]
547
+ def passed?; end
548
+
549
+ # Returns ".", "F", or "E" based on the result of the run.
550
+ def result_code; end
551
+
552
+ # Was this run skipped?
553
+ #
554
+ # @return [Boolean]
555
+ def skipped?; end
556
+ end
557
+
558
+ class Minitest::Reporter < ::Minitest::AbstractReporter
559
+ # @return [Reporter] a new instance of Reporter
560
+ def initialize(io = T.unsafe(nil), options = T.unsafe(nil)); end
561
+
562
+ # The IO used to report.
563
+ def io; end
564
+
565
+ # The IO used to report.
566
+ def io=(_arg0); end
567
+
568
+ # Command-line options for this run.
569
+ def options; end
570
+
571
+ # Command-line options for this run.
572
+ def options=(_arg0); end
573
+ end
574
+
575
+ # This represents a test result in a clean way that can be
576
+ # marshalled over a wire. Tests can do anything they want to the
577
+ # test instance and can create conditions that cause Marshal.dump to
578
+ # blow up. By using Result.from(a_test) you can be reasonably sure
579
+ # that the test result can be marshalled.
580
+ class Minitest::Result < ::Minitest::Runnable
581
+ include ::Minitest::Reportable
582
+
583
+ def class_name; end
584
+
585
+ # The class name of the test result.
586
+ def klass; end
587
+
588
+ # The class name of the test result.
589
+ def klass=(_arg0); end
590
+
591
+ # The location of the test method.
592
+ def source_location; end
593
+
594
+ # The location of the test method.
595
+ def source_location=(_arg0); end
596
+
597
+ def to_s; end
598
+
599
+ class << self
600
+ # Create a new test result from a Runnable instance.
601
+ def from(runnable); end
602
+ end
603
+ end
604
+
605
+ # re-open
606
+ class Minitest::Runnable
607
+ # @return [Runnable] a new instance of Runnable
608
+ def initialize(name); end
609
+
610
+ # Number of assertions executed in this run.
611
+ def assertions; end
612
+
613
+ # Number of assertions executed in this run.
614
+ def assertions=(_arg0); end
615
+
616
+ def failure; end
617
+
618
+ # An assertion raised during the run, if any.
619
+ def failures; end
620
+
621
+ # An assertion raised during the run, if any.
622
+ def failures=(_arg0); end
623
+
624
+ def marshal_dump; end
625
+ def marshal_load(ary); end
626
+
627
+ # Name of the run.
628
+ def name; end
629
+
630
+ # Set the name of the run.
631
+ def name=(o); end
632
+
633
+ # Did this run pass?
634
+ #
635
+ # Note: skipped runs are not considered passing, but they don't
636
+ # cause the process to exit non-zero.
637
+ #
638
+ # @raise [NotImplementedError]
639
+ # @return [Boolean]
640
+ def passed?; end
641
+
642
+ # Returns a single character string to print based on the result
643
+ # of the run. One of <tt>"."</tt>, <tt>"F"</tt>,
644
+ # <tt>"E"</tt> or <tt>"S"</tt>.
645
+ #
646
+ # @raise [NotImplementedError]
647
+ def result_code; end
648
+
649
+ # Runs a single method. Needs to return self.
650
+ #
651
+ # @raise [NotImplementedError]
652
+ def run; end
653
+
654
+ # Was this run skipped? See #passed? for more information.
655
+ #
656
+ # @raise [NotImplementedError]
657
+ # @return [Boolean]
658
+ def skipped?; end
659
+
660
+ # The time it took to run.
661
+ def time; end
662
+
663
+ # The time it took to run.
664
+ def time=(_arg0); end
665
+
666
+ def time_it; end
667
+
668
+ class << self
669
+ def inherited(klass); end
670
+
671
+ # Returns all instance methods matching the pattern +re+.
672
+ def methods_matching(re); end
673
+
674
+ def on_signal(name, action); end
675
+ def reset; end
676
+
677
+ # Responsible for running all runnable methods in a given class,
678
+ # each in its own instance. Each instance is passed to the
679
+ # reporter to record.
680
+ def run(reporter, options = T.unsafe(nil)); end
681
+
682
+ # Runs a single method and has the reporter record the result.
683
+ # This was considered internal API but is factored out of run so
684
+ # that subclasses can specialize the running of an individual
685
+ # test. See Minitest::ParallelTest::ClassMethods for an example.
686
+ def run_one_method(klass, method_name, reporter); end
687
+
688
+ # Each subclass of Runnable is responsible for overriding this
689
+ # method to return all runnable methods. See #methods_matching.
690
+ #
691
+ # @raise [NotImplementedError]
692
+ def runnable_methods; end
693
+
694
+ # Returns all subclasses of Runnable.
695
+ def runnables; end
696
+
697
+ def with_info_handler(reporter, &block); end
698
+ end
699
+ end
700
+
701
+ Minitest::Runnable::SIGNALS = T.let(T.unsafe(nil), Hash)
702
+
703
+ # Assertion raised when skipping a run.
704
+ class Minitest::Skip < ::Minitest::Assertion
705
+ def result_label; end
706
+ end
707
+
708
+ # A reporter that gathers statistics about a test run. Does not do
709
+ # any IO because meant to be used as a parent class for a reporter
710
+ # that does.
711
+ #
712
+ # If you want to create an entirely different type of output (eg,
713
+ # CI, HTML, etc), this is the place to start.
714
+ #
715
+ # Example:
716
+ #
717
+ # class JenkinsCIReporter < StatisticsReporter
718
+ # def report
719
+ # super # Needed to calculate some statistics
720
+ #
721
+ # print "<testsuite "
722
+ # print "tests='#{count}' "
723
+ # print "failures='#{failures}' "
724
+ # # Remaining XML...
725
+ # end
726
+ # end
727
+ class Minitest::StatisticsReporter < ::Minitest::Reporter
728
+ # @return [StatisticsReporter] a new instance of StatisticsReporter
729
+ def initialize(io = T.unsafe(nil), options = T.unsafe(nil)); end
730
+
731
+ # Total number of assertions.
732
+ def assertions; end
733
+
734
+ # Total number of assertions.
735
+ def assertions=(_arg0); end
736
+
737
+ # Total number of test cases.
738
+ def count; end
739
+
740
+ # Total number of test cases.
741
+ def count=(_arg0); end
742
+
743
+ # Total number of tests that erred.
744
+ def errors; end
745
+
746
+ # Total number of tests that erred.
747
+ def errors=(_arg0); end
748
+
749
+ # Total number of tests that failed.
750
+ def failures; end
751
+
752
+ # Total number of tests that failed.
753
+ def failures=(_arg0); end
754
+
755
+ # @return [Boolean]
756
+ def passed?; end
757
+
758
+ def record(result); end
759
+
760
+ # Report on the tracked statistics.
761
+ def report; end
762
+
763
+ # An +Array+ of test cases that failed or were skipped.
764
+ def results; end
765
+
766
+ # An +Array+ of test cases that failed or were skipped.
767
+ def results=(_arg0); end
768
+
769
+ # Total number of tests that where skipped.
770
+ def skips; end
771
+
772
+ # Total number of tests that where skipped.
773
+ def skips=(_arg0); end
774
+
775
+ def start; end
776
+
777
+ # Time the test run started. If available, the monotonic clock is
778
+ # used and this is a +Float+, otherwise it's an instance of
779
+ # +Time+.
780
+ def start_time; end
781
+
782
+ # Time the test run started. If available, the monotonic clock is
783
+ # used and this is a +Float+, otherwise it's an instance of
784
+ # +Time+.
785
+ def start_time=(_arg0); end
786
+
787
+ # Test run time. If available, the monotonic clock is used and
788
+ # this is a +Float+, otherwise it's an instance of +Time+.
789
+ def total_time; end
790
+
791
+ # Test run time. If available, the monotonic clock is used and
792
+ # this is a +Float+, otherwise it's an instance of +Time+.
793
+ def total_time=(_arg0); end
794
+ end
795
+
796
+ # A reporter that prints the header, summary, and failure details at
797
+ # the end of the run.
798
+ #
799
+ # This is added to the top-level CompositeReporter at the start of
800
+ # the run. If you want to change the output of minitest via a
801
+ # plugin, pull this out of the composite and replace it with your
802
+ # own.
803
+ class Minitest::SummaryReporter < ::Minitest::StatisticsReporter
804
+ def aggregated_results(io); end
805
+
806
+ # Returns the value of attribute old_sync.
807
+ def old_sync; end
808
+
809
+ # Sets the attribute old_sync
810
+ #
811
+ # @param value the value to set the attribute old_sync to.
812
+ def old_sync=(_arg0); end
813
+
814
+ def report; end
815
+
816
+ # :startdoc:
817
+ def start; end
818
+
819
+ def statistics; end
820
+ def summary; end
821
+
822
+ # :stopdoc:
823
+ def sync; end
824
+
825
+ # :stopdoc:
826
+ def sync=(_arg0); end
827
+
828
+ def to_s; end
829
+
830
+ private
831
+
832
+ def binary_string; end
833
+ end
834
+
835
+ # Subclass Test to create your own tests. Typically you'll want a
836
+ # Test subclass per implementation class.
837
+ #
838
+ # See Minitest::Assertions
839
+ class Minitest::Test < ::Minitest::Runnable
840
+ include ::Minitest::Assertions
841
+ include ::Minitest::Reportable
842
+ include ::Minitest::Test::LifecycleHooks
843
+ include ::Minitest::Guard
844
+ extend ::Minitest::Guard
845
+
846
+ # LifecycleHooks
847
+ def capture_exceptions; end
848
+
849
+ def class_name; end
850
+
851
+ # Runs a single test with setup/teardown hooks.
852
+ def run; end
853
+
854
+ def sanitize_exception(e); end
855
+ def with_info_handler(&block); end
856
+
857
+ class << self
858
+ # Call this at the top of your tests when you absolutely
859
+ # positively need to have ordered tests. In doing so, you're
860
+ # admitting that you suck and your tests are weak.
861
+ def i_suck_and_my_tests_are_order_dependent!; end
862
+
863
+ # Returns the value of attribute io_lock.
864
+ def io_lock; end
865
+
866
+ # Sets the attribute io_lock
867
+ #
868
+ # @param value the value to set the attribute io_lock to.
869
+ def io_lock=(_arg0); end
870
+
871
+ # Make diffs for this Test use #pretty_inspect so that diff
872
+ # in assert_equal can have more details. NOTE: this is much slower
873
+ # than the regular inspect but much more usable for complex
874
+ # objects.
875
+ def make_my_diffs_pretty!; end
876
+
877
+ # Call this at the top of your tests when you want to run your
878
+ # tests in parallel. In doing so, you're admitting that you rule
879
+ # and your tests are awesome.
880
+ def parallelize_me!; end
881
+
882
+ # Returns all instance methods starting with "test_". Based on
883
+ # #test_order, the methods are either sorted, randomized
884
+ # (default), or run in parallel.
885
+ def runnable_methods; end
886
+
887
+ # Defines the order to run tests (:random by default). Override
888
+ # this or use a convenience method to change it for your tests.
889
+ def test_order; end
890
+ end
891
+ end
892
+
893
+ # Provides before/after hooks for setup and teardown. These are
894
+ # meant for library writers, NOT for regular test authors. See
895
+ # #before_setup for an example.
896
+ module Minitest::Test::LifecycleHooks
897
+ # Runs before every test, after setup. This hook is meant for
898
+ # libraries to extend minitest. It is not meant to be used by
899
+ # test developers.
900
+ #
901
+ # See #before_setup for an example.
902
+ def after_setup; end
903
+
904
+ # Runs after every test, after teardown. This hook is meant for
905
+ # libraries to extend minitest. It is not meant to be used by
906
+ # test developers.
907
+ #
908
+ # See #before_setup for an example.
909
+ def after_teardown; end
910
+
911
+ # Runs before every test, before setup. This hook is meant for
912
+ # libraries to extend minitest. It is not meant to be used by
913
+ # test developers.
914
+ #
915
+ # As a simplistic example:
916
+ #
917
+ # module MyMinitestPlugin
918
+ # def before_setup
919
+ # super
920
+ # # ... stuff to do before setup is run
921
+ # end
922
+ #
923
+ # def after_setup
924
+ # # ... stuff to do after setup is run
925
+ # super
926
+ # end
927
+ #
928
+ # def before_teardown
929
+ # super
930
+ # # ... stuff to do before teardown is run
931
+ # end
932
+ #
933
+ # def after_teardown
934
+ # # ... stuff to do after teardown is run
935
+ # super
936
+ # end
937
+ # end
938
+ #
939
+ # class MiniTest::Test
940
+ # include MyMinitestPlugin
941
+ # end
942
+ def before_setup; end
943
+
944
+ # Runs after every test, before teardown. This hook is meant for
945
+ # libraries to extend minitest. It is not meant to be used by
946
+ # test developers.
947
+ #
948
+ # See #before_setup for an example.
949
+ def before_teardown; end
950
+
951
+ # Runs before every test. Use this to set up before each test
952
+ # run.
953
+ def setup; end
954
+
955
+ # Runs after every test. Use this to clean up after each test
956
+ # run.
957
+ def teardown; end
958
+ end
959
+
960
+ Minitest::Test::PASSTHROUGH_EXCEPTIONS = T.let(T.unsafe(nil), Array)
961
+ Minitest::Test::TEARDOWN_METHODS = T.let(T.unsafe(nil), Array)
962
+
963
+ # Assertion wrapping an unexpected error that was raised during a run.
964
+ class Minitest::UnexpectedError < ::Minitest::Assertion
965
+ # @return [UnexpectedError] a new instance of UnexpectedError
966
+ def initialize(error); end
967
+
968
+ def backtrace; end
969
+
970
+ # TODO: figure out how to use `cause` instead
971
+ def error; end
972
+
973
+ # TODO: figure out how to use `cause` instead
974
+ def error=(_arg0); end
975
+
976
+ def message; end
977
+ def result_label; end
978
+ end
979
+
980
+ class Minitest::Unit
981
+ class << self
982
+ def after_tests(&b); end
983
+ def autorun; end
984
+ end
985
+ end
986
+
987
+ class Minitest::Unit::TestCase < ::Minitest::Test
988
+ class << self
989
+ def inherited(klass); end
990
+ end
991
+ end
992
+
993
+ Minitest::Unit::VERSION = T.let(T.unsafe(nil), String)
994
+ Minitest::VERSION = T.let(T.unsafe(nil), String)