rbs 2.5.1 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +1 -1
  3. data/.github/workflows/ruby.yml +3 -3
  4. data/CHANGELOG.md +44 -0
  5. data/Gemfile.lock +5 -5
  6. data/Rakefile +6 -38
  7. data/Steepfile +6 -2
  8. data/core/constants.rbs +1 -1
  9. data/core/env.rbs +1 -1323
  10. data/core/global_variables.rbs +1 -1
  11. data/core/hash.rbs +3 -3
  12. data/core/kernel.rbs +2 -2
  13. data/core/random.rbs +5 -220
  14. data/core/rational.rbs +3 -3
  15. data/core/rbs/unnamed/argf.rbs +965 -0
  16. data/core/rbs/unnamed/env_class.rbs +1325 -0
  17. data/core/rbs/unnamed/random.rbs +270 -0
  18. data/core/regexp.rbs +2 -3
  19. data/docs/CONTRIBUTING.md +2 -2
  20. data/ext/rbs_extension/lexer.c +1343 -1353
  21. data/ext/rbs_extension/lexer.re +2 -2
  22. data/ext/rbs_extension/rbs_extension.h +1 -1
  23. data/ext/rbs_extension/unescape.c +17 -10
  24. data/lib/rbs/ast/members.rb +6 -3
  25. data/lib/rbs/cli.rb +2 -0
  26. data/lib/rbs/factory.rb +2 -0
  27. data/lib/rbs/prototype/helpers.rb +1 -5
  28. data/lib/rbs/prototype/rb.rb +105 -56
  29. data/lib/rbs/prototype/rbi.rb +65 -30
  30. data/lib/rbs/prototype/runtime.rb +4 -3
  31. data/lib/rbs/test/setup_helper.rb +6 -1
  32. data/lib/rbs/version.rb +1 -1
  33. data/schema/members.json +4 -1
  34. data/sig/collection/config.rbs +3 -0
  35. data/sig/factory.rbs +5 -0
  36. data/sig/prototype/helpers.rbs +23 -0
  37. data/sig/prototype/rb.rbs +84 -0
  38. data/sig/prototype/rbi.rbs +73 -0
  39. data/sig/shims/abstract_syntax_tree.rbs +25 -0
  40. data/sig/shims/enumerable.rbs +5 -0
  41. data/sig/shims/pp.rbs +3 -0
  42. data/sig/shims/ripper.rbs +8 -0
  43. data/stdlib/cgi/0/manifest.yaml +2 -0
  44. data/stdlib/date/0/time.rbs +26 -0
  45. data/stdlib/etc/0/etc.rbs +745 -0
  46. data/stdlib/minitest/0/kernel.rbs +42 -0
  47. data/stdlib/minitest/0/manifest.yaml +2 -0
  48. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +49 -0
  49. data/stdlib/minitest/0/minitest/assertion.rbs +16 -0
  50. data/stdlib/minitest/0/minitest/assertions.rbs +545 -0
  51. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +16 -0
  52. data/stdlib/minitest/0/minitest/bench_spec.rbs +102 -0
  53. data/stdlib/minitest/0/minitest/benchmark.rbs +258 -0
  54. data/stdlib/minitest/0/minitest/composite_reporter.rbs +25 -0
  55. data/stdlib/minitest/0/minitest/expectation.rbs +2 -0
  56. data/stdlib/minitest/0/minitest/expectations.rbs +21 -0
  57. data/stdlib/minitest/0/minitest/guard.rbs +64 -0
  58. data/stdlib/minitest/0/minitest/mock.rbs +60 -0
  59. data/stdlib/minitest/0/minitest/parallel/executor.rbs +42 -0
  60. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +6 -0
  61. data/stdlib/minitest/0/minitest/parallel/test.rbs +3 -0
  62. data/stdlib/minitest/0/minitest/parallel.rbs +2 -0
  63. data/stdlib/minitest/0/minitest/pride_io.rbs +54 -0
  64. data/stdlib/minitest/0/minitest/pride_lol.rbs +17 -0
  65. data/stdlib/minitest/0/minitest/progress_reporter.rbs +11 -0
  66. data/stdlib/minitest/0/minitest/reportable.rbs +51 -0
  67. data/stdlib/minitest/0/minitest/reporter.rbs +5 -0
  68. data/stdlib/minitest/0/minitest/result.rbs +28 -0
  69. data/stdlib/minitest/0/minitest/runnable.rbs +131 -0
  70. data/stdlib/minitest/0/minitest/skip.rbs +6 -0
  71. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +48 -0
  72. data/stdlib/minitest/0/minitest/spec/dsl.rbs +125 -0
  73. data/stdlib/minitest/0/minitest/spec.rbs +11 -0
  74. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +76 -0
  75. data/stdlib/minitest/0/minitest/summary_reporter.rbs +25 -0
  76. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +92 -0
  77. data/stdlib/minitest/0/minitest/test.rbs +76 -0
  78. data/stdlib/minitest/0/minitest/unexpected_error.rbs +10 -0
  79. data/stdlib/minitest/0/minitest/unit/test_case.rbs +3 -0
  80. data/stdlib/minitest/0/minitest/unit.rbs +5 -0
  81. data/stdlib/minitest/0/minitest.rbs +966 -0
  82. data/stdlib/rubygems/0/errors.rbs +113 -0
  83. metadata +54 -4
  84. data/lib/rbs/char_scanner.rb +0 -20
@@ -0,0 +1,51 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # Shared code for anything that can get passed to a Reporter. See Minitest::Test
3
+ # & Minitest::Result.
4
+ #
5
+ module Minitest::Reportable
6
+ # <!--
7
+ # rdoc-file=lib/minitest.rb
8
+ # - passed?()
9
+ # -->
10
+ # Did this run pass?
11
+ #
12
+ # Note: skipped runs are not considered passing, but they don't cause the
13
+ # process to exit non-zero.
14
+ #
15
+ def passed?: () -> untyped
16
+
17
+ # <!--
18
+ # rdoc-file=lib/minitest.rb
19
+ # - location()
20
+ # -->
21
+ # The location identifier of this test. Depends on a method existing called
22
+ # class_name.
23
+ #
24
+ def location: () -> ::String
25
+
26
+ def class_name: () -> untyped
27
+
28
+ # <!--
29
+ # rdoc-file=lib/minitest.rb
30
+ # - result_code()
31
+ # -->
32
+ # Returns ".", "F", or "E" based on the result of the run.
33
+ #
34
+ def result_code: () -> untyped
35
+
36
+ # <!--
37
+ # rdoc-file=lib/minitest.rb
38
+ # - skipped?()
39
+ # -->
40
+ # Was this run skipped?
41
+ #
42
+ def skipped?: () -> untyped
43
+
44
+ # <!--
45
+ # rdoc-file=lib/minitest.rb
46
+ # - error?()
47
+ # -->
48
+ # Did this run error?
49
+ #
50
+ def error?: () -> untyped
51
+ end
@@ -0,0 +1,5 @@
1
+ class Minitest::Reporter < ::Minitest::AbstractReporter
2
+ def initialize: (?untyped io, ?::Hash[untyped, untyped] options) -> void
3
+ attr_accessor io: untyped
4
+ attr_accessor options: untyped
5
+ end
@@ -0,0 +1,28 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # This represents a test result in a clean way that can be marshalled over a
3
+ # wire. Tests can do anything they want to the test instance and can create
4
+ # conditions that cause Marshal.dump to blow up. By using Result.from(a_test)
5
+ # you can be reasonably sure that the test result can be marshalled.
6
+ #
7
+ class Minitest::Result < ::Minitest::Runnable
8
+ # <!--
9
+ # rdoc-file=lib/minitest.rb
10
+ # - from(runnable)
11
+ # -->
12
+ # Create a new test result from a Runnable instance.
13
+ #
14
+ def self.from: (untyped runnable) -> untyped
15
+ def class_name: () -> untyped
16
+ def to_s: () -> untyped
17
+
18
+ # <!-- rdoc-file=lib/minitest.rb -->
19
+ # The class name of the test result.
20
+ #
21
+ attr_accessor klass: untyped
22
+
23
+ # <!-- rdoc-file=lib/minitest.rb -->
24
+ # The location of the test method.
25
+ #
26
+ attr_accessor source_location: untyped
27
+ include Minitest::Reportable
28
+ end
@@ -0,0 +1,131 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # Represents anything "runnable", like Test, Spec, Benchmark, or whatever you
3
+ # can dream up.
4
+ #
5
+ # Subclasses of this are automatically registered and available in
6
+ # Runnable.runnables.
7
+ #
8
+ class Minitest::Runnable
9
+ def time_it: () { () -> untyped } -> untyped
10
+
11
+ # <!--
12
+ # rdoc-file=lib/minitest.rb
13
+ # - name()
14
+ # -->
15
+ # Name of the run.
16
+ #
17
+ def name: () -> untyped
18
+
19
+ # <!--
20
+ # rdoc-file=lib/minitest.rb
21
+ # - name=(o)
22
+ # -->
23
+ # Set the name of the run.
24
+ #
25
+ def name=: (untyped o) -> untyped
26
+
27
+ # <!--
28
+ # rdoc-file=lib/minitest.rb
29
+ # - methods_matching(re)
30
+ # -->
31
+ # Returns all instance methods matching the pattern `re`.
32
+ #
33
+ def self.methods_matching: (untyped re) -> untyped
34
+ def self.reset: () -> untyped
35
+
36
+ # <!--
37
+ # rdoc-file=lib/minitest.rb
38
+ # - run(reporter, options = {})
39
+ # -->
40
+ # Responsible for running all runnable methods in a given class, each in its own
41
+ # instance. Each instance is passed to the reporter to record.
42
+ #
43
+ def self.run: (untyped reporter, ?::Hash[untyped, untyped] options) -> (nil | untyped)
44
+
45
+ # <!--
46
+ # rdoc-file=lib/minitest.rb
47
+ # - run_one_method(klass, method_name, reporter)
48
+ # -->
49
+ # Runs a single method and has the reporter record the result. This was
50
+ # considered internal API but is factored out of run so that subclasses can
51
+ # specialize the running of an individual test. See
52
+ # Minitest::ParallelTest::ClassMethods for an example.
53
+ #
54
+ def self.run_one_method: (untyped klass, untyped method_name, untyped reporter) -> untyped
55
+ def self.with_info_handler: (untyped reporter) ?{ () -> untyped } -> untyped
56
+ def self.on_signal: (untyped name, untyped action) { () -> untyped } -> untyped
57
+
58
+ # <!--
59
+ # rdoc-file=lib/minitest.rb
60
+ # - runnable_methods()
61
+ # -->
62
+ # Each subclass of Runnable is responsible for overriding this method to return
63
+ # all runnable methods. See #methods_matching.
64
+ #
65
+ def self.runnable_methods: () -> untyped
66
+
67
+ # <!--
68
+ # rdoc-file=lib/minitest.rb
69
+ # - runnables()
70
+ # -->
71
+ # Returns all subclasses of Runnable.
72
+ #
73
+ def self.runnables: () -> untyped
74
+ def marshal_dump: () -> ::Array[untyped]
75
+ def marshal_load: (untyped ary) -> untyped
76
+ def failure: () -> untyped
77
+ def initialize: (untyped name) -> void
78
+
79
+ # <!--
80
+ # rdoc-file=lib/minitest.rb
81
+ # - run()
82
+ # -->
83
+ # Runs a single method. Needs to return self.
84
+ #
85
+ def run: () -> untyped
86
+
87
+ # <!--
88
+ # rdoc-file=lib/minitest.rb
89
+ # - passed?()
90
+ # -->
91
+ # Did this run pass?
92
+ #
93
+ # Note: skipped runs are not considered passing, but they don't cause the
94
+ # process to exit non-zero.
95
+ #
96
+ def passed?: () -> untyped
97
+
98
+ # <!--
99
+ # rdoc-file=lib/minitest.rb
100
+ # - result_code()
101
+ # -->
102
+ # Returns a single character string to print based on the result of the run. One
103
+ # of `"."`, `"F"`, `"E"` or `"S"`.
104
+ #
105
+ def result_code: () -> untyped
106
+
107
+ # <!--
108
+ # rdoc-file=lib/minitest.rb
109
+ # - skipped?()
110
+ # -->
111
+ # Was this run skipped? See #passed? for more information.
112
+ #
113
+ def skipped?: () -> untyped
114
+ def self.inherited: (untyped klass) -> untyped
115
+
116
+ # <!-- rdoc-file=lib/minitest.rb -->
117
+ # Number of assertions executed in this run.
118
+ #
119
+ attr_accessor assertions: untyped
120
+
121
+ # <!-- rdoc-file=lib/minitest.rb -->
122
+ # An assertion raised during the run, if any.
123
+ #
124
+ attr_accessor failures: untyped
125
+
126
+ # <!-- rdoc-file=lib/minitest.rb -->
127
+ # The time it took to run.
128
+ #
129
+ attr_accessor time: untyped
130
+ SIGNALS: Hash[String, Integer]
131
+ end
@@ -0,0 +1,6 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # Assertion raised when skipping a run.
3
+ #
4
+ class Minitest::Skip < ::Minitest::Assertion
5
+ def result_label: () -> "Skipped"
6
+ end
@@ -0,0 +1,48 @@
1
+ # <!-- rdoc-file=lib/minitest/spec.rb -->
2
+ # Rdoc... why are you so dumb?
3
+ #
4
+ module Minitest::Spec::DSL::InstanceMethods
5
+ # <!--
6
+ # rdoc-file=lib/minitest/spec.rb
7
+ # - _(value = nil, &block)
8
+ # -->
9
+ # Takes a value or a block and returns a value monad that has all of
10
+ # Expectations methods available to it.
11
+ #
12
+ # _(1 + 1).must_equal 2
13
+ #
14
+ # And for blocks:
15
+ #
16
+ # _ { 1 + "1" }.must_raise TypeError
17
+ #
18
+ # This method of expectation-based testing is preferable to straight-expectation
19
+ # methods (on Object) because it stores its test context, bypassing our hacky
20
+ # use of thread-local variables.
21
+ #
22
+ # NOTE: At some point, the methods on Object will be deprecated and then
23
+ # removed.
24
+ #
25
+ # It is also aliased to #value and #expect for your aesthetic pleasure:
26
+ #
27
+ # _(1 + 1).must_equal 2
28
+ # value(1 + 1).must_equal 2
29
+ # expect(1 + 1).must_equal 2
30
+ #
31
+ def _: (?untyped? value) ?{ () -> untyped } -> untyped
32
+
33
+ # <!--
34
+ # rdoc-file=lib/minitest/spec.rb
35
+ # - value(value = nil, &block)
36
+ # -->
37
+ #
38
+ alias value _
39
+
40
+ # <!--
41
+ # rdoc-file=lib/minitest/spec.rb
42
+ # - expect(value = nil, &block)
43
+ # -->
44
+ #
45
+ alias expect _
46
+
47
+ def before_setup: () -> untyped
48
+ end
@@ -0,0 +1,125 @@
1
+ # <!-- rdoc-file=lib/minitest/spec.rb -->
2
+ # Oh look! A Minitest::Spec::DSL module! Eat your heart out DHH.
3
+ #
4
+ module Minitest::Spec::DSL
5
+ # <!--
6
+ # rdoc-file=lib/minitest/spec.rb
7
+ # - register_spec_type(*args, &block)
8
+ # -->
9
+ # Register a new type of spec that matches the spec's description. This method
10
+ # can take either a Regexp and a spec class or a spec class and a block that
11
+ # takes the description and returns true if it matches.
12
+ #
13
+ # Eg:
14
+ #
15
+ # register_spec_type(/Controller$/, Minitest::Spec::Rails)
16
+ #
17
+ # or:
18
+ #
19
+ # register_spec_type(Minitest::Spec::RailsModel) do |desc|
20
+ # desc.superclass == ActiveRecord::Base
21
+ # end
22
+ #
23
+ def register_spec_type: (*untyped args) ?{ () -> untyped } -> untyped
24
+
25
+ # <!--
26
+ # rdoc-file=lib/minitest/spec.rb
27
+ # - spec_type(desc, *additional)
28
+ # -->
29
+ # Figure out the spec class to use based on a spec's description. Eg:
30
+ #
31
+ # spec_type("BlahController") # => Minitest::Spec::Rails
32
+ #
33
+ def spec_type: (untyped desc, *untyped additional) -> untyped
34
+
35
+ def describe_stack: () -> untyped
36
+
37
+ def children: () -> untyped
38
+
39
+ def nuke_test_methods!: () -> untyped
40
+
41
+ # <!--
42
+ # rdoc-file=lib/minitest/spec.rb
43
+ # - before(_type = nil, &block)
44
+ # -->
45
+ # Define a 'before' action. Inherits the way normal methods should.
46
+ #
47
+ # NOTE: `type` is ignored and is only there to make porting easier.
48
+ #
49
+ # Equivalent to Minitest::Test#setup.
50
+ #
51
+ def before: (?untyped? _type) ?{ () -> untyped } -> untyped
52
+
53
+ # <!--
54
+ # rdoc-file=lib/minitest/spec.rb
55
+ # - after(_type = nil, &block)
56
+ # -->
57
+ # Define an 'after' action. Inherits the way normal methods should.
58
+ #
59
+ # NOTE: `type` is ignored and is only there to make porting easier.
60
+ #
61
+ # Equivalent to Minitest::Test#teardown.
62
+ #
63
+ def after: (?untyped? _type) ?{ () -> untyped } -> untyped
64
+
65
+ # <!--
66
+ # rdoc-file=lib/minitest/spec.rb
67
+ # - it(desc = "anonymous", &block)
68
+ # -->
69
+ # Define an expectation with name `desc`. Name gets morphed to a proper test
70
+ # method name. For some freakish reason, people who write specs don't like class
71
+ # inheritance, so this goes way out of its way to make sure that expectations
72
+ # aren't inherited.
73
+ #
74
+ # This is also aliased to #specify and doesn't require a `desc` arg.
75
+ #
76
+ # Hint: If you *do* want inheritance, use minitest/test. You can mix and match
77
+ # between assertions and expectations as much as you want.
78
+ #
79
+ def it: (?::String desc) ?{ () -> untyped } -> untyped
80
+
81
+ # <!--
82
+ # rdoc-file=lib/minitest/spec.rb
83
+ # - let(name, &block)
84
+ # -->
85
+ # Essentially, define an accessor for `name` with `block`.
86
+ #
87
+ # Why use let instead of def? I honestly don't know.
88
+ #
89
+ def let: (untyped name) ?{ () -> untyped } -> untyped
90
+
91
+ # <!--
92
+ # rdoc-file=lib/minitest/spec.rb
93
+ # - subject(&block)
94
+ # -->
95
+ # Another lazy man's accessor generator. Made even more lazy by setting the name
96
+ # for you to `subject`.
97
+ #
98
+ def subject: () ?{ () -> untyped } -> untyped
99
+
100
+ def create: (untyped name, untyped desc) -> untyped
101
+
102
+ def name: () -> untyped
103
+
104
+ def to_s: () -> untyped
105
+
106
+ # <!--
107
+ # rdoc-file=lib/minitest/spec.rb
108
+ # - specify(desc = "anonymous", &block)
109
+ # -->
110
+ #
111
+ alias specify it
112
+
113
+ def self.extended: (untyped obj) -> untyped
114
+
115
+ attr_reader desc: untyped
116
+
117
+ # <!-- rdoc-file=lib/minitest/spec.rb -->
118
+ # Contains pairs of matchers and Spec classes to be used to calculate the
119
+ # superclass of a top-level describe. This allows for automatically customizable
120
+ # spec types.
121
+ #
122
+ # See: register_spec_type and spec_type
123
+ #
124
+ TYPES: Array[Array[Regexp | singleton(Minitest::BenchSpec)] | Array[Regexp | singleton(Minitest::Spec)]]
125
+ end
@@ -0,0 +1,11 @@
1
+ # <!-- rdoc-file=lib/minitest/spec.rb -->
2
+ # Minitest::Spec -- The faster, better, less-magical spec framework!
3
+ #
4
+ # For a list of expectations, see Minitest::Expectations.
5
+ #
6
+ class Minitest::Spec < ::Minitest::Test
7
+ def self.current: () -> untyped
8
+ def initialize: (untyped name) -> void
9
+ include Minitest::Spec::DSL::InstanceMethods
10
+ extend Minitest::Spec::DSL
11
+ end
@@ -0,0 +1,76 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # A reporter that gathers statistics about a test run. Does not do any IO
3
+ # because meant to be used as a parent class for a reporter that does.
4
+ #
5
+ # If you want to create an entirely different type of output (eg, CI, HTML,
6
+ # etc), this is the place to start.
7
+ #
8
+ # Example:
9
+ #
10
+ # class JenkinsCIReporter < StatisticsReporter
11
+ # def report
12
+ # super # Needed to calculate some statistics
13
+ #
14
+ # print "<testsuite "
15
+ # print "tests='#{count}' "
16
+ # print "failures='#{failures}' "
17
+ # # Remaining XML...
18
+ # end
19
+ # end
20
+ #
21
+ class Minitest::StatisticsReporter < ::Minitest::Reporter
22
+ def initialize: (?untyped io, ?::Hash[untyped, untyped] options) -> void
23
+ def passed?: () -> untyped
24
+ def start: () -> untyped
25
+ def record: (untyped result) -> untyped
26
+
27
+ # <!--
28
+ # rdoc-file=lib/minitest.rb
29
+ # - report()
30
+ # -->
31
+ # Report on the tracked statistics.
32
+ #
33
+ def report: () -> untyped
34
+
35
+ # <!-- rdoc-file=lib/minitest.rb -->
36
+ # Total number of assertions.
37
+ #
38
+ attr_accessor assertions: untyped
39
+
40
+ # <!-- rdoc-file=lib/minitest.rb -->
41
+ # Total number of test cases.
42
+ #
43
+ attr_accessor count: untyped
44
+
45
+ # <!-- rdoc-file=lib/minitest.rb -->
46
+ # An `Array` of test cases that failed or were skipped.
47
+ #
48
+ attr_accessor results: untyped
49
+
50
+ # <!-- rdoc-file=lib/minitest.rb -->
51
+ # Time the test run started. If available, the monotonic clock is used and this
52
+ # is a `Float`, otherwise it's an instance of `Time`.
53
+ #
54
+ attr_accessor start_time: untyped
55
+
56
+ # <!-- rdoc-file=lib/minitest.rb -->
57
+ # Test run time. If available, the monotonic clock is used and this is a
58
+ # `Float`, otherwise it's an instance of `Time`.
59
+ #
60
+ attr_accessor total_time: untyped
61
+
62
+ # <!-- rdoc-file=lib/minitest.rb -->
63
+ # Total number of tests that failed.
64
+ #
65
+ attr_accessor failures: untyped
66
+
67
+ # <!-- rdoc-file=lib/minitest.rb -->
68
+ # Total number of tests that erred.
69
+ #
70
+ attr_accessor errors: untyped
71
+
72
+ # <!-- rdoc-file=lib/minitest.rb -->
73
+ # Total number of tests that where skipped.
74
+ #
75
+ attr_accessor skips: untyped
76
+ end
@@ -0,0 +1,25 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # A reporter that prints the header, summary, and failure details at the end of
3
+ # the run.
4
+ #
5
+ # This is added to the top-level CompositeReporter at the start of the run. If
6
+ # you want to change the output of minitest via a plugin, pull this out of the
7
+ # composite and replace it with your own.
8
+ #
9
+ class Minitest::SummaryReporter < ::Minitest::StatisticsReporter
10
+ def start: () -> untyped
11
+ def report: () -> untyped
12
+ def statistics: () -> untyped
13
+ def aggregated_results: (untyped io) -> untyped
14
+ def to_s: () -> untyped
15
+ def summary: () -> untyped
16
+
17
+ # <!--
18
+ # rdoc-file=lib/minitest.rb
19
+ # - binary_string()
20
+ # -->
21
+ #
22
+ private def binary_string: () -> untyped
23
+ attr_accessor sync: untyped
24
+ attr_accessor old_sync: untyped
25
+ end
@@ -0,0 +1,92 @@
1
+ # <!-- rdoc-file=lib/minitest/test.rb -->
2
+ # Provides before/after hooks for setup and teardown. These are meant for
3
+ # library writers, NOT for regular test authors. See #before_setup for an
4
+ # example.
5
+ #
6
+ module Minitest::Test::LifecycleHooks
7
+ # <!--
8
+ # rdoc-file=lib/minitest/test.rb
9
+ # - before_setup()
10
+ # -->
11
+ # Runs before every test, before setup. This hook is meant for libraries to
12
+ # extend minitest. It is not meant to be used by test developers.
13
+ #
14
+ # As a simplistic example:
15
+ #
16
+ # module MyMinitestPlugin
17
+ # def before_setup
18
+ # super
19
+ # # ... stuff to do before setup is run
20
+ # end
21
+ #
22
+ # def after_setup
23
+ # # ... stuff to do after setup is run
24
+ # super
25
+ # end
26
+ #
27
+ # def before_teardown
28
+ # super
29
+ # # ... stuff to do before teardown is run
30
+ # end
31
+ #
32
+ # def after_teardown
33
+ # # ... stuff to do after teardown is run
34
+ # super
35
+ # end
36
+ # end
37
+ #
38
+ # class MiniTest::Test
39
+ # include MyMinitestPlugin
40
+ # end
41
+ #
42
+ def before_setup: () -> nil
43
+
44
+ # <!--
45
+ # rdoc-file=lib/minitest/test.rb
46
+ # - setup()
47
+ # -->
48
+ # Runs before every test. Use this to set up before each test run.
49
+ #
50
+ def setup: () -> nil
51
+
52
+ # <!--
53
+ # rdoc-file=lib/minitest/test.rb
54
+ # - after_setup()
55
+ # -->
56
+ # Runs before every test, after setup. This hook is meant for libraries to
57
+ # extend minitest. It is not meant to be used by test developers.
58
+ #
59
+ # See #before_setup for an example.
60
+ #
61
+ def after_setup: () -> nil
62
+
63
+ # <!--
64
+ # rdoc-file=lib/minitest/test.rb
65
+ # - before_teardown()
66
+ # -->
67
+ # Runs after every test, before teardown. This hook is meant for libraries to
68
+ # extend minitest. It is not meant to be used by test developers.
69
+ #
70
+ # See #before_setup for an example.
71
+ #
72
+ def before_teardown: () -> nil
73
+
74
+ # <!--
75
+ # rdoc-file=lib/minitest/test.rb
76
+ # - teardown()
77
+ # -->
78
+ # Runs after every test. Use this to clean up after each test run.
79
+ #
80
+ def teardown: () -> nil
81
+
82
+ # <!--
83
+ # rdoc-file=lib/minitest/test.rb
84
+ # - after_teardown()
85
+ # -->
86
+ # Runs after every test, after teardown. This hook is meant for libraries to
87
+ # extend minitest. It is not meant to be used by test developers.
88
+ #
89
+ # See #before_setup for an example.
90
+ #
91
+ def after_teardown: () -> nil
92
+ end
@@ -0,0 +1,76 @@
1
+ # <!-- rdoc-file=lib/minitest/test.rb -->
2
+ # Subclass Test to create your own tests. Typically you'll want a Test subclass
3
+ # per implementation class.
4
+ #
5
+ # See Minitest::Assertions
6
+ #
7
+ class Minitest::Test < ::Minitest::Runnable
8
+ def class_name: () -> untyped
9
+
10
+ # <!--
11
+ # rdoc-file=lib/minitest/test.rb
12
+ # - i_suck_and_my_tests_are_order_dependent!()
13
+ # -->
14
+ # Call this at the top of your tests when you absolutely positively need to have
15
+ # ordered tests. In doing so, you're admitting that you suck and your tests are
16
+ # weak.
17
+ #
18
+ def self.i_suck_and_my_tests_are_order_dependent!: () -> untyped
19
+
20
+ # <!--
21
+ # rdoc-file=lib/minitest/test.rb
22
+ # - make_my_diffs_pretty!()
23
+ # -->
24
+ # Make diffs for this Test use #pretty_inspect so that diff in assert_equal can
25
+ # have more details. NOTE: this is much slower than the regular inspect but much
26
+ # more usable for complex objects.
27
+ #
28
+ def self.make_my_diffs_pretty!: () -> untyped
29
+
30
+ # <!--
31
+ # rdoc-file=lib/minitest/test.rb
32
+ # - parallelize_me!()
33
+ # -->
34
+ # Call this at the top of your tests when you want to run your tests in
35
+ # parallel. In doing so, you're admitting that you rule and your tests are
36
+ # awesome.
37
+ #
38
+ def self.parallelize_me!: () -> untyped
39
+
40
+ # <!--
41
+ # rdoc-file=lib/minitest/test.rb
42
+ # - runnable_methods()
43
+ # -->
44
+ # Returns all instance methods starting with "test_". Based on #test_order, the
45
+ # methods are either sorted, randomized (default), or run in parallel.
46
+ #
47
+ def self.runnable_methods: () -> untyped
48
+
49
+ # <!--
50
+ # rdoc-file=lib/minitest/test.rb
51
+ # - test_order()
52
+ # -->
53
+ # Defines the order to run tests (:random by default). Override this or use a
54
+ # convenience method to change it for your tests.
55
+ #
56
+ def self.test_order: () -> :random
57
+
58
+ # <!--
59
+ # rdoc-file=lib/minitest/test.rb
60
+ # - run()
61
+ # -->
62
+ # Runs a single test with setup/teardown hooks.
63
+ #
64
+ def run: () -> untyped
65
+ def capture_exceptions: () { () -> untyped } -> untyped
66
+ def sanitize_exception: (untyped e) -> untyped
67
+ def with_info_handler: () ?{ () -> untyped } -> untyped
68
+ attr_accessor self.io_lock: untyped
69
+ include Minitest::Assertions
70
+ include Minitest::Reportable
71
+ include Minitest::Test::LifecycleHooks
72
+ include Minitest::Guard
73
+ extend Minitest::Guard
74
+ TEARDOWN_METHODS: Array[String]
75
+ PASSTHROUGH_EXCEPTIONS: Array[singleton(NoMemoryError) | singleton(SignalException) | singleton(SystemExit)]
76
+ end
@@ -0,0 +1,10 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # Assertion wrapping an unexpected error that was raised during a run.
3
+ #
4
+ class Minitest::UnexpectedError < ::Minitest::Assertion
5
+ def initialize: (untyped error) -> void
6
+ def backtrace: () -> untyped
7
+ def message: () -> ::String
8
+ def result_label: () -> "Error"
9
+ attr_accessor error: untyped
10
+ end
@@ -0,0 +1,3 @@
1
+ class Minitest::Unit::TestCase < ::Minitest::Test
2
+ def self.inherited: (untyped klass) -> untyped
3
+ end