raap 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/sig/raap.rbs CHANGED
@@ -7,7 +7,7 @@ module RaaP
7
7
 
8
8
  module BindCall
9
9
  def self.define_singleton_method: (untyped, Symbol) { (*untyped, **untyped) -> untyped } -> void
10
- def self.respond_to?: (untyped, Symbol, ?bool) -> bool
10
+ def self.respond_to?: (untyped, untyped, ?boolish) -> bool
11
11
  def self.instance_of?: (untyped, Module) -> bool
12
12
  def self.is_a?: (untyped, Module) -> bool
13
13
  def self.extend: (untyped, Module) -> void
@@ -19,15 +19,15 @@ module RaaP
19
19
 
20
20
  class CLI
21
21
  class Option < ::Struct[untyped]
22
- def self.new: (?dirs: ::Array[String], ?requires: ::Array[String], ?libraries: ::Array[String], ?timeout: (Integer | Float | nil), ?size_from: ::Integer, ?size_to: ::Integer, ?size_by: ::Integer) -> instance
22
+ def self.new: (?dirs: ::Array[String], ?requires: ::Array[String], ?libraries: ::Array[String], ?timeout: (Integer | Float | nil), ?size_from: ::Integer, ?size_to: ::Integer, ?size_by: ::Integer, ?allow_private: bool, ?skips: ::Array[::String]) -> instance
23
23
 
24
- def self.[]: (?dirs: ::Array[String], ?requires: ::Array[String], ?libraries: ::Array[String], ?timeout: (Integer | Float | nil), ?size_from: ::Integer, ?size_to: ::Integer, ?size_by: ::Integer) -> instance
24
+ def self.[]: (?dirs: ::Array[String], ?requires: ::Array[String], ?libraries: ::Array[String], ?timeout: (Integer | Float | nil), ?size_from: ::Integer, ?size_to: ::Integer, ?size_by: ::Integer, ?allow_private: bool, ?skips: ::Array[::String]) -> instance
25
25
 
26
26
  def self.keyword_init?: () -> true
27
27
 
28
- def self.members: () -> [ :dirs, :requires, :library, :timeout, :size_from, :size_to, :size_by]
28
+ def self.members: () -> [ :dirs, :requires, :library, :timeout, :size_from, :size_to, :size_by, :allow_private, :skips]
29
29
 
30
- def members: () -> [ :dirs, :requires, :library, :timeout, :size_from, :size_to, :size_by]
30
+ def members: () -> [ :dirs, :requires, :library, :timeout, :size_from, :size_to, :size_by, :allow_private, :skips]
31
31
 
32
32
  attr_accessor dirs: ::Array[String]
33
33
 
@@ -42,35 +42,45 @@ module RaaP
42
42
  attr_accessor size_to: ::Integer
43
43
 
44
44
  attr_accessor size_by: ::Integer
45
+
46
+ attr_accessor allow_private: bool
47
+
48
+ attr_accessor skips: ::Array[String]
45
49
  end
46
50
 
51
+ type property_result = [Integer, Symbol, ::RBS::MethodType, StringIO?]
52
+
53
+ DEFAULT_SKIP: ::Set[String]
54
+
47
55
  @argv: Array[String]
56
+ @results: Array[{ method: ::RBS::Definition::Method, properties: Array[property_result] }]
48
57
 
49
58
  def self.option: () -> Option
50
59
  def self.option=: (Option) -> void
51
60
 
52
61
  def initialize: (Array[String]) -> void
53
62
  def load: () -> self
63
+ def run: () -> Integer
54
64
 
55
- type property_result = [Integer, Symbol, ::RBS::MethodType]
56
- def run: () -> self
57
- def run_by: (tag: String) -> Array[Array[property_result]]
58
- def run_by_instance: (tag: String) -> Array[Array[property_result]]
59
- def run_by_singleton: (tag: String) -> Array[Array[property_result]]
60
- def run_by_type_name: (tag: String) -> Array[Array[property_result]]
61
- def run_by_type_name_with_search: (tag: String) -> Array[Array[property_result]]
62
- def property: (receiver_type: Type, type_params_decl: Array[::RBS::AST::TypeParam], method_name: Symbol, method_type: ::RBS::MethodType) -> property_result
65
+ private
66
+
67
+ def run_by: (kind: (:instance | :singleton), tag: String) -> void
68
+ def run_by_type_name: (tag: String) -> void
69
+ def run_by_type_name_with_search: (tag: String) -> void
70
+ def property: (receiver_type: Type, type_params_decl: Array[::RBS::AST::TypeParam], type_args: Array[::RBS::Types::t], method_name: Symbol, method_type: ::RBS::MethodType) -> property_result
71
+ def report: () -> Integer
63
72
  end
64
73
 
65
74
  class FunctionType
66
75
  @fun: ::RBS::Types::Function
67
76
 
68
77
  def initialize: (::RBS::Types::Function) -> void
69
- def pick_arguments: (?size: Integer, ?eval: bool) -> [Array[untyped], Hash[Symbol, untyped]]
78
+ def pick_arguments: (?size: Integer) -> [Array[untyped], Hash[Symbol, untyped]]
79
+ def arguments_to_symbolic_call: (?size: Integer) -> [Array[untyped], Hash[Symbol, untyped]]
70
80
 
71
81
  private
72
82
 
73
- def recursive_pick: (untyped, size: Integer, eval: bool) -> untyped
83
+ def to_symbolic_call_recursive: (untyped, size: Integer) -> untyped
74
84
  def build_args_type: () -> Array[Type]
75
85
  def build_kwargs_type: () -> Hash[Symbol, Type]
76
86
  end
@@ -80,19 +90,23 @@ module RaaP
80
90
  attr_accessor success: Integer
81
91
  attr_accessor skip: Integer
82
92
  attr_accessor exception: Integer
93
+ attr_accessor break: bool
83
94
  end
84
- attr_reader receiver_type: Type
85
- attr_reader method_name: Symbol
86
- attr_reader method_type: MethodType
87
- attr_reader size_step: _Each[Integer]
88
- attr_reader timeout: (Integer | Float | nil)
89
- def initialize: (receiver_type: Type, method_name: Symbol, method_type: MethodType, size_step: _Each[Integer], timeout: (Integer | Float | nil)) -> void
95
+
96
+ @receiver_type: Type
97
+ @method_name: Symbol
98
+ @method_type: MethodType
99
+ @size_step: _Each[Integer]
100
+ @timeout: (Integer | Float | nil)
101
+ @allow_private: bool
102
+
103
+ def initialize: (receiver_type: Type, method_name: Symbol, method_type: MethodType, size_step: _Each[Integer], timeout: (Integer | Float | nil), ?allow_private: bool) -> void
90
104
  def run: () { (Result::Success | Result::Failure | Result::Skip | Result::Exception) -> void } -> Stats
91
105
 
92
106
  private
93
107
 
94
108
  def call: (size: Integer, stats: Stats) -> (Result::Success | Result::Failure | Result::Skip | Result::Exception)
95
- def check_return: (receiver_value: untyped, return_value: untyped, method_type: MethodType) -> bool
109
+ def check_return: (receiver_value: untyped, return_value: untyped) -> ([Symbol] | [Symbol, Exception])
96
110
  def return_type: () -> RBS::Types::t
97
111
  end
98
112
 
@@ -101,35 +115,12 @@ module RaaP
101
115
  @fun_type: FunctionType
102
116
 
103
117
  def initialize: (::RBS::MethodType | String method, ?type_params_decl: Array[untyped], ?type_args: Array[untyped], ?self_type: ::RBS::Types::ClassInstance?, ?instance_type: ::RBS::Types::ClassInstance?, ?class_type: ::RBS::Types::ClassSingleton?) -> void
104
- def pick_arguments: (?size: Integer, ?eval: bool) -> [Array[untyped], Hash[Symbol, untyped], ::Proc?]
105
- def pick_block: (?size: Integer, ?eval: bool) -> ::Proc?
118
+ def pick_arguments: (?size: Integer) -> [Array[untyped], Hash[Symbol, untyped], ::Proc?]
119
+ def arguments_to_symbolic_call: (?size: Integer) -> [Array[untyped], Hash[Symbol, untyped], ::Proc?]
120
+ def pick_block: (?size: Integer) -> ::Proc?
106
121
  def check_return: (untyped) -> bool
107
122
  end
108
123
 
109
- class MethodValue < Data
110
- def self.new: (untyped receiver_value, [Array[untyped], Hash[Symbol, untyped], ::Proc?] arguments, Symbol method_name, Integer size) -> instance
111
- | (receiver_value: untyped, arguments: [Array[untyped], Hash[Symbol, untyped], ::Proc?], method_name: Symbol, size: Integer) -> instance
112
-
113
- def self.[]: (untyped receiver_value, [Array[untyped], Hash[Symbol, untyped], ::Proc?] arguments, Symbol method_name, Integer size) -> instance
114
- | (receiver_value: untyped, arguments: [Array[untyped], Hash[Symbol, untyped], ::Proc?], method_name: Symbol, size: Integer) -> instance
115
-
116
- def self.members: () -> [ :receiver_value, :arguments, :method_name, :size ]
117
- def members: () -> [ :receiver_value, :arguments, :method_name, :size ]
118
-
119
- attr_reader receiver_value: untyped
120
- attr_reader arguments: [Array[untyped], Hash[Symbol, untyped], ::Proc?]
121
- attr_reader method_name: Symbol
122
- attr_reader size: Integer
123
-
124
- def to_symbolic_call: () -> symbolic_call
125
- def call_str: () -> String
126
-
127
- private
128
-
129
- def argument_str: () -> String
130
- def block_str: () -> String?
131
- end
132
-
133
124
  module Minitest
134
125
  end
135
126
 
@@ -142,37 +133,46 @@ module RaaP
142
133
  def self.env: () -> ::RBS::Environment
143
134
  def self.loader: () -> ::RBS::EnvironmentLoader
144
135
  def self.parse_type: (String) -> ::RBS::Types::t
136
+ def self.parse_method_type: (String) -> ::RBS::MethodType
137
+ def self.find_alias_decl: (::RBS::TypeName, Symbol) -> ::RBS::AST::Members::Alias?
145
138
  end
146
139
 
147
140
  module Result
148
- interface _MethodValueReturnValue
149
- def method_value: () -> MethodValue
141
+ interface _ReturnValue
150
142
  def return_value: () -> untyped
151
143
  end
152
- module CalledStr : _MethodValueReturnValue
153
- def called_str: () -> String
144
+
145
+ module ReturnValueWithType : _ReturnValue
146
+ def return_value_with_type: () -> String
147
+
148
+ private
149
+
150
+ def return_value_to_type: (untyped) -> String
154
151
  end
152
+
155
153
  class Success < Data
156
- def self.new: (method_value: MethodValue, return_value: untyped) -> instance
157
- attr_reader method_value: MethodValue
154
+ include ReturnValueWithType
155
+ def self.new: (symbolic_call: symbolic_call, return_value: untyped) -> instance
156
+ attr_reader symbolic_call: symbolic_call
158
157
  attr_reader return_value: untyped
159
- include CalledStr
158
+ def called_str: () -> String
160
159
  end
161
160
  class Failure < Data
162
- def self.new: (method_value: MethodValue, return_value: untyped, symbolic_call: symbolic_call) -> instance
163
- attr_reader method_value: MethodValue
164
- attr_reader return_value: untyped
161
+ include ReturnValueWithType
162
+ def self.new: (symbolic_call: symbolic_call, return_value: untyped, ?exception: ::Exception?) -> instance
165
163
  attr_reader symbolic_call: symbolic_call
166
- include CalledStr
164
+ attr_reader return_value: untyped
165
+ attr_reader exception: ::Exception?
166
+ def called_str: () -> String
167
167
  end
168
168
  class Skip < Data
169
- def self.new: (method_value: MethodValue?, exception: ::Exception) -> instance
170
- attr_reader method_value: MethodValue?
169
+ def self.new: (symbolic_call: symbolic_call?, exception: ::Exception) -> instance
170
+ attr_reader symbolic_call: symbolic_call?
171
171
  attr_reader exception: ::Exception
172
172
  end
173
173
  class Exception < Data
174
- def self.new: (method_value: MethodValue?, exception: ::Exception) -> instance
175
- attr_reader method_value: MethodValue?
174
+ def self.new: (symbolic_call: symbolic_call?, exception: ::Exception) -> instance
175
+ attr_reader symbolic_call: symbolic_call?
176
176
  attr_reader exception: ::Exception
177
177
  end
178
178
  end
@@ -196,14 +196,18 @@ module RaaP
196
196
  end
197
197
 
198
198
  attr_reader symbolic_call: untyped
199
- def initialize: (untyped) -> void
199
+ attr_reader allow_private: bool
200
+
201
+ def initialize: (untyped, ?allow_private: bool) -> void
200
202
  def eval: () -> untyped
201
- def walk: () ?{ (symbolic_call) -> untyped} -> untyped
203
+ def call_str: () -> String
202
204
  def to_lines: () -> Array[String]
203
205
 
204
206
  private
205
207
 
206
- def _walk: (untyped) ?{ (symbolic_call) -> untyped} -> untyped
208
+ def try_eval: (untyped) -> untyped
209
+ def walk: () ?{ (symbolic_call) -> untyped} -> untyped
210
+ def _walk: (untyped, bool is_last) ?{ (symbolic_call) -> untyped} -> untyped
207
211
  def eval_one: (symbolic_call) -> untyped
208
212
  def var_name: (Module) -> String
209
213
  def printable?: (untyped) -> bool
@@ -237,9 +241,11 @@ module RaaP
237
241
 
238
242
  GENERATORS: Hash[String, ^() -> Sized[untyped]]
239
243
  SIMPLE_SOURCE: Array[String]
240
- RECURSION: Hash[String, :found | :logged]
241
244
 
242
245
  def self.register: (String) { () [self: instance] -> Sized[untyped] } -> void
246
+ def self.random: () -> Type
247
+ def self.random_without_basic_object: () -> Type
248
+
243
249
  attr_reader type: ::RBS::Types::t
244
250
  attr_reader range: Range[untyped]
245
251
 
@@ -250,13 +256,14 @@ module RaaP
250
256
  def such_that: () { (untyped) -> boolish } -> self
251
257
 
252
258
  # Basic API for materializing values
253
- def pick: (?size: Integer, ?eval: bool) -> untyped
259
+ def pick: (?size: Integer) -> untyped
260
+ def to_symbolic_caller: (?size: Integer) -> SymbolicCaller
254
261
  def to_symbolic_call: (?size: Integer) -> untyped
255
262
  def sized: [T] () { (Integer size) -> T } -> Sized[T]
256
263
 
257
264
  private
258
265
 
259
- def pick_from_initialize: (::RBS::Types::ClassInstance, size: Integer) -> (symbolic_call | Value::Module)
266
+ def to_symbolic_call_from_initialize: (::RBS::Types::ClassInstance, size: Integer) -> (symbolic_call | Value::Module)
260
267
  def parse: (String | ::RBS::Types::t) -> ::RBS::Types::t?
261
268
  def try: (times: Integer, size: Integer) { (Integer size) -> untyped } -> untyped
262
269
 
@@ -269,9 +276,9 @@ module RaaP
269
276
  def string: () -> Sized[String]
270
277
  def symbol: () -> Sized[Symbol]
271
278
  def array: (Type) -> Sized[Array[untyped]]
279
+ def dict: (Type, Type) -> Sized[Hash[untyped, untyped]]
272
280
  def encoding: () -> Sized[symbolic_call]
273
281
  def bool: () -> Sized[bool]
274
- def untyped: () -> Sized[untyped]
275
282
  def temp_method_object: () -> ::Method
276
283
  end
277
284
 
@@ -285,8 +292,11 @@ module RaaP
285
292
  @type: ::RBS::Types::Interface
286
293
  @size: Integer
287
294
  @definition: ::RBS::Definition
295
+ @fixed_return_value: untyped
296
+ @fixed_block_arguments: Array[untyped]
288
297
 
289
- def initialize: (String | ::RBS::Types::Interface, ?size: Integer) -> void
298
+ def initialize: (String | ::RBS::Types::Interface | String, ?size: Integer) -> void
299
+ def respond_to?: (Symbol, ?boolish) -> bool
290
300
  def inspect: () -> String
291
301
  def class: () -> class
292
302
  end
@@ -296,15 +306,19 @@ module RaaP
296
306
  @children: Array[Type]
297
307
  @size: Integer
298
308
 
299
- def initialize: (::RBS::Types::Intersection, size: Integer) -> void
309
+ def initialize: (::RBS::Types::Intersection | String, ?size: Integer) -> void
310
+ def respond_to?: (Symbol, ?boolish) -> bool
300
311
  def inspect: () -> String
301
312
  def class: () -> class
302
313
  end
303
314
 
304
315
  class Module < BasicObject
305
- attr_reader type: ::RBS::Types::ClassInstance
316
+ @type: ::RBS::Types::ClassInstance
317
+ @size: Integer
318
+ @self_type: untyped
306
319
 
307
- def initialize: (::RBS::Types::ClassInstance) -> void
320
+ def initialize: (::RBS::Types::ClassInstance | String, ?size: Integer) -> void
321
+ def respond_to?: (Symbol, ?boolish) -> bool
308
322
  def inspect: () -> String
309
323
  def class: () -> class
310
324
  end
@@ -317,7 +331,7 @@ module RaaP
317
331
  class Variable < BasicObject
318
332
  attr_reader type: ::RBS::Types::Variable
319
333
 
320
- def initialize: (::RBS::Types::Variable) -> void
334
+ def initialize: (::RBS::Types::Variable | String | Symbol) -> void
321
335
  def inspect: () -> String
322
336
  def class: () -> class
323
337
  end
data/sig/shims.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Timeout
2
+ class ExitException < Exception
3
+ end
4
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-23 00:00:00.000000000 Z
11
+ date: 2024-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: timeout
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '0.4'
41
41
  description: Property based testing tool with RBS
42
42
  email:
43
43
  - co000ri@gmail.com
@@ -46,6 +46,7 @@ executables:
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
+ - ".rubocop.yml"
49
50
  - CHANGELOG.md
50
51
  - CODE_OF_CONDUCT.md
51
52
  - LICENSE.txt
@@ -59,7 +60,6 @@ files:
59
60
  - lib/raap/function_type.rb
60
61
  - lib/raap/method_property.rb
61
62
  - lib/raap/method_type.rb
62
- - lib/raap/method_value.rb
63
63
  - lib/raap/minitest.rb
64
64
  - lib/raap/rbs.rb
65
65
  - lib/raap/result.rb
@@ -76,16 +76,16 @@ files:
76
76
  - lib/raap/value/variable.rb
77
77
  - lib/raap/value/void.rb
78
78
  - lib/raap/version.rb
79
+ - public/jacket.webp
79
80
  - rbs_collection.lock.yaml
80
81
  - rbs_collection.yaml
81
82
  - sig/raap.rbs
83
+ - sig/shims.rbs
82
84
  homepage: https://github.com/ksss/raap
83
85
  licenses:
84
86
  - MIT
85
87
  metadata:
86
- homepage_uri: https://github.com/ksss/raap
87
- source_code_uri: https://github.com/ksss/raap
88
- changelog_uri: https://github.com/ksss/raap
88
+ rubygems_mfa_required: 'true'
89
89
  post_install_message:
90
90
  rdoc_options: []
91
91
  require_paths:
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RaaP
4
- class MethodValue < Data.define(
5
- :receiver_value,
6
- :arguments,
7
- :method_name,
8
- :size
9
- )
10
- def to_symbolic_call
11
- args, kwargs, block = arguments
12
- [:call, receiver_value, method_name, args, kwargs, block]
13
- end
14
-
15
- def call_str
16
- r = SymbolicCaller.new(receiver_value).eval
17
- "#{BindCall.inspect(r)}.#{method_name}(#{argument_str})#{block_str}"
18
- end
19
-
20
- private
21
-
22
- def argument_str
23
- args, kwargs, _ = SymbolicCaller.new(arguments).eval
24
-
25
- r = []
26
- r << args.map(&:inspect).join(', ') if !args.empty?
27
- r << kwargs.map { |k ,v| "#{k}: #{BindCall.inspect(v)}" }.join(', ') if !kwargs.empty?
28
- r.join(', ')
29
- end
30
-
31
- def block_str
32
- _, _, block = SymbolicCaller.new(arguments).eval
33
- if block
34
- "{ }"
35
- end
36
- end
37
- end
38
- end