raap 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3e9d7ac0f6d02b3bc1dce9ad5d49d47d0b73825cfdb60a9e2a9f60a7ab0538a4
4
+ data.tar.gz: 5e4204d5ce36b5b271ff715ad460533e27edd625c7e2b9a075d8d4e6db4ff6e0
5
+ SHA512:
6
+ metadata.gz: cd12a1a50335e228a4700dd048d66f835a0963b4dd7373a890c02c9975d1587c9929604d18b6ce51a1696ce67c3b15c9d9f2d06f76aa22e9a9f6f467c8ee3fbb
7
+ data.tar.gz: f1cb139f0169359bda70f3cbaa03db45f110941d7559531d4f5c02cc8c04ec477f22effb293a6e64db90218101069a9084255d4b75cf64aa0403af20cc4f910b
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-03-20
4
+
5
+ - Initial release
6
+
7
+ ## [0.0.0] - 2024-01-16
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at co000ri@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 ksss
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # RaaP
2
+
3
+ ## RBS as a Property
4
+
5
+ RaaP is a property based testing tool.
6
+
7
+ RaaP considers the RBS as a test case.
8
+
9
+ It generates random values for the method arguments for each type, and then calls the method.
10
+
11
+ The return value of the method is checked to see if it matches the type, if not, the test fails.
12
+
13
+ If you write an RBS, it becomes a test case.
14
+
15
+ ## Installation
16
+
17
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
18
+
19
+ Install the gem and add to the application's Gemfile by executing:
20
+
21
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
22
+
23
+ If bundler is not being used to manage dependencies, install the gem by executing:
24
+
25
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
26
+
27
+ ## Usage
28
+
29
+ ```
30
+ $ raap 'MyClass' # Run only RBS of MyClass
31
+ $ raap 'MyClass::*' # Run each class under MyClass
32
+ $ raap 'MyClass.singleton_method' # Run only MyClass.singleton_method
33
+ $ raap 'MyClass#instance_method' # Run only MyClass#instance_method
34
+ ```
35
+
36
+ ## Size
37
+
38
+ Random values are determined based on size.
39
+
40
+ For example, an Integer with size zero is `0` and an Array is `[]`.
41
+
42
+ RaaP, like other property-based tests, changes the size 100 times from 0 to 99 by default to generate test data.
43
+
44
+ ## Options
45
+
46
+ ### `-I PATH` or `--include PATH`
47
+
48
+ You can specify to load specify PATH as RBS.
49
+
50
+ ### `--library lib`
51
+
52
+ You can specify to load RBS library
53
+
54
+ ### `--require lib`
55
+
56
+ You can specify require Ruby library
57
+
58
+ ### `--timeout sec`
59
+
60
+ You can specify the number of seconds to consider a test case as a timeout.
61
+
62
+ ### `--size-from int`
63
+
64
+ You can specify size of start.
65
+
66
+ ### `--size-to int`
67
+
68
+ You can specify size of end.
69
+
70
+ ### `--size-by int`
71
+
72
+ You can specify size of step like `Integer#step: (to: Integer, by: Integer)`.
73
+
74
+ ## Achievements
75
+
76
+ RaaP has already found many RBS mistakes and bug in CRuby during the development phase.
77
+
78
+ * https://github.com/ruby/rbs/pull/1704
79
+ * https://github.com/ruby/rbs/pull/1706
80
+ * https://bugs.ruby-lang.org/issues/20292
81
+ * https://github.com/ruby/rbs/pull/1768
82
+ * https://github.com/ruby/rbs/pull/1769
83
+ * https://github.com/ruby/rbs/pull/1770
84
+ * https://github.com/ruby/rbs/pull/1771
85
+
86
+ ## Development
87
+
88
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
89
+
90
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
91
+
92
+ ## Contributing
93
+
94
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ksss/raap. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ksss/raap/blob/main/CODE_OF_CONDUCT.md).
95
+
96
+ ## License
97
+
98
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
99
+
100
+ ## Code of Conduct
101
+
102
+ Everyone interacting in the Raap project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ksss/raap/blob/main/CODE_OF_CONDUCT.md).
103
+
104
+ # TODO
105
+
106
+ - Embed testing tool.
107
+ - Implement skip solution.
108
+ - Configure by YAML?
109
+ - Support recursive type.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ task default: :test
data/Steepfile ADDED
@@ -0,0 +1,4 @@
1
+ target :lib do
2
+ check "lib"
3
+ signature "sig"
4
+ end
data/exe/raap ADDED
@@ -0,0 +1,3 @@
1
+ require 'raap'
2
+
3
+ RaaP::CLI.new(ARGV).load.run
@@ -0,0 +1,29 @@
1
+ module RaaP
2
+ module BindCall
3
+ class << self
4
+ def define_singleton_method(...) = ::Object.instance_method(:define_singleton_method).bind_call(...)
5
+ def respond_to?(...) = ::Kernel.instance_method(:respond_to?).bind_call(...)
6
+ def instance_of?(...) = ::Kernel.instance_method(:instance_of?).bind_call(...)
7
+ def is_a?(...) = ::Kernel.instance_method(:is_a?).bind_call(...)
8
+ def extend(...) = ::Kernel.instance_method(:extend).bind_call(...)
9
+ def name(...) = ::Module.instance_method(:name).bind_call(...)
10
+ def to_s(...) = ::Kernel.instance_method(:to_s).bind_call(...)
11
+
12
+ def class(obj)
13
+ if respond_to?(obj, :class)
14
+ obj.class
15
+ else
16
+ ::Kernel.instance_method(:class).bind_call(obj)
17
+ end
18
+ end
19
+
20
+ def inspect(obj)
21
+ if respond_to?(obj, :inspect)
22
+ obj.inspect
23
+ else
24
+ ::Kernel.instance_method(:inspect).bind_call(obj)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
data/lib/raap/cli.rb ADDED
@@ -0,0 +1,239 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RaaP
4
+ # $ raap Integer#pow
5
+ # $ raap -I sig RaaP::Type
6
+ class CLI
7
+ class << self
8
+ attr_accessor :option
9
+ end
10
+
11
+ Option = Struct.new(
12
+ :dirs,
13
+ :requires,
14
+ :libraries,
15
+ :timeout,
16
+ :size_from,
17
+ :size_to,
18
+ :size_by,
19
+ keyword_init: true
20
+ )
21
+
22
+ # defaults
23
+ self.option = Option.new(
24
+ dirs: [],
25
+ requires: [],
26
+ libraries: [],
27
+ timeout: 3,
28
+ size_from: 0,
29
+ size_to: 99,
30
+ size_by: 1,
31
+ )
32
+
33
+ def initialize(argv)
34
+ @argv = argv
35
+ end
36
+
37
+ def load
38
+ OptionParser.new do |o|
39
+ o.on('-I', '--include PATH') do |path|
40
+ CLI.option.dirs << path
41
+ end
42
+ o.on('--library lib', 'load rbs library') do |lib|
43
+ CLI.option.libraries << lib
44
+ end
45
+ o.on('--require lib', 'require ruby library') do |lib|
46
+ CLI.option.requires << lib
47
+ end
48
+ o.on('--log-level level', "default: warn") do |arg|
49
+ RaaP.logger.level = arg
50
+ end
51
+ o.on('--timeout sec', Integer, "default: #{CLI.option.timeout}") do |arg|
52
+ CLI.option.timeout = arg
53
+ end
54
+ o.on('--size-from int', Integer, "default: #{CLI.option.size_from}") do |arg|
55
+ CLI.option.size_from = arg
56
+ end
57
+ o.on('--size-to int', Integer, "default: #{CLI.option.size_to}") do |arg|
58
+ CLI.option.size_to = arg
59
+ end
60
+ o.on('--size-by int', Integer, "default: #{CLI.option.size_by}") do |arg|
61
+ CLI.option.size_by = arg
62
+ end
63
+ end.parse!(@argv)
64
+
65
+ CLI.option.dirs.each do |dir|
66
+ RaaP::RBS.loader.add(path: Pathname(dir))
67
+ end
68
+ CLI.option.libraries.each do |lib|
69
+ RaaP::RBS.loader.add(library: lib, version: nil)
70
+ end
71
+ CLI.option.requires.each do |lib|
72
+ require lib
73
+ end
74
+
75
+ self
76
+ end
77
+
78
+ def run
79
+ @argv.map do |tag|
80
+ case
81
+ when tag.include?('#')
82
+ run_by_instance(tag:)
83
+ when tag.include?('.')
84
+ run_by_singleton(tag:)
85
+ when tag.end_with?('*')
86
+ run_by_type_name_with_search(tag:)
87
+ else
88
+ run_by_type_name(tag:)
89
+ end
90
+ end.each do |ret|
91
+ ret.each do |methods|
92
+ methods.each do |status, method_name, method_type|
93
+ if status == 1
94
+ puts "Fail:"
95
+ puts "def #{method_name}: #{method_type}"
96
+ end
97
+ end
98
+ end
99
+ end
100
+
101
+ self
102
+ end
103
+
104
+ def run_by_instance(tag:)
105
+ t, m = tag.split('#', 2)
106
+ type = RBS.parse_type(t)
107
+ receiver_type = Type.new(type.to_s)
108
+ method_name = m.to_sym
109
+ definition = RBS.builder.build_instance(type.name)
110
+ type_params_decl = definition.type_params_decl
111
+ method = definition.methods[method_name]
112
+ raise "`#{tag}` is not found" unless method
113
+ puts "# #{type.to_s}"
114
+ puts
115
+ [
116
+ method.method_types.map do |method_type|
117
+ property(receiver_type:, type_params_decl:, method_type:, method_name:)
118
+ end
119
+ ]
120
+ end
121
+
122
+ def run_by_singleton(tag:)
123
+ t, m = tag.split('.', 2)
124
+ type = RBS.parse_type(t)
125
+ receiver_type = Type.new("singleton(#{type.name})")
126
+ method_name = m.to_sym
127
+ definition = RBS.builder.build_singleton(type.name)
128
+ method = definition.methods[method_name]
129
+ type_params_decl = definition.type_params_decl
130
+ raise "`#{tag}` not found" unless method
131
+ puts "# #{type}"
132
+ puts
133
+ [
134
+ method.method_types.map do |method_type|
135
+ property(receiver_type:, type_params_decl:, method_type:, method_name:)
136
+ end
137
+ ]
138
+ end
139
+
140
+ def run_by_type_name_with_search(tag:)
141
+ first, _last = tag.split('::')
142
+ ret = []
143
+ RBS.env.class_decls.each do |name, entry|
144
+ if ['', '::'].any? { |pre| name.to_s.match?(/\A#{pre}#{first}\b/) }
145
+ ret << run_by_type_name(tag: name.to_s)
146
+ end
147
+ end
148
+ ret.flatten(1)
149
+ end
150
+
151
+ def run_by_type_name(tag:)
152
+ type = RBS.parse_type(tag)
153
+ type_name = type.name.absolute!
154
+
155
+ ret = []
156
+
157
+ definition = RBS.builder.build_singleton(type_name)
158
+ type_params_decl = definition.type_params_decl
159
+ definition.methods.filter_map do |method_name, method|
160
+ next if method.defined_in != type_name
161
+ next if method_name == :fork || method_name == :spawn # TODO: skip solution
162
+ puts "# #{type_name}.#{method_name}"
163
+ puts
164
+ ret << method.method_types.map do |method_type|
165
+ property(receiver_type: Type.new("singleton(#{type})"), type_params_decl:, method_type:, method_name:)
166
+ end
167
+ end
168
+
169
+ definition = RBS.builder.build_instance(type_name)
170
+ type_params_decl = definition.type_params_decl
171
+ definition.methods.filter_map do |method_name, method|
172
+ next if method.defined_in != type_name
173
+ next if method_name == :fork || method_name == :spawn # TODO: skip solution
174
+ puts "# #{type_name}##{method_name}"
175
+ puts
176
+ ret << method.method_types.map do |method_type|
177
+ property(receiver_type: Type.new(type.to_s), type_params_decl:, method_type:, method_name:)
178
+ end
179
+ end
180
+
181
+ ret
182
+ end
183
+
184
+ def property(receiver_type:, type_params_decl:, method_type:, method_name:)
185
+ if receiver_type.type.instance_of?(::RBS::Types::ClassSingleton)
186
+ prefix = 'self.'
187
+ type_args = []
188
+ else
189
+ prefix = ''
190
+ type_args = receiver_type.type.args
191
+ end
192
+ puts "## def #{prefix}#{method_name}: #{method_type}"
193
+ status = 0
194
+ stats = MethodProperty.new(
195
+ receiver_type:,
196
+ method_name: method_name,
197
+ method_type: MethodType.new(
198
+ method_type,
199
+ type_params_decl:,
200
+ type_args:,
201
+ self_type: receiver_type.type,
202
+ instance_type: ::RBS::Types::ClassInstance.new(name: receiver_type.type.name, args: type_args, location: nil),
203
+ class_type: ::RBS::Types::ClassSingleton.new(name: receiver_type.type.name, location: nil),
204
+ ),
205
+ size_step: CLI.option.size_from.step(to: CLI.option.size_to, by: CLI.option.size_by),
206
+ timeout: CLI.option.timeout,
207
+ ).run do |called|
208
+ case called
209
+ in Result::Success => s
210
+ RaaP.logger.debug { "Success: #{s.called_str}" }
211
+ print '.'
212
+ in Result::Failure => f
213
+ puts 'F'
214
+ puts "Failed in case of `#{f.called_str}`"
215
+ puts
216
+ RaaP.logger.debug { PP.pp(f.symbolic_call, ''.dup) }
217
+ puts "# call stack:"
218
+ puts
219
+ puts "```"
220
+ puts SymbolicCaller.new(f.symbolic_call).to_lines.join("\n")
221
+ puts "```"
222
+ status = 1
223
+ throw :break
224
+ in Result::Skip => s
225
+ print 'S'
226
+ in Result::Exception => e
227
+ RaaP.logger.info("#{e.exception.class}: #{e.exception.message}")
228
+ RaaP.logger.debug(e.exception.backtrace.join("\n"))
229
+ print 'E'
230
+ end
231
+ end
232
+ puts
233
+ puts "success: #{stats.success}, skip: #{stats.skip}, exception: #{stats.exception}"
234
+ puts
235
+
236
+ [status, method_name, method_type]
237
+ end
238
+ end
239
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RaaP
4
+ class FunctionType
5
+ def initialize(fun)
6
+ @fun = fun
7
+ end
8
+
9
+ def pick_arguments(size: 10, eval: true)
10
+ a = recursive_pick(build_args_type, size:, eval:)
11
+ k = recursive_pick(build_kwargs_type, size:, eval:)
12
+
13
+ [a, k]
14
+ end
15
+
16
+ private
17
+
18
+ def recursive_pick(type, size:, eval:)
19
+ case
20
+ when type.nil?
21
+ nil
22
+ when type.respond_to?(:each_pair)
23
+ type.each_pair.to_h { |k, v| [k, recursive_pick(v, size:, eval:)] }
24
+ when type.respond_to?(:each)
25
+ type.each.map { |v| recursive_pick(v, size:, eval:) }
26
+ else
27
+ type.pick(size:, eval:)
28
+ end
29
+ end
30
+
31
+ def build_args_type
32
+ reqs = @fun.required_positionals.map { |param| Type.new(param.type) }
33
+ tras = @fun.trailing_positionals.map { |param| Type.new(param.type) }
34
+ sampled_optional_positionals = @fun.optional_positionals.sample(Random.rand(@fun.optional_positionals.length + 1))
35
+ opts = sampled_optional_positionals.map { |param| Type.new(param.type) }
36
+ rest = []
37
+ if param = @fun.rest_positionals
38
+ rest = Array.new(Random.rand(0..3)) { Type.new(param.type) }
39
+ end
40
+ [reqs, opts, rest, tras].flatten
41
+ end
42
+
43
+ def build_kwargs_type
44
+ reqs = @fun.required_keywords.transform_values { |param| Type.new(param.type) }
45
+ rand = Random.rand(@fun.optional_keywords.length + 1)
46
+ opts = @fun.optional_keywords.to_a.sample(rand).to_h { |name, param| [name, Type.new(param.type)] }
47
+ kwargs = reqs.to_h.merge(opts)
48
+ if param = @fun.rest_keywords
49
+ keys = Array.new(Random.rand(0..3)) do
50
+ random_key = nil
51
+ loop do
52
+ # @type var random_key: Symbol
53
+ random_key = Type.new("Symbol").pick(size: 6)
54
+ break unless kwargs.key?(random_key)
55
+ end
56
+ [random_key, Type.new(param.type)]
57
+ end
58
+ kwargs.merge!(keys.to_h)
59
+ end
60
+ kwargs
61
+ end
62
+ end
63
+ end