raap 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/lib/raap/cli.rb +14 -2
- data/lib/raap/method_property.rb +21 -25
- data/lib/raap/result.rb +10 -5
- data/lib/raap/symbolic_caller.rb +43 -19
- data/lib/raap/type.rb +13 -13
- data/lib/raap/value/module.rb +3 -2
- data/lib/raap/version.rb +1 -1
- data/lib/raap.rb +0 -1
- data/sig/raap.rbs +32 -47
- metadata +2 -3
- data/lib/raap/method_value.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 507ed156280ed3e0db1f2eb454bb03c57aa473d537d8c6ea5905ad852eba550d
|
4
|
+
data.tar.gz: 3108fa50c664702f79141a3c0b5e83934d6742468d1d51bfb2febb5b64a00b12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 269e220d72b9861881de860a71a2adff318105595880fe73e86492e255c9bb32fbeff7ac3685b83ea11d792a02b1509eb969d9956483a9415608530a3f8806bd
|
7
|
+
data.tar.gz: df4e40973681eb292d7844aa5ed1427b7155f619c6ebea53792149f430ab28e42a0a0f52df9517a3af9af1e08494eaccdd8d4d84313c9d24184f6403a51e1dc5
|
data/README.md
CHANGED
@@ -78,6 +78,21 @@ For example, an Integer with size zero is `0` and an Array is `[]`.
|
|
78
78
|
|
79
79
|
RaaP, like other property-based tests, changes the size 100 times from 0 to 99 by default to generate test data.
|
80
80
|
|
81
|
+
## Symbolic call
|
82
|
+
|
83
|
+
You may possibly see the following data structure in the debug logs.
|
84
|
+
|
85
|
+
```rb
|
86
|
+
[:call, Object, :method, [], {}, nil]
|
87
|
+
```
|
88
|
+
|
89
|
+
This is a data structure of the state of the method call.
|
90
|
+
|
91
|
+
Symbolic call is a tuple beginning with `:call`, followed by the receiver, method name, positional arguments, keyword arguments, and block arguments, in that order.
|
92
|
+
And the receiver and arguments are nestable.
|
93
|
+
|
94
|
+
It is used in QuickCheck and Proper to keep as much history of method calls as possible.
|
95
|
+
|
81
96
|
## Options
|
82
97
|
|
83
98
|
### `-I PATH` or `--include PATH`
|
data/lib/raap/cli.rb
CHANGED
@@ -16,6 +16,7 @@ module RaaP
|
|
16
16
|
:size_from,
|
17
17
|
:size_to,
|
18
18
|
:size_by,
|
19
|
+
:allow_private,
|
19
20
|
keyword_init: true
|
20
21
|
)
|
21
22
|
|
@@ -28,6 +29,7 @@ module RaaP
|
|
28
29
|
size_from: 0,
|
29
30
|
size_to: 99,
|
30
31
|
size_by: 1,
|
32
|
+
allow_private: false,
|
31
33
|
)
|
32
34
|
|
33
35
|
def initialize(argv)
|
@@ -60,6 +62,9 @@ module RaaP
|
|
60
62
|
o.on('--size-by int', Integer, "default: #{CLI.option.size_by}") do |arg|
|
61
63
|
CLI.option.size_by = arg
|
62
64
|
end
|
65
|
+
o.on('--allow-private', "default: #{CLI.option.allow_private}") do
|
66
|
+
CLI.option.allow_private = true
|
67
|
+
end
|
63
68
|
end.parse!(@argv)
|
64
69
|
|
65
70
|
CLI.option.dirs.each do |dir|
|
@@ -217,6 +222,7 @@ module RaaP
|
|
217
222
|
),
|
218
223
|
size_step: CLI.option.size_from.step(to: CLI.option.size_to, by: CLI.option.size_by),
|
219
224
|
timeout: CLI.option.timeout,
|
225
|
+
allow_private: true,
|
220
226
|
).run do |called|
|
221
227
|
case called
|
222
228
|
in Result::Success => s
|
@@ -225,6 +231,9 @@ module RaaP
|
|
225
231
|
in Result::Failure => f
|
226
232
|
puts 'F'
|
227
233
|
puts "Failed in case of `#{f.called_str}`"
|
234
|
+
if e = f.exception
|
235
|
+
RaaP.logger.debug { "Failure: [#{e.class}] #{e.message}" }
|
236
|
+
end
|
228
237
|
puts
|
229
238
|
RaaP.logger.debug { PP.pp(f.symbolic_call, ''.dup) }
|
230
239
|
puts "### call stack:"
|
@@ -236,10 +245,13 @@ module RaaP
|
|
236
245
|
throw :break
|
237
246
|
in Result::Skip => s
|
238
247
|
print 'S'
|
239
|
-
RaaP
|
248
|
+
RaaP.logger.debug { PP.pp(s.symbolic_call, ''.dup) }
|
249
|
+
RaaP.logger.debug("Skip: [#{s.exception.class}] #{s.exception.message}")
|
250
|
+
RaaP.logger.debug(s.exception.backtrace.join("\n"))
|
240
251
|
in Result::Exception => e
|
241
252
|
print 'E'
|
242
|
-
RaaP.logger.
|
253
|
+
RaaP.logger.debug { PP.pp(e.symbolic_call, ''.dup) }
|
254
|
+
RaaP.logger.debug("Exception: [#{e.exception.class}] #{e.exception.message}")
|
243
255
|
RaaP.logger.debug(e.exception.backtrace.join("\n"))
|
244
256
|
end
|
245
257
|
end
|
data/lib/raap/method_property.rb
CHANGED
@@ -8,18 +8,13 @@ module RaaP
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
attr_reader :method_name
|
13
|
-
attr_reader :method_type
|
14
|
-
attr_reader :size_step
|
15
|
-
attr_reader :timeout
|
16
|
-
|
17
|
-
def initialize(receiver_type:, method_name:, method_type:, size_step:, timeout:)
|
11
|
+
def initialize(receiver_type:, method_name:, method_type:, size_step:, timeout:, allow_private: false)
|
18
12
|
@receiver_type = receiver_type
|
19
13
|
@method_name = method_name
|
20
14
|
@method_type = method_type
|
21
15
|
@size_step = size_step
|
22
16
|
@timeout = timeout
|
17
|
+
@allow_private = allow_private
|
23
18
|
end
|
24
19
|
|
25
20
|
def run
|
@@ -41,52 +36,53 @@ module RaaP
|
|
41
36
|
private
|
42
37
|
|
43
38
|
def call(size:, stats:)
|
44
|
-
receiver_value = receiver_type.pick(size: size, eval: false)
|
45
|
-
|
46
|
-
|
47
|
-
symbolic_call =
|
39
|
+
receiver_value = @receiver_type.pick(size: size, eval: false)
|
40
|
+
args, kwargs, block = @method_type.pick_arguments(size: size, eval: false)
|
41
|
+
# @type var symbolic_call: symbolic_call
|
42
|
+
symbolic_call = [:call, receiver_value, @method_name, args, kwargs, block]
|
43
|
+
symbolic_caller = SymbolicCaller.new(symbolic_call, allow_private: @allow_private)
|
48
44
|
begin
|
49
|
-
# ensure
|
45
|
+
# ensure symbolic_call
|
50
46
|
check = false
|
51
47
|
if return_type.instance_of?(::RBS::Types::Bases::Bottom)
|
52
48
|
begin
|
53
|
-
return_value =
|
54
|
-
rescue
|
49
|
+
return_value = symbolic_caller.eval
|
50
|
+
rescue StandardError, NotImplementedError
|
55
51
|
check = true
|
56
52
|
return_value = Value::Bottom.new
|
57
53
|
end
|
58
54
|
else
|
59
|
-
return_value =
|
60
|
-
check = check_return(receiver_value:, return_value:, method_type:)
|
55
|
+
return_value = symbolic_caller.eval
|
56
|
+
check = check_return(receiver_value:, return_value:, method_type: @method_type)
|
61
57
|
end
|
62
58
|
if check
|
63
59
|
stats.success += 1
|
64
|
-
Result::Success.new(
|
60
|
+
Result::Success.new(symbolic_call:, return_value:)
|
65
61
|
else
|
66
|
-
Result::Failure.new(
|
62
|
+
Result::Failure.new(symbolic_call:, return_value:)
|
67
63
|
end
|
68
64
|
rescue TypeError => exception
|
69
|
-
Result::Failure.new(
|
65
|
+
Result::Failure.new(symbolic_call:, return_value:, exception:)
|
70
66
|
end
|
71
67
|
|
72
|
-
# not ensure
|
68
|
+
# not ensure symbolic_call
|
73
69
|
rescue NoMethodError => exception
|
74
70
|
stats.skip += 1
|
75
|
-
Result::Skip.new(
|
71
|
+
Result::Skip.new(symbolic_call:, exception:)
|
76
72
|
rescue NameError => e
|
77
73
|
msg = e.name.nil? ? '' : "for `#{BindCall.to_s(e.receiver)}::#{e.name}`"
|
78
74
|
RaaP.logger.error("Implementation is not found #{msg} maybe.")
|
79
75
|
throw :break
|
80
76
|
rescue NotImplementedError => exception
|
81
77
|
stats.skip += 1
|
82
|
-
Result::Skip.new(
|
78
|
+
Result::Skip.new(symbolic_call:, exception:)
|
83
79
|
rescue SystemStackError => exception
|
84
80
|
stats.skip += 1
|
85
81
|
RaaP.logger.warn "Found recursive type definition."
|
86
|
-
Result::Skip.new(
|
82
|
+
Result::Skip.new(symbolic_call:, exception:)
|
87
83
|
rescue => exception
|
88
84
|
stats.exception += 1
|
89
|
-
Result::Exception.new(
|
85
|
+
Result::Exception.new(symbolic_call:, exception:)
|
90
86
|
end
|
91
87
|
|
92
88
|
def check_return(receiver_value:, return_value:, method_type:)
|
@@ -118,7 +114,7 @@ module RaaP
|
|
118
114
|
end
|
119
115
|
|
120
116
|
def return_type
|
121
|
-
method_type.rbs.type.return_type
|
117
|
+
@method_type.rbs.type.return_type
|
122
118
|
end
|
123
119
|
end
|
124
120
|
end
|
data/lib/raap/result.rb
CHANGED
@@ -4,15 +4,20 @@ module RaaP
|
|
4
4
|
module Result
|
5
5
|
module CalledStr
|
6
6
|
def called_str
|
7
|
-
|
7
|
+
scr = SymbolicCaller.new(symbolic_call)
|
8
|
+
"#{scr.call_str} -> #{return_value.inspect}[#{return_value.class}]"
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
11
|
-
Success = Data.define(:
|
12
|
+
Success = Data.define(:symbolic_call, :return_value)
|
12
13
|
Success.include CalledStr
|
13
|
-
Failure = Data.define(:
|
14
|
+
Failure = Data.define(:symbolic_call, :return_value, :exception) do
|
15
|
+
def initialize(exception: nil, **)
|
16
|
+
super
|
17
|
+
end
|
18
|
+
end
|
14
19
|
Failure.include CalledStr
|
15
|
-
Skip = Data.define(:
|
16
|
-
Exception = Data.define(:
|
20
|
+
Skip = Data.define(:symbolic_call, :exception)
|
21
|
+
Exception = Data.define(:symbolic_call, :exception)
|
17
22
|
end
|
18
23
|
end
|
data/lib/raap/symbolic_caller.rb
CHANGED
@@ -32,9 +32,11 @@ module RaaP
|
|
32
32
|
end
|
33
33
|
|
34
34
|
attr_reader :symbolic_call
|
35
|
+
attr_reader :allow_private
|
35
36
|
|
36
|
-
def initialize(symbolic_call)
|
37
|
+
def initialize(symbolic_call, allow_private: false)
|
37
38
|
@symbolic_call = symbolic_call
|
39
|
+
@allow_private = allow_private
|
38
40
|
end
|
39
41
|
|
40
42
|
def eval
|
@@ -43,8 +45,18 @@ module RaaP
|
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
46
|
-
def
|
47
|
-
|
48
|
+
def call_str
|
49
|
+
symbolic_call => [:call, receiver, Symbol => method_name, Array => args, Hash => kwargs, b]
|
50
|
+
receiver = try_eval(receiver)
|
51
|
+
args, kwargs, block = try_eval([args, kwargs, block])
|
52
|
+
|
53
|
+
a = []
|
54
|
+
a << args.map(&:inspect).join(', ') if !args.empty?
|
55
|
+
a << kwargs.map { |k ,v| "#{k}: #{BindCall.inspect(v)}" }.join(', ') if !kwargs.empty?
|
56
|
+
argument_str = a.join(', ')
|
57
|
+
block_str = block ? "{ }" : nil
|
58
|
+
|
59
|
+
"#{BindCall.inspect(receiver)}.#{method_name}(#{argument_str})#{block_str}"
|
48
60
|
end
|
49
61
|
|
50
62
|
def to_lines
|
@@ -69,13 +81,7 @@ module RaaP
|
|
69
81
|
receiver = receiver_value.name + '.'
|
70
82
|
else
|
71
83
|
var_eq = ""
|
72
|
-
receiver =
|
73
|
-
var = Var.new(printable(receiver_value))
|
74
|
-
var + '.'
|
75
|
-
else
|
76
|
-
var = Var.new(var_name(receiver_value.class))
|
77
|
-
var + '.'
|
78
|
-
end
|
84
|
+
receiver = Var.new(printable(receiver_value)) + '.'
|
79
85
|
end
|
80
86
|
|
81
87
|
arguments = []
|
@@ -92,6 +98,16 @@ module RaaP
|
|
92
98
|
|
93
99
|
private
|
94
100
|
|
101
|
+
def try_eval(symbolic_call)
|
102
|
+
SymbolicCaller.new(symbolic_call).eval
|
103
|
+
rescue RuntimeError, NotImplementedError
|
104
|
+
symbolic_call
|
105
|
+
end
|
106
|
+
|
107
|
+
def walk(&)
|
108
|
+
_walk(@symbolic_call, &)
|
109
|
+
end
|
110
|
+
|
95
111
|
def _walk(symbolic_call, &block)
|
96
112
|
return symbolic_call if BindCall::instance_of?(symbolic_call, BasicObject)
|
97
113
|
return symbolic_call if !BindCall.respond_to?(symbolic_call, :deconstruct) && !BindCall.respond_to?(symbolic_call, :deconstruct_keys)
|
@@ -115,23 +131,22 @@ module RaaP
|
|
115
131
|
|
116
132
|
def eval_one(symbolic_call)
|
117
133
|
symbolic_call => [:call, receiver_value, method_name, args, kwargs, block]
|
118
|
-
|
134
|
+
if @allow_private
|
135
|
+
receiver_value.__send__(method_name, *args, **kwargs, &block)
|
136
|
+
else
|
137
|
+
BindCall.public_send(receiver_value, method_name, *args, **kwargs, &block)
|
138
|
+
end
|
119
139
|
end
|
120
140
|
|
121
141
|
def var_name(mod)
|
122
142
|
printable(mod).gsub('::', '_').downcase
|
123
143
|
end
|
124
144
|
|
125
|
-
def printable
|
126
|
-
|
127
|
-
|
128
|
-
true
|
129
|
-
else
|
130
|
-
false
|
145
|
+
def printable(obj)
|
146
|
+
if obj in [:call, _, Symbol, Array, Hash, _]
|
147
|
+
return _walk(obj)
|
131
148
|
end
|
132
|
-
end
|
133
149
|
|
134
|
-
def printable(obj)
|
135
150
|
case obj
|
136
151
|
when Var
|
137
152
|
obj.name
|
@@ -140,6 +155,15 @@ module RaaP
|
|
140
155
|
obj.inspect
|
141
156
|
when String
|
142
157
|
obj.inspect.gsub('"', "'") or raise
|
158
|
+
when Hash
|
159
|
+
hash_body = obj.map do |k, v|
|
160
|
+
ks = printable(k)
|
161
|
+
vs = printable(v)
|
162
|
+
ks.start_with?(':') ? "#{ks[1..-1]}: #{vs}" : "#{ks} => #{vs}"
|
163
|
+
end
|
164
|
+
"{#{hash_body.join(', ')}}"
|
165
|
+
when Array
|
166
|
+
"[#{obj.map { |o| printable(o) }.join(', ')}]"
|
143
167
|
when Module
|
144
168
|
BindCall.name(obj) or raise
|
145
169
|
else
|
data/lib/raap/type.rb
CHANGED
@@ -100,7 +100,17 @@ module RaaP
|
|
100
100
|
when ::RBS::Types::Union
|
101
101
|
type.types.sample&.then { |t| Type.new(t).pick(size:) }
|
102
102
|
when ::RBS::Types::Intersection
|
103
|
-
Value::Intersection
|
103
|
+
[:call, Value::Intersection, :new, [type], {size:}, nil]
|
104
|
+
when ::RBS::Types::Interface
|
105
|
+
[:call, Value::Interface, :new, [type], {size:}, nil]
|
106
|
+
when ::RBS::Types::Variable
|
107
|
+
[:call, Value::Variable, :new, [type], {}, nil]
|
108
|
+
when ::RBS::Types::Bases::Void
|
109
|
+
[:call, Value::Void, :new, [], {}, nil]
|
110
|
+
when ::RBS::Types::Bases::Top
|
111
|
+
[:call, Value::Top, :new, [], {}, nil]
|
112
|
+
when ::RBS::Types::Bases::Bottom
|
113
|
+
[:call, Value::Bottom, :new, [], {}, nil]
|
104
114
|
when ::RBS::Types::Optional
|
105
115
|
case Random.rand(2)
|
106
116
|
in 0 then Type.new(type.type).pick(size:)
|
@@ -117,10 +127,6 @@ module RaaP
|
|
117
127
|
raise "cannot resolve `instance` type"
|
118
128
|
when ::RBS::Types::Bases::Self
|
119
129
|
raise "cannot resolve `self` type"
|
120
|
-
when ::RBS::Types::Interface
|
121
|
-
Value::Interface.new(type, size: size)
|
122
|
-
when ::RBS::Types::Variable
|
123
|
-
Value::Variable.new(type)
|
124
130
|
when ::RBS::Types::ClassSingleton
|
125
131
|
Object.const_get(type.name.to_s)
|
126
132
|
when ::RBS::Types::ClassInstance
|
@@ -136,16 +142,10 @@ module RaaP
|
|
136
142
|
type.literal
|
137
143
|
when ::RBS::Types::Bases::Bool
|
138
144
|
bool.pick(size: size)
|
139
|
-
when ::RBS::Types::Bases::Void
|
140
|
-
Value::Void.new
|
141
145
|
when ::RBS::Types::Bases::Any
|
142
146
|
untyped.pick(size: size)
|
143
147
|
when ::RBS::Types::Bases::Nil
|
144
148
|
nil
|
145
|
-
when ::RBS::Types::Bases::Top
|
146
|
-
Value::Top.new
|
147
|
-
when ::RBS::Types::Bases::Bottom
|
148
|
-
Value::Bottom.new
|
149
149
|
else
|
150
150
|
raise "not implemented #{type.to_s}"
|
151
151
|
end
|
@@ -177,7 +177,7 @@ module RaaP
|
|
177
177
|
raise
|
178
178
|
end
|
179
179
|
else
|
180
|
-
Value::Module
|
180
|
+
[:call, Value::Module, :new, [type], {}, nil]
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
@@ -313,7 +313,7 @@ module RaaP
|
|
313
313
|
in 5 then symbol
|
314
314
|
in 6 then bool
|
315
315
|
in 7 then encoding
|
316
|
-
in 8 then sized { BasicObject
|
316
|
+
in 8 then sized { [:call, BasicObject, :new, [], {}, nil] }
|
317
317
|
end
|
318
318
|
end
|
319
319
|
|
data/lib/raap/value/module.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
module RaaP
|
2
2
|
module Value
|
3
3
|
# FIXME: consider self_types
|
4
|
-
|
4
|
+
# HINT: intersection?
|
5
|
+
class Module
|
5
6
|
attr_reader :type
|
6
7
|
|
7
8
|
def initialize(type)
|
8
9
|
@type = type
|
9
10
|
const = ::Object.const_get(type.name.absolute!.to_s)
|
10
|
-
|
11
|
+
extend(const)
|
11
12
|
end
|
12
13
|
|
13
14
|
def inspect = "#<module #{@type}>"
|
data/lib/raap/version.rb
CHANGED
data/lib/raap.rb
CHANGED
@@ -23,7 +23,6 @@ module RaaP
|
|
23
23
|
autoload :FunctionType, "raap/function_type"
|
24
24
|
autoload :MethodProperty, "raap/method_property"
|
25
25
|
autoload :MethodType, "raap/method_type"
|
26
|
-
autoload :MethodValue, "raap/method_value"
|
27
26
|
autoload :Minitest, "raap/minitest"
|
28
27
|
autoload :RBS, "raap/rbs"
|
29
28
|
autoload :Result, "raap/result"
|
data/sig/raap.rbs
CHANGED
@@ -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) -> 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) -> 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]
|
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]
|
31
31
|
|
32
32
|
attr_accessor dirs: ::Array[String]
|
33
33
|
|
@@ -42,6 +42,8 @@ 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
|
45
47
|
end
|
46
48
|
|
47
49
|
@argv: Array[String]
|
@@ -81,12 +83,15 @@ module RaaP
|
|
81
83
|
attr_accessor skip: Integer
|
82
84
|
attr_accessor exception: Integer
|
83
85
|
end
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
86
|
+
|
87
|
+
@receiver_type: Type
|
88
|
+
@method_name: Symbol
|
89
|
+
@method_type: MethodType
|
90
|
+
@size_step: _Each[Integer]
|
91
|
+
@timeout: (Integer | Float | nil)
|
92
|
+
@allow_private: bool
|
93
|
+
|
94
|
+
def initialize: (receiver_type: Type, method_name: Symbol, method_type: MethodType, size_step: _Each[Integer], timeout: (Integer | Float | nil), ?allow_private: bool) -> void
|
90
95
|
def run: () { (Result::Success | Result::Failure | Result::Skip | Result::Exception) -> void } -> Stats
|
91
96
|
|
92
97
|
private
|
@@ -106,30 +111,6 @@ module RaaP
|
|
106
111
|
def check_return: (untyped) -> bool
|
107
112
|
end
|
108
113
|
|
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
114
|
module Minitest
|
134
115
|
end
|
135
116
|
|
@@ -146,33 +127,33 @@ module RaaP
|
|
146
127
|
|
147
128
|
module Result
|
148
129
|
interface _MethodValueReturnValue
|
149
|
-
def
|
130
|
+
def symbolic_call: () -> symbolic_call
|
150
131
|
def return_value: () -> untyped
|
151
132
|
end
|
152
133
|
module CalledStr : _MethodValueReturnValue
|
153
134
|
def called_str: () -> String
|
154
135
|
end
|
155
136
|
class Success < Data
|
156
|
-
def self.new: (
|
157
|
-
attr_reader
|
137
|
+
def self.new: (symbolic_call: symbolic_call, return_value: untyped) -> instance
|
138
|
+
attr_reader symbolic_call: symbolic_call
|
158
139
|
attr_reader return_value: untyped
|
159
140
|
include CalledStr
|
160
141
|
end
|
161
142
|
class Failure < Data
|
162
|
-
def self.new: (
|
163
|
-
attr_reader method_value: MethodValue
|
164
|
-
attr_reader return_value: untyped
|
143
|
+
def self.new: (symbolic_call: symbolic_call, return_value: untyped, ?exception: ::Exception?) -> instance
|
165
144
|
attr_reader symbolic_call: symbolic_call
|
145
|
+
attr_reader return_value: untyped
|
146
|
+
attr_reader exception: ::Exception?
|
166
147
|
include CalledStr
|
167
148
|
end
|
168
149
|
class Skip < Data
|
169
|
-
def self.new: (
|
170
|
-
attr_reader
|
150
|
+
def self.new: (symbolic_call: symbolic_call?, exception: ::Exception) -> instance
|
151
|
+
attr_reader symbolic_call: symbolic_call?
|
171
152
|
attr_reader exception: ::Exception
|
172
153
|
end
|
173
154
|
class Exception < Data
|
174
|
-
def self.new: (
|
175
|
-
attr_reader
|
155
|
+
def self.new: (symbolic_call: symbolic_call?, exception: ::Exception) -> instance
|
156
|
+
attr_reader symbolic_call: symbolic_call?
|
176
157
|
attr_reader exception: ::Exception
|
177
158
|
end
|
178
159
|
end
|
@@ -196,13 +177,17 @@ module RaaP
|
|
196
177
|
end
|
197
178
|
|
198
179
|
attr_reader symbolic_call: untyped
|
199
|
-
|
180
|
+
attr_reader allow_private: bool
|
181
|
+
|
182
|
+
def initialize: (untyped, ?allow_private: bool) -> void
|
200
183
|
def eval: () -> untyped
|
201
|
-
def
|
184
|
+
def call_str: () -> String
|
202
185
|
def to_lines: () -> Array[String]
|
203
186
|
|
204
187
|
private
|
205
188
|
|
189
|
+
def try_eval: (untyped) -> untyped
|
190
|
+
def walk: () ?{ (symbolic_call) -> untyped} -> untyped
|
206
191
|
def _walk: (untyped) ?{ (symbolic_call) -> untyped} -> untyped
|
207
192
|
def eval_one: (symbolic_call) -> untyped
|
208
193
|
def var_name: (Module) -> String
|
@@ -301,7 +286,7 @@ module RaaP
|
|
301
286
|
def class: () -> class
|
302
287
|
end
|
303
288
|
|
304
|
-
class Module
|
289
|
+
class Module
|
305
290
|
attr_reader type: ::RBS::Types::ClassInstance
|
306
291
|
|
307
292
|
def initialize: (::RBS::Types::ClassInstance) -> void
|
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.
|
4
|
+
version: 0.3.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-
|
11
|
+
date: 2024-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbs
|
@@ -59,7 +59,6 @@ files:
|
|
59
59
|
- lib/raap/function_type.rb
|
60
60
|
- lib/raap/method_property.rb
|
61
61
|
- lib/raap/method_type.rb
|
62
|
-
- lib/raap/method_value.rb
|
63
62
|
- lib/raap/minitest.rb
|
64
63
|
- lib/raap/rbs.rb
|
65
64
|
- lib/raap/result.rb
|
data/lib/raap/method_value.rb
DELETED
@@ -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
|