rbs 3.7.0.dev.1 → 3.7.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/ruby.yml +1 -1
- data/.github/workflows/windows.yml +5 -3
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +53 -0
- data/Rakefile +23 -0
- data/config.yml +311 -0
- data/core/dir.rbs +1 -1
- data/core/kernel.rbs +2 -2
- data/core/process.rbs +1 -1
- data/core/set.rbs +1 -1
- data/docs/syntax.md +6 -4
- data/ext/rbs_extension/extconf.rb +10 -0
- data/ext/rbs_extension/parser.c +103 -110
- data/ext/rbs_extension/rbs_extension.h +1 -2
- data/{ext/rbs_extension → include/rbs}/constants.h +21 -19
- data/include/rbs/ruby_objs.h +72 -0
- data/include/rbs.h +7 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +34 -5
- data/lib/rbs/collection/config.rb +2 -2
- data/lib/rbs/environment_loader.rb +5 -0
- data/lib/rbs/prototype/rb.rb +7 -3
- data/lib/rbs/types.rb +10 -3
- data/lib/rbs/version.rb +1 -1
- data/sig/ancestor_graph.rbs +1 -1
- data/sig/collection/config/lockfile_generator.rbs +9 -1
- data/sig/definition.rbs +1 -1
- data/sig/definition_builder.rbs +1 -1
- data/sig/environment.rbs +1 -1
- data/sig/prototype/rb.rbs +1 -1
- data/sig/type_alias_dependency.rbs +2 -2
- data/sig/type_alias_regularity.rbs +1 -1
- data/sig/type_param.rbs +3 -3
- data/sig/vendorer.rbs +1 -1
- data/{ext/rbs_extension → src}/constants.c +35 -36
- data/src/ruby_objs.c +793 -0
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/csv/0/manifest.yaml +1 -0
- data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -1
- data/stdlib/json/0/json.rbs +1 -1
- data/stdlib/minitest/0/kernel.rbs +2 -2
- data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
- data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
- data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
- data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
- data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
- data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
- data/stdlib/minitest/0/minitest/compress.rbs +13 -0
- data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
- data/stdlib/minitest/0/minitest/mock.rbs +9 -5
- data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
- data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
- data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
- data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
- data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
- data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
- data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
- data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
- data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
- data/stdlib/minitest/0/minitest/spec.rbs +1 -1
- data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
- data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
- data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +1 -1
- data/stdlib/minitest/0/minitest/test.rbs +7 -14
- data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
- data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
- data/stdlib/minitest/0/minitest/unit.rbs +1 -2
- data/stdlib/minitest/0/minitest.rbs +41 -892
- data/stdlib/open-uri/0/manifest.yaml +1 -0
- data/stdlib/openssl/0/manifest.yaml +1 -0
- data/stdlib/openssl/0/openssl.rbs +26 -1
- data/stdlib/psych/0/core_ext.rbs +12 -0
- data/templates/include/rbs/constants.h.erb +20 -0
- data/templates/include/rbs/ruby_objs.h.erb +10 -0
- data/templates/src/constants.c.erb +36 -0
- data/templates/src/ruby_objs.c.erb +27 -0
- data/templates/template.rb +122 -0
- metadata +19 -9
- data/ext/rbs_extension/ruby_objs.c +0 -602
- data/ext/rbs_extension/ruby_objs.h +0 -51
- data/stdlib/minitest/0/manifest.yaml +0 -2
- /data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +0 -0
data/stdlib/cgi/0/manifest.yaml
CHANGED
data/stdlib/csv/0/manifest.yaml
CHANGED
data/stdlib/json/0/json.rbs
CHANGED
@@ -32,11 +32,11 @@ module Kernel : ::BasicObject
|
|
32
32
|
#
|
33
33
|
# For some suggestions on how to improve your specs, try:
|
34
34
|
#
|
35
|
-
#
|
35
|
+
# https://betterspecs.org
|
36
36
|
#
|
37
37
|
# but do note that several items there are debatable or specific to rspec.
|
38
38
|
#
|
39
39
|
# For more information about expectations, see Minitest::Expectations.
|
40
40
|
#
|
41
|
-
private def describe: (untyped desc, *untyped additional_desc)
|
41
|
+
private def describe: (untyped desc, *untyped additional_desc) { (?) -> untyped } -> untyped
|
42
42
|
end
|
@@ -3,6 +3,9 @@
|
|
3
3
|
# Go nuts.
|
4
4
|
#
|
5
5
|
class Minitest::AbstractReporter
|
6
|
+
@mutex: untyped
|
7
|
+
def initialize: () -> void
|
8
|
+
|
6
9
|
# <!--
|
7
10
|
# rdoc-file=lib/minitest.rb
|
8
11
|
# - start()
|
@@ -45,5 +48,5 @@ class Minitest::AbstractReporter
|
|
45
48
|
# Did this run pass?
|
46
49
|
#
|
47
50
|
def passed?: () -> true
|
48
|
-
|
51
|
+
def synchronize: () { (?) -> untyped } -> untyped
|
49
52
|
end
|
@@ -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)
|
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,
|
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
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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:
|
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:
|
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:
|
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:
|
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:
|
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
|
@@ -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
|
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)
|
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,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!()
|
@@ -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) -> (
|
9
|
+
def prerecord: (untyped klass, untyped name) -> (nil | untyped)
|
10
10
|
def record: (untyped result) -> untyped
|
11
11
|
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
|
-
|
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
|