rbs 2.5.1 → 2.6.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +1 -1
- data/.github/workflows/ruby.yml +3 -3
- data/CHANGELOG.md +44 -0
- data/Gemfile.lock +5 -5
- data/Rakefile +6 -38
- data/Steepfile +6 -2
- data/core/constants.rbs +1 -1
- data/core/env.rbs +1 -1323
- data/core/global_variables.rbs +1 -1
- data/core/hash.rbs +3 -3
- data/core/kernel.rbs +2 -2
- data/core/random.rbs +5 -220
- data/core/rational.rbs +3 -3
- data/core/rbs/unnamed/argf.rbs +965 -0
- data/core/rbs/unnamed/env_class.rbs +1325 -0
- data/core/rbs/unnamed/random.rbs +270 -0
- data/core/regexp.rbs +2 -3
- data/docs/CONTRIBUTING.md +2 -2
- data/ext/rbs_extension/lexer.c +1343 -1353
- data/ext/rbs_extension/lexer.re +2 -2
- data/ext/rbs_extension/rbs_extension.h +1 -1
- data/ext/rbs_extension/unescape.c +17 -10
- data/lib/rbs/ast/members.rb +6 -3
- data/lib/rbs/cli.rb +2 -0
- data/lib/rbs/factory.rb +2 -0
- data/lib/rbs/prototype/helpers.rb +1 -5
- data/lib/rbs/prototype/rb.rb +105 -56
- data/lib/rbs/prototype/rbi.rb +65 -30
- data/lib/rbs/prototype/runtime.rb +4 -3
- data/lib/rbs/test/setup_helper.rb +6 -1
- data/lib/rbs/version.rb +1 -1
- data/schema/members.json +4 -1
- data/sig/collection/config.rbs +3 -0
- data/sig/factory.rbs +5 -0
- data/sig/prototype/helpers.rbs +23 -0
- data/sig/prototype/rb.rbs +84 -0
- data/sig/prototype/rbi.rbs +73 -0
- data/sig/shims/abstract_syntax_tree.rbs +25 -0
- data/sig/shims/enumerable.rbs +5 -0
- data/sig/shims/pp.rbs +3 -0
- data/sig/shims/ripper.rbs +8 -0
- data/stdlib/cgi/0/manifest.yaml +2 -0
- data/stdlib/date/0/time.rbs +26 -0
- data/stdlib/etc/0/etc.rbs +745 -0
- data/stdlib/minitest/0/kernel.rbs +42 -0
- data/stdlib/minitest/0/manifest.yaml +2 -0
- data/stdlib/minitest/0/minitest/abstract_reporter.rbs +49 -0
- data/stdlib/minitest/0/minitest/assertion.rbs +16 -0
- data/stdlib/minitest/0/minitest/assertions.rbs +545 -0
- data/stdlib/minitest/0/minitest/backtrace_filter.rbs +16 -0
- data/stdlib/minitest/0/minitest/bench_spec.rbs +102 -0
- data/stdlib/minitest/0/minitest/benchmark.rbs +258 -0
- data/stdlib/minitest/0/minitest/composite_reporter.rbs +25 -0
- data/stdlib/minitest/0/minitest/expectation.rbs +2 -0
- data/stdlib/minitest/0/minitest/expectations.rbs +21 -0
- data/stdlib/minitest/0/minitest/guard.rbs +64 -0
- data/stdlib/minitest/0/minitest/mock.rbs +60 -0
- data/stdlib/minitest/0/minitest/parallel/executor.rbs +42 -0
- data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +6 -0
- data/stdlib/minitest/0/minitest/parallel/test.rbs +3 -0
- data/stdlib/minitest/0/minitest/parallel.rbs +2 -0
- data/stdlib/minitest/0/minitest/pride_io.rbs +54 -0
- data/stdlib/minitest/0/minitest/pride_lol.rbs +17 -0
- data/stdlib/minitest/0/minitest/progress_reporter.rbs +11 -0
- data/stdlib/minitest/0/minitest/reportable.rbs +51 -0
- data/stdlib/minitest/0/minitest/reporter.rbs +5 -0
- data/stdlib/minitest/0/minitest/result.rbs +28 -0
- data/stdlib/minitest/0/minitest/runnable.rbs +131 -0
- data/stdlib/minitest/0/minitest/skip.rbs +6 -0
- data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +48 -0
- data/stdlib/minitest/0/minitest/spec/dsl.rbs +125 -0
- data/stdlib/minitest/0/minitest/spec.rbs +11 -0
- data/stdlib/minitest/0/minitest/statistics_reporter.rbs +76 -0
- data/stdlib/minitest/0/minitest/summary_reporter.rbs +25 -0
- data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +92 -0
- data/stdlib/minitest/0/minitest/test.rbs +76 -0
- data/stdlib/minitest/0/minitest/unexpected_error.rbs +10 -0
- data/stdlib/minitest/0/minitest/unit/test_case.rbs +3 -0
- data/stdlib/minitest/0/minitest/unit.rbs +5 -0
- data/stdlib/minitest/0/minitest.rbs +966 -0
- data/stdlib/rubygems/0/errors.rbs +113 -0
- metadata +54 -4
- data/lib/rbs/char_scanner.rb +0 -20
@@ -0,0 +1,42 @@
|
|
1
|
+
%a{annotate:rdoc:skip}
|
2
|
+
module Kernel : ::BasicObject
|
3
|
+
# <!--
|
4
|
+
# rdoc-file=lib/minitest/spec.rb
|
5
|
+
# - describe(desc, *additional_desc, &block)
|
6
|
+
# -->
|
7
|
+
# Describe a series of expectations for a given target `desc`.
|
8
|
+
#
|
9
|
+
# Defines a test class subclassing from either Minitest::Spec or from the
|
10
|
+
# surrounding describe's class. The surrounding class may subclass
|
11
|
+
# Minitest::Spec manually in order to easily share code:
|
12
|
+
#
|
13
|
+
# class MySpec < Minitest::Spec
|
14
|
+
# # ... shared code ...
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# class TestStuff < MySpec
|
18
|
+
# it "does stuff" do
|
19
|
+
# # shared code available here
|
20
|
+
# end
|
21
|
+
# describe "inner stuff" do
|
22
|
+
# it "still does stuff" do
|
23
|
+
# # ...and here
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# For more information on getting started with writing specs, see:
|
29
|
+
#
|
30
|
+
# http://www.rubyinside.com/a-minitestspec-tutorial-elegant-spec-style-testing-t
|
31
|
+
# hat-comes-with-ruby-5354.html
|
32
|
+
#
|
33
|
+
# For some suggestions on how to improve your specs, try:
|
34
|
+
#
|
35
|
+
# http://betterspecs.org
|
36
|
+
#
|
37
|
+
# but do note that several items there are debatable or specific to rspec.
|
38
|
+
#
|
39
|
+
# For more information about expectations, see Minitest::Expectations.
|
40
|
+
#
|
41
|
+
private def describe: (untyped desc, *untyped additional_desc) ?{ () -> untyped } -> untyped
|
42
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
2
|
+
# Defines the API for Reporters. Subclass this and override whatever you want.
|
3
|
+
# Go nuts.
|
4
|
+
#
|
5
|
+
class Minitest::AbstractReporter
|
6
|
+
# <!--
|
7
|
+
# rdoc-file=lib/minitest.rb
|
8
|
+
# - start()
|
9
|
+
# -->
|
10
|
+
# Starts reporting on the run.
|
11
|
+
#
|
12
|
+
def start: () -> nil
|
13
|
+
|
14
|
+
# <!--
|
15
|
+
# rdoc-file=lib/minitest.rb
|
16
|
+
# - prerecord(klass, name)
|
17
|
+
# -->
|
18
|
+
# About to start running a test. This allows a reporter to show that it is
|
19
|
+
# starting or that we are in the middle of a test run.
|
20
|
+
#
|
21
|
+
def prerecord: (untyped klass, untyped name) -> nil
|
22
|
+
|
23
|
+
# <!--
|
24
|
+
# rdoc-file=lib/minitest.rb
|
25
|
+
# - record(result)
|
26
|
+
# -->
|
27
|
+
# Output and record the result of the test. Call
|
28
|
+
# [result#result_code](rdoc-ref:Runnable#result_code) to get the result
|
29
|
+
# character string. Stores the result of the run if the run did not pass.
|
30
|
+
#
|
31
|
+
def record: (untyped result) -> nil
|
32
|
+
|
33
|
+
# <!--
|
34
|
+
# rdoc-file=lib/minitest.rb
|
35
|
+
# - report()
|
36
|
+
# -->
|
37
|
+
# Outputs the summary of the run.
|
38
|
+
#
|
39
|
+
def report: () -> nil
|
40
|
+
|
41
|
+
# <!--
|
42
|
+
# rdoc-file=lib/minitest.rb
|
43
|
+
# - passed?()
|
44
|
+
# -->
|
45
|
+
# Did this run pass?
|
46
|
+
#
|
47
|
+
def passed?: () -> true
|
48
|
+
include Mutex_m
|
49
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
2
|
+
# Represents run failures.
|
3
|
+
#
|
4
|
+
class Minitest::Assertion < ::Exception
|
5
|
+
def error: () -> self
|
6
|
+
|
7
|
+
# <!--
|
8
|
+
# rdoc-file=lib/minitest.rb
|
9
|
+
# - location()
|
10
|
+
# -->
|
11
|
+
# Where was this run before an assertion was raised?
|
12
|
+
#
|
13
|
+
def location: () -> untyped
|
14
|
+
def result_code: () -> untyped
|
15
|
+
def result_label: () -> "Failure"
|
16
|
+
end
|
@@ -0,0 +1,545 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest/assertions.rb -->
|
2
|
+
# Minitest Assertions. All assertion methods accept a `msg` which is printed if
|
3
|
+
# the assertion fails.
|
4
|
+
#
|
5
|
+
# Protocol: Nearly everything here boils up to `assert`, which expects to be
|
6
|
+
# able to increment an instance accessor named `assertions`. This is not
|
7
|
+
# provided by Assertions and must be provided by the thing including Assertions.
|
8
|
+
# See Minitest::Runnable for an example.
|
9
|
+
#
|
10
|
+
module Minitest::Assertions
|
11
|
+
def self.inspect: () -> "UNDEFINED"
|
12
|
+
|
13
|
+
# <!--
|
14
|
+
# rdoc-file=lib/minitest/assertions.rb
|
15
|
+
# - diff()
|
16
|
+
# -->
|
17
|
+
# Returns the diff command to use in #diff. Tries to intelligently figure out
|
18
|
+
# what diff to use.
|
19
|
+
#
|
20
|
+
def self.diff: () -> untyped
|
21
|
+
|
22
|
+
# <!--
|
23
|
+
# rdoc-file=lib/minitest/assertions.rb
|
24
|
+
# - diff=(o)
|
25
|
+
# -->
|
26
|
+
# Set the diff command to use in #diff.
|
27
|
+
#
|
28
|
+
def self.diff=: (untyped o) -> untyped
|
29
|
+
|
30
|
+
# <!--
|
31
|
+
# rdoc-file=lib/minitest/assertions.rb
|
32
|
+
# - diff(exp, act)
|
33
|
+
# -->
|
34
|
+
# Returns a diff between `exp` and `act`. If there is no known diff command or
|
35
|
+
# if it doesn't make sense to diff the output (single line, short output), then
|
36
|
+
# it simply returns a basic comparison between the two.
|
37
|
+
#
|
38
|
+
# See `things_to_diff` for more info.
|
39
|
+
#
|
40
|
+
def diff: (untyped exp, untyped act) -> (::String | untyped)
|
41
|
+
|
42
|
+
# <!--
|
43
|
+
# rdoc-file=lib/minitest/assertions.rb
|
44
|
+
# - things_to_diff(exp, act)
|
45
|
+
# -->
|
46
|
+
# Returns things to diff [expect, butwas], or [nil, nil] if nothing to diff.
|
47
|
+
#
|
48
|
+
# Criterion:
|
49
|
+
#
|
50
|
+
# 1. Strings include newlines or escaped newlines, but not both.
|
51
|
+
# 2. or: String lengths are > 30 characters.
|
52
|
+
# 3. or: Strings are equal to each other (but maybe different encodings?).
|
53
|
+
# 4. and: we found a diff executable.
|
54
|
+
#
|
55
|
+
def things_to_diff: (untyped exp, untyped act) -> untyped
|
56
|
+
|
57
|
+
# <!--
|
58
|
+
# rdoc-file=lib/minitest/assertions.rb
|
59
|
+
# - mu_pp(obj)
|
60
|
+
# -->
|
61
|
+
# This returns a human-readable version of `obj`. By default #inspect is called.
|
62
|
+
# You can override this to use #pretty_inspect if you want.
|
63
|
+
#
|
64
|
+
# See Minitest::Test.make_my_diffs_pretty!
|
65
|
+
#
|
66
|
+
def mu_pp: (untyped obj) -> untyped
|
67
|
+
|
68
|
+
# <!--
|
69
|
+
# rdoc-file=lib/minitest/assertions.rb
|
70
|
+
# - mu_pp_for_diff(obj)
|
71
|
+
# -->
|
72
|
+
# This returns a diff-able more human-readable version of `obj`. This differs
|
73
|
+
# from the regular mu_pp because it expands escaped newlines and makes
|
74
|
+
# hex-values (like object_ids) generic. This uses mu_pp to do the first pass and
|
75
|
+
# then cleans it up.
|
76
|
+
#
|
77
|
+
def mu_pp_for_diff: (untyped obj) -> untyped
|
78
|
+
|
79
|
+
# <!--
|
80
|
+
# rdoc-file=lib/minitest/assertions.rb
|
81
|
+
# - assert(test, msg = nil)
|
82
|
+
# -->
|
83
|
+
# Fails unless `test` is truthy.
|
84
|
+
#
|
85
|
+
def assert: (untyped test, ?untyped? msg) -> true
|
86
|
+
|
87
|
+
def _synchronize: () { () -> untyped } -> untyped
|
88
|
+
|
89
|
+
# <!--
|
90
|
+
# rdoc-file=lib/minitest/assertions.rb
|
91
|
+
# - assert_empty(obj, msg = nil)
|
92
|
+
# -->
|
93
|
+
# Fails unless `obj` is empty.
|
94
|
+
#
|
95
|
+
def assert_empty: (untyped obj, ?untyped? msg) -> untyped
|
96
|
+
|
97
|
+
# <!--
|
98
|
+
# rdoc-file=lib/minitest/assertions.rb
|
99
|
+
# - assert_equal(exp, act, msg = nil)
|
100
|
+
# -->
|
101
|
+
# Fails unless `exp == act` printing the difference between the two, if
|
102
|
+
# possible.
|
103
|
+
#
|
104
|
+
# If there is no visible difference but the assertion fails, you should suspect
|
105
|
+
# that your #== is buggy, or your inspect output is missing crucial details.
|
106
|
+
# For nicer structural diffing, set Minitest::Test.make_my_diffs_pretty!
|
107
|
+
#
|
108
|
+
# For floats use assert_in_delta.
|
109
|
+
#
|
110
|
+
# See also: Minitest::Assertions.diff
|
111
|
+
#
|
112
|
+
def assert_equal: (untyped exp, untyped act, ?untyped? msg) -> untyped
|
113
|
+
|
114
|
+
# <!--
|
115
|
+
# rdoc-file=lib/minitest/assertions.rb
|
116
|
+
# - assert_in_delta(exp, act, delta = 0.001, msg = nil)
|
117
|
+
# -->
|
118
|
+
# For comparing Floats. Fails unless `exp` and `act` are within `delta` of each
|
119
|
+
# other.
|
120
|
+
#
|
121
|
+
# assert_in_delta Math::PI, (22.0 / 7.0), 0.01
|
122
|
+
#
|
123
|
+
def assert_in_delta: (untyped exp, untyped act, ?::Float delta, ?untyped? msg) -> untyped
|
124
|
+
|
125
|
+
# <!--
|
126
|
+
# rdoc-file=lib/minitest/assertions.rb
|
127
|
+
# - assert_in_epsilon(exp, act, epsilon = 0.001, msg = nil)
|
128
|
+
# -->
|
129
|
+
# For comparing Floats. Fails unless `exp` and `act` have a relative error less
|
130
|
+
# than `epsilon`.
|
131
|
+
#
|
132
|
+
def assert_in_epsilon: (untyped exp, untyped act, ?::Float epsilon, ?untyped? msg) -> untyped
|
133
|
+
|
134
|
+
# <!--
|
135
|
+
# rdoc-file=lib/minitest/assertions.rb
|
136
|
+
# - assert_includes(collection, obj, msg = nil)
|
137
|
+
# -->
|
138
|
+
# Fails unless `collection` includes `obj`.
|
139
|
+
#
|
140
|
+
def assert_includes: (untyped collection, untyped obj, ?untyped? msg) -> untyped
|
141
|
+
|
142
|
+
# <!--
|
143
|
+
# rdoc-file=lib/minitest/assertions.rb
|
144
|
+
# - assert_instance_of(cls, obj, msg = nil)
|
145
|
+
# -->
|
146
|
+
# Fails unless `obj` is an instance of `cls`.
|
147
|
+
#
|
148
|
+
def assert_instance_of: (untyped cls, untyped obj, ?untyped? msg) -> untyped
|
149
|
+
|
150
|
+
# <!--
|
151
|
+
# rdoc-file=lib/minitest/assertions.rb
|
152
|
+
# - assert_kind_of(cls, obj, msg = nil)
|
153
|
+
# -->
|
154
|
+
# Fails unless `obj` is a kind of `cls`.
|
155
|
+
#
|
156
|
+
def assert_kind_of: (untyped cls, untyped obj, ?untyped? msg) -> untyped
|
157
|
+
|
158
|
+
# <!--
|
159
|
+
# rdoc-file=lib/minitest/assertions.rb
|
160
|
+
# - assert_match(matcher, obj, msg = nil)
|
161
|
+
# -->
|
162
|
+
# Fails unless `matcher` `=~` `obj`.
|
163
|
+
#
|
164
|
+
def assert_match: (untyped matcher, untyped obj, ?untyped? msg) -> untyped
|
165
|
+
|
166
|
+
# <!--
|
167
|
+
# rdoc-file=lib/minitest/assertions.rb
|
168
|
+
# - assert_nil(obj, msg = nil)
|
169
|
+
# -->
|
170
|
+
# Fails unless `obj` is nil
|
171
|
+
#
|
172
|
+
def assert_nil: (untyped obj, ?untyped? msg) -> untyped
|
173
|
+
|
174
|
+
# <!--
|
175
|
+
# rdoc-file=lib/minitest/assertions.rb
|
176
|
+
# - assert_operator(o1, op, o2 = UNDEFINED, msg = nil)
|
177
|
+
# -->
|
178
|
+
# For testing with binary operators. Eg:
|
179
|
+
#
|
180
|
+
# assert_operator 5, :<=, 4
|
181
|
+
#
|
182
|
+
def assert_operator: (untyped o1, untyped op, ?untyped o2, ?untyped? msg) -> untyped
|
183
|
+
|
184
|
+
# <!--
|
185
|
+
# rdoc-file=lib/minitest/assertions.rb
|
186
|
+
# - assert_output(stdout = nil, stderr = nil) { || ... }
|
187
|
+
# -->
|
188
|
+
# Fails if stdout or stderr do not output the expected results. Pass in nil if
|
189
|
+
# you don't care about that streams output. Pass in "" if you require it to be
|
190
|
+
# silent. Pass in a regexp if you want to pattern match.
|
191
|
+
#
|
192
|
+
# assert_output(/hey/) { method_with_output }
|
193
|
+
#
|
194
|
+
# NOTE: this uses #capture_io, not #capture_subprocess_io.
|
195
|
+
#
|
196
|
+
# See also: #assert_silent
|
197
|
+
#
|
198
|
+
def assert_output: (?untyped? stdout, ?untyped? stderr) { () -> untyped } -> untyped
|
199
|
+
|
200
|
+
# <!--
|
201
|
+
# rdoc-file=lib/minitest/assertions.rb
|
202
|
+
# - assert_path_exists(path, msg = nil)
|
203
|
+
# -->
|
204
|
+
# Fails unless `path` exists.
|
205
|
+
#
|
206
|
+
def assert_path_exists: (untyped path, ?untyped? msg) -> untyped
|
207
|
+
|
208
|
+
# <!--
|
209
|
+
# rdoc-file=lib/minitest/assertions.rb
|
210
|
+
# - assert_predicate(o1, op, msg = nil)
|
211
|
+
# -->
|
212
|
+
# For testing with predicates. Eg:
|
213
|
+
#
|
214
|
+
# assert_predicate str, :empty?
|
215
|
+
#
|
216
|
+
# This is really meant for specs and is front-ended by assert_operator:
|
217
|
+
#
|
218
|
+
# str.must_be :empty?
|
219
|
+
#
|
220
|
+
def assert_predicate: (untyped o1, untyped op, ?untyped? msg) -> untyped
|
221
|
+
|
222
|
+
# <!--
|
223
|
+
# rdoc-file=lib/minitest/assertions.rb
|
224
|
+
# - assert_raises(*exp) { || ... }
|
225
|
+
# -->
|
226
|
+
# Fails unless the block raises one of `exp`. Returns the exception matched so
|
227
|
+
# you can check the message, attributes, etc.
|
228
|
+
#
|
229
|
+
# `exp` takes an optional message on the end to help explain failures and
|
230
|
+
# defaults to StandardError if no exception class is passed. Eg:
|
231
|
+
#
|
232
|
+
# assert_raises(CustomError) { method_with_custom_error }
|
233
|
+
#
|
234
|
+
# With custom error message:
|
235
|
+
#
|
236
|
+
# assert_raises(CustomError, 'This should have raised CustomError') { method_with_custom_error }
|
237
|
+
#
|
238
|
+
# Using the returned object:
|
239
|
+
#
|
240
|
+
# error = assert_raises(CustomError) do
|
241
|
+
# raise CustomError, 'This is really bad'
|
242
|
+
# end
|
243
|
+
#
|
244
|
+
# assert_equal 'This is really bad', error.message
|
245
|
+
#
|
246
|
+
def assert_raises: (*untyped exp) { () -> untyped } -> untyped
|
247
|
+
|
248
|
+
# <!--
|
249
|
+
# rdoc-file=lib/minitest/assertions.rb
|
250
|
+
# - assert_respond_to(obj, meth, msg = nil)
|
251
|
+
# -->
|
252
|
+
# Fails unless `obj` responds to `meth`.
|
253
|
+
#
|
254
|
+
def assert_respond_to: (untyped obj, untyped meth, ?untyped? msg) -> untyped
|
255
|
+
|
256
|
+
# <!--
|
257
|
+
# rdoc-file=lib/minitest/assertions.rb
|
258
|
+
# - assert_same(exp, act, msg = nil)
|
259
|
+
# -->
|
260
|
+
# Fails unless `exp` and `act` are #equal?
|
261
|
+
#
|
262
|
+
def assert_same: (untyped exp, untyped act, ?untyped? msg) -> untyped
|
263
|
+
|
264
|
+
# <!--
|
265
|
+
# rdoc-file=lib/minitest/assertions.rb
|
266
|
+
# - assert_send(send_ary, m = nil)
|
267
|
+
# -->
|
268
|
+
# `send_ary` is a receiver, message and arguments.
|
269
|
+
#
|
270
|
+
# Fails unless the call returns a true value
|
271
|
+
#
|
272
|
+
def assert_send: (untyped send_ary, ?untyped? m) -> untyped
|
273
|
+
|
274
|
+
# <!--
|
275
|
+
# rdoc-file=lib/minitest/assertions.rb
|
276
|
+
# - assert_silent() { || ... }
|
277
|
+
# -->
|
278
|
+
# Fails if the block outputs anything to stderr or stdout.
|
279
|
+
#
|
280
|
+
# See also: #assert_output
|
281
|
+
#
|
282
|
+
def assert_silent: () { () -> untyped } -> untyped
|
283
|
+
|
284
|
+
# <!--
|
285
|
+
# rdoc-file=lib/minitest/assertions.rb
|
286
|
+
# - assert_throws(sym, msg = nil) { || ... }
|
287
|
+
# -->
|
288
|
+
# Fails unless the block throws `sym`
|
289
|
+
#
|
290
|
+
def assert_throws: (untyped sym, ?untyped? msg) { () -> untyped } -> untyped
|
291
|
+
|
292
|
+
# <!--
|
293
|
+
# rdoc-file=lib/minitest/assertions.rb
|
294
|
+
# - capture_io() { || ... }
|
295
|
+
# -->
|
296
|
+
# Captures $stdout and $stderr into strings:
|
297
|
+
#
|
298
|
+
# out, err = capture_io do
|
299
|
+
# puts "Some info"
|
300
|
+
# warn "You did a bad thing"
|
301
|
+
# end
|
302
|
+
#
|
303
|
+
# assert_match %r%info%, out
|
304
|
+
# assert_match %r%bad%, err
|
305
|
+
#
|
306
|
+
# NOTE: For efficiency, this method uses StringIO and does not capture IO for
|
307
|
+
# subprocesses. Use #capture_subprocess_io for that.
|
308
|
+
#
|
309
|
+
def capture_io: () { () -> untyped } -> untyped
|
310
|
+
|
311
|
+
# <!--
|
312
|
+
# rdoc-file=lib/minitest/assertions.rb
|
313
|
+
# - capture_subprocess_io() { || ... }
|
314
|
+
# -->
|
315
|
+
# Captures $stdout and $stderr into strings, using Tempfile to ensure that
|
316
|
+
# subprocess IO is captured as well.
|
317
|
+
#
|
318
|
+
# out, err = capture_subprocess_io do
|
319
|
+
# system "echo Some info"
|
320
|
+
# system "echo You did a bad thing 1>&2"
|
321
|
+
# end
|
322
|
+
#
|
323
|
+
# assert_match %r%info%, out
|
324
|
+
# assert_match %r%bad%, err
|
325
|
+
#
|
326
|
+
# NOTE: This method is approximately 10x slower than #capture_io so only use it
|
327
|
+
# when you need to test the output of a subprocess.
|
328
|
+
#
|
329
|
+
def capture_subprocess_io: () { () -> untyped } -> untyped
|
330
|
+
|
331
|
+
# <!--
|
332
|
+
# rdoc-file=lib/minitest/assertions.rb
|
333
|
+
# - exception_details(e, msg)
|
334
|
+
# -->
|
335
|
+
# Returns details for exception `e`
|
336
|
+
#
|
337
|
+
def exception_details: (untyped e, untyped msg) -> untyped
|
338
|
+
|
339
|
+
# <!--
|
340
|
+
# rdoc-file=lib/minitest/assertions.rb
|
341
|
+
# - fail_after(y,m,d,msg)
|
342
|
+
# -->
|
343
|
+
# Fails after a given date (in the local time zone). This allows you to put
|
344
|
+
# time-bombs in your tests if you need to keep something around until a later
|
345
|
+
# date lest you forget about it.
|
346
|
+
#
|
347
|
+
def fail_after: (untyped y, untyped m, untyped d, untyped msg) -> (untyped | nil)
|
348
|
+
|
349
|
+
# <!--
|
350
|
+
# rdoc-file=lib/minitest/assertions.rb
|
351
|
+
# - flunk(msg = nil)
|
352
|
+
# -->
|
353
|
+
# Fails with `msg`.
|
354
|
+
#
|
355
|
+
def flunk: (?untyped? msg) -> untyped
|
356
|
+
|
357
|
+
# <!--
|
358
|
+
# rdoc-file=lib/minitest/assertions.rb
|
359
|
+
# - message(msg = nil, ending = nil, &default)
|
360
|
+
# -->
|
361
|
+
# Returns a proc that will output `msg` along with the default message.
|
362
|
+
#
|
363
|
+
def message: (?untyped? msg, ?untyped? ending) ?{ () -> untyped } -> untyped
|
364
|
+
|
365
|
+
# <!--
|
366
|
+
# rdoc-file=lib/minitest/assertions.rb
|
367
|
+
# - pass(_msg = nil)
|
368
|
+
# -->
|
369
|
+
# used for counting assertions
|
370
|
+
#
|
371
|
+
def pass: (?untyped? _msg) -> untyped
|
372
|
+
|
373
|
+
# <!--
|
374
|
+
# rdoc-file=lib/minitest/assertions.rb
|
375
|
+
# - refute(test, msg = nil)
|
376
|
+
# -->
|
377
|
+
# Fails if `test` is truthy.
|
378
|
+
#
|
379
|
+
def refute: (untyped test, ?untyped? msg) -> untyped
|
380
|
+
|
381
|
+
# <!--
|
382
|
+
# rdoc-file=lib/minitest/assertions.rb
|
383
|
+
# - refute_empty(obj, msg = nil)
|
384
|
+
# -->
|
385
|
+
# Fails if `obj` is empty.
|
386
|
+
#
|
387
|
+
def refute_empty: (untyped obj, ?untyped? msg) -> untyped
|
388
|
+
|
389
|
+
# <!--
|
390
|
+
# rdoc-file=lib/minitest/assertions.rb
|
391
|
+
# - refute_equal(exp, act, msg = nil)
|
392
|
+
# -->
|
393
|
+
# Fails if `exp == act`.
|
394
|
+
#
|
395
|
+
# For floats use refute_in_delta.
|
396
|
+
#
|
397
|
+
def refute_equal: (untyped exp, untyped act, ?untyped? msg) -> untyped
|
398
|
+
|
399
|
+
# <!--
|
400
|
+
# rdoc-file=lib/minitest/assertions.rb
|
401
|
+
# - refute_in_delta(exp, act, delta = 0.001, msg = nil)
|
402
|
+
# -->
|
403
|
+
# For comparing Floats. Fails if `exp` is within `delta` of `act`.
|
404
|
+
#
|
405
|
+
# refute_in_delta Math::PI, (22.0 / 7.0)
|
406
|
+
#
|
407
|
+
def refute_in_delta: (untyped exp, untyped act, ?::Float delta, ?untyped? msg) -> untyped
|
408
|
+
|
409
|
+
# <!--
|
410
|
+
# rdoc-file=lib/minitest/assertions.rb
|
411
|
+
# - refute_in_epsilon(a, b, epsilon = 0.001, msg = nil)
|
412
|
+
# -->
|
413
|
+
# For comparing Floats. Fails if `exp` and `act` have a relative error less
|
414
|
+
# than `epsilon`.
|
415
|
+
#
|
416
|
+
def refute_in_epsilon: (untyped a, untyped b, ?::Float epsilon, ?untyped? msg) -> untyped
|
417
|
+
|
418
|
+
# <!--
|
419
|
+
# rdoc-file=lib/minitest/assertions.rb
|
420
|
+
# - refute_includes(collection, obj, msg = nil)
|
421
|
+
# -->
|
422
|
+
# Fails if `collection` includes `obj`.
|
423
|
+
#
|
424
|
+
def refute_includes: (untyped collection, untyped obj, ?untyped? msg) -> untyped
|
425
|
+
|
426
|
+
# <!--
|
427
|
+
# rdoc-file=lib/minitest/assertions.rb
|
428
|
+
# - refute_instance_of(cls, obj, msg = nil)
|
429
|
+
# -->
|
430
|
+
# Fails if `obj` is an instance of `cls`.
|
431
|
+
#
|
432
|
+
def refute_instance_of: (untyped cls, untyped obj, ?untyped? msg) -> untyped
|
433
|
+
|
434
|
+
# <!--
|
435
|
+
# rdoc-file=lib/minitest/assertions.rb
|
436
|
+
# - refute_kind_of(cls, obj, msg = nil)
|
437
|
+
# -->
|
438
|
+
# Fails if `obj` is a kind of `cls`.
|
439
|
+
#
|
440
|
+
def refute_kind_of: (untyped cls, untyped obj, ?untyped? msg) -> untyped
|
441
|
+
|
442
|
+
# <!--
|
443
|
+
# rdoc-file=lib/minitest/assertions.rb
|
444
|
+
# - refute_match(matcher, obj, msg = nil)
|
445
|
+
# -->
|
446
|
+
# Fails if `matcher` `=~` `obj`.
|
447
|
+
#
|
448
|
+
def refute_match: (untyped matcher, untyped obj, ?untyped? msg) -> untyped
|
449
|
+
|
450
|
+
# <!--
|
451
|
+
# rdoc-file=lib/minitest/assertions.rb
|
452
|
+
# - refute_nil(obj, msg = nil)
|
453
|
+
# -->
|
454
|
+
# Fails if `obj` is nil.
|
455
|
+
#
|
456
|
+
def refute_nil: (untyped obj, ?untyped? msg) -> untyped
|
457
|
+
|
458
|
+
# <!--
|
459
|
+
# rdoc-file=lib/minitest/assertions.rb
|
460
|
+
# - refute_operator(o1, op, o2 = UNDEFINED, msg = nil)
|
461
|
+
# -->
|
462
|
+
# Fails if `o1` is not `op` `o2`. Eg:
|
463
|
+
#
|
464
|
+
# refute_operator 1, :>, 2 #=> pass
|
465
|
+
# refute_operator 1, :<, 2 #=> fail
|
466
|
+
#
|
467
|
+
def refute_operator: (untyped o1, untyped op, ?untyped o2, ?untyped? msg) -> untyped
|
468
|
+
|
469
|
+
# <!--
|
470
|
+
# rdoc-file=lib/minitest/assertions.rb
|
471
|
+
# - refute_path_exists(path, msg = nil)
|
472
|
+
# -->
|
473
|
+
# Fails if `path` exists.
|
474
|
+
#
|
475
|
+
def refute_path_exists: (untyped path, ?untyped? msg) -> untyped
|
476
|
+
|
477
|
+
# <!--
|
478
|
+
# rdoc-file=lib/minitest/assertions.rb
|
479
|
+
# - refute_predicate(o1, op, msg = nil)
|
480
|
+
# -->
|
481
|
+
# For testing with predicates.
|
482
|
+
#
|
483
|
+
# refute_predicate str, :empty?
|
484
|
+
#
|
485
|
+
# This is really meant for specs and is front-ended by refute_operator:
|
486
|
+
#
|
487
|
+
# str.wont_be :empty?
|
488
|
+
#
|
489
|
+
def refute_predicate: (untyped o1, untyped op, ?untyped? msg) -> untyped
|
490
|
+
|
491
|
+
# <!--
|
492
|
+
# rdoc-file=lib/minitest/assertions.rb
|
493
|
+
# - refute_respond_to(obj, meth, msg = nil)
|
494
|
+
# -->
|
495
|
+
# Fails if `obj` responds to the message `meth`.
|
496
|
+
#
|
497
|
+
def refute_respond_to: (untyped obj, untyped meth, ?untyped? msg) -> untyped
|
498
|
+
|
499
|
+
# <!--
|
500
|
+
# rdoc-file=lib/minitest/assertions.rb
|
501
|
+
# - refute_same(exp, act, msg = nil)
|
502
|
+
# -->
|
503
|
+
# Fails if `exp` is the same (by object identity) as `act`.
|
504
|
+
#
|
505
|
+
def refute_same: (untyped exp, untyped act, ?untyped? msg) -> untyped
|
506
|
+
|
507
|
+
# <!--
|
508
|
+
# rdoc-file=lib/minitest/assertions.rb
|
509
|
+
# - skip(msg = nil, bt = caller)
|
510
|
+
# -->
|
511
|
+
# Skips the current run. If run in verbose-mode, the skipped run gets listed at
|
512
|
+
# the end of the run but doesn't cause a failure exit code.
|
513
|
+
#
|
514
|
+
def skip: (?untyped? msg, ?untyped bt) -> untyped
|
515
|
+
|
516
|
+
# <!--
|
517
|
+
# rdoc-file=lib/minitest/assertions.rb
|
518
|
+
# - skip_until(y,m,d,msg)
|
519
|
+
# -->
|
520
|
+
# Skips the current run until a given date (in the local time zone). This allows
|
521
|
+
# you to put some fixes on hold until a later date, but still holds you
|
522
|
+
# accountable and prevents you from forgetting it.
|
523
|
+
#
|
524
|
+
def skip_until: (untyped y, untyped m, untyped d, untyped msg) -> untyped
|
525
|
+
|
526
|
+
# <!--
|
527
|
+
# rdoc-file=lib/minitest/assertions.rb
|
528
|
+
# - skipped?()
|
529
|
+
# -->
|
530
|
+
# Was this testcase skipped? Meant for #teardown.
|
531
|
+
#
|
532
|
+
def skipped?: () -> untyped
|
533
|
+
|
534
|
+
# <!--
|
535
|
+
# rdoc-file=lib/minitest/mock.rb
|
536
|
+
# - assert_mock(mock)
|
537
|
+
# -->
|
538
|
+
# Assert that the mock verifies correctly.
|
539
|
+
#
|
540
|
+
def assert_mock: (untyped mock) -> untyped
|
541
|
+
|
542
|
+
E: String
|
543
|
+
|
544
|
+
UNDEFINED: Object
|
545
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
2
|
+
# The standard backtrace filter for minitest.
|
3
|
+
#
|
4
|
+
# See Minitest.backtrace_filter=.
|
5
|
+
#
|
6
|
+
class Minitest::BacktraceFilter
|
7
|
+
# <!--
|
8
|
+
# rdoc-file=lib/minitest.rb
|
9
|
+
# - filter(bt)
|
10
|
+
# -->
|
11
|
+
# Filter `bt` to something useful. Returns the whole thing if $DEBUG (ruby) or
|
12
|
+
# $MT_DEBUG (env).
|
13
|
+
#
|
14
|
+
def filter: (untyped bt) -> (::Array["No backtrace"] | untyped)
|
15
|
+
MT_RE: Regexp
|
16
|
+
end
|