|
102 | 102 | end
|
103 | 103 |
|
104 | 104 | it "raises an argument error if an assignment method is called with more than 1 argument" do
|
105 |
| - pfo, pm, l = proxy[TruffleInteropSpecs::PolyglotMember.new] |
| 105 | + pfo, _, l = proxy[TruffleInteropSpecs::PolyglotMember.new] |
106 | 106 | l.log.should_not include(['writeMember', :bar, :baz])
|
107 | 107 | -> { pfo.__send__(:foo=, :bar, :baz) }.should raise_error(ArgumentError)
|
108 | 108 | end
|
|
122 | 122 | end
|
123 | 123 |
|
124 | 124 | it description['.call(*arguments)', :execute, ['*arguments']] do
|
125 |
| - pfo, logging_proc, l = proxy[-> *x {x}] |
126 |
| - x = pfo.call(1, 2, 3) |
| 125 | + pfo, _, l = proxy[-> *x { x }] |
| 126 | + pfo.call(1, 2, 3) |
127 | 127 | l.log.should include(['execute', 1, 2, 3])
|
128 | 128 | end
|
129 | 129 |
|
130 | 130 | it description['.nil?', :isNull] do
|
131 |
| - pfo, obj, l = proxy[Object.new] |
| 131 | + pfo, _, l = proxy[Object.new] |
132 | 132 | pfo.nil?
|
133 | 133 | l.log.should include(['isNull'])
|
134 | 134 | end
|
135 | 135 |
|
136 | 136 | it description['.size', :getArraySize] do
|
137 |
| - pfo, obj, l = proxy[Object.new] |
| 137 | + pfo, _, l = proxy[Object.new] |
138 | 138 | -> { pfo.size }.should raise_error(Polyglot::UnsupportedMessageError)
|
139 | 139 | l.log.should include(['getArraySize'])
|
140 | 140 | end
|
141 | 141 |
|
142 | 142 | it description['.keys', :getMembers] do
|
143 |
| - pfo, obj, l = proxy[Object.new] |
| 143 | + pfo, _, l = proxy[Object.new] |
144 | 144 | pfo.keys
|
145 | 145 | l.log.should include(['getMembers', false])
|
146 | 146 | end
|
147 | 147 |
|
148 | 148 | it description['.method_name', :invokeMember, ['method_name'], 'if member is invocable'] do
|
149 |
| - pfo, obj, l = proxy[Class.new { def foo; 3; end }.new] |
| 149 | + pfo, _, l = proxy[Class.new { def foo; 3; end }.new] |
150 | 150 | pfo.foo
|
151 | 151 | l.log.should include(["isMemberInvocable", "foo"])
|
152 | 152 | l.log.should include(["invokeMember", "foo"])
|
153 | 153 | end
|
154 | 154 |
|
155 | 155 | it description['.method_name', :readMember, ['method_name'], 'if member is readable'] do
|
156 |
| - pfo, obj, l = proxy[TruffleInteropSpecs::PolyglotMember.new] |
| 156 | + pfo, _, l = proxy[TruffleInteropSpecs::PolyglotMember.new] |
157 | 157 | pfo.foo = :bar
|
158 | 158 | pfo.foo
|
159 | 159 | l.log.should include(["isMemberInvocable", "foo"])
|
160 | 160 | l.log.should include(["readMember", "foo"])
|
161 | 161 | end
|
162 | 162 |
|
163 | 163 | it description['.method_name', :readMember, ['method_name'], 'and raises if member is not invocable or readable'] do
|
164 |
| - pfo, obj, l = proxy[Object.new] |
| 164 | + pfo, _, l = proxy[Object.new] |
165 | 165 | -> { pfo.foo }.should raise_error(NameError)
|
166 | 166 | l.log.should include(["isMemberInvocable", "foo"])
|
167 | 167 | l.log.should include(["readMember", "foo"])
|
168 | 168 | end
|
169 | 169 |
|
170 | 170 | it description['.method_name(*arguments)', :invokeMember, ['method_name', '*arguments'], 'if member is readable and invokable'] do
|
171 |
| - pfo, obj, l = proxy[Object.new] |
| 171 | + pfo, _, l = proxy[Object.new] |
172 | 172 | -> { pfo.bar(1, 2, 3) }.should raise_error(NoMethodError)
|
173 | 173 | l.log.should include(["invokeMember", "bar", 1, 2, 3])
|
174 | 174 | end
|
175 | 175 |
|
176 | 176 | it description['.method_name(*arguments, &block)', :invokeMember, ['method_name', '*arguments, block']] do
|
177 | 177 | pfo, pm, l = proxy[TruffleInteropSpecs::PolyglotMember.new]
|
178 |
| - block = Proc.new {} |
179 |
| - pfo.foo = -> *x { 1 } |
| 178 | + block = Proc.new { } |
| 179 | + pfo.foo = -> *_ { 1 } |
180 | 180 | pfo.foo(1, 2, 3, &block)
|
181 | 181 | l.log.should include(["invokeMember", "foo", 1, 2, 3, block])
|
182 | 182 | messages = pm.log
|
183 | 183 | messages.should include([:polyglot_invoke_member, "foo", 1, 2, 3, block])
|
184 | 184 | end
|
185 | 185 |
|
186 | 186 | it description['.new(*arguments)', :instantiate, ['*arguments']] do
|
187 |
| - pfo, obj, l = proxy[Object.new] |
| 187 | + pfo, _, l = proxy[Object.new] |
188 | 188 | -> { pfo.new }.should raise_error(Polyglot::UnsupportedMessageError)
|
189 | 189 | l.log.should include(["instantiate"])
|
190 | 190 | end
|
|
196 | 196 | end
|
197 | 197 |
|
198 | 198 | it description['.class', :getMetaObject] do
|
199 |
| - pfo, obj, l = proxy[Truffle::Debug.foreign_object] |
| 199 | + pfo, _, l = proxy[Truffle::Debug.foreign_object] |
200 | 200 | pfo.class.should == Truffle::Interop::Foreign
|
201 | 201 | Truffle::Interop.to_display_string(Truffle::Debug.foreign_object)
|
202 | 202 | l.log.should include(["hasMetaObject"])
|
|
208 | 208 | end
|
209 | 209 |
|
210 | 210 | it description['.to_s', :asString, [], 'when `isString(foreign_object)` is true'] do
|
211 |
| - pfo, str, l = proxy['asString contents'] |
| 211 | + pfo, _, l = proxy['asString contents'] |
212 | 212 | pfo.to_s.should == "asString contents"
|
213 | 213 | l.log.should include(["asString"])
|
214 | 214 | end
|
215 | 215 |
|
216 | 216 | it description['.to_s', :toDisplayString, [], 'otherwise'] do
|
217 |
| - pfo, str, l = proxy[Object.new] |
| 217 | + pfo, _, l = proxy[Object.new] |
218 | 218 | pfo.to_s
|
219 | 219 | l.log.should include(["toDisplayString", true])
|
220 | 220 | end
|
221 | 221 |
|
222 | 222 | it description['.to_str', :asString, [], 'when `isString(foreign_object)` is true'] do
|
223 |
| - pfo, str, l = proxy["asString contents"] |
| 223 | + pfo, _, l = proxy["asString contents"] |
224 | 224 | pfo.to_str.should == "asString contents"
|
225 | 225 | l.log.should include(["isString"])
|
226 | 226 | l.log.should include(["asString"])
|
227 | 227 | end
|
228 | 228 |
|
229 | 229 | it doc['.to_str', 'raises `NoMethodError` otherwise'] do
|
230 |
| - pfo, obj, l = proxy[Object.new] |
| 230 | + pfo, _, l = proxy[Object.new] |
231 | 231 | -> { pfo.to_str }.should raise_error(NoMethodError)
|
| 232 | + l.log.should include(["isString"]) |
232 | 233 | end
|
233 | 234 |
|
234 | 235 | it doc['.to_a', 'converts to a Ruby `Array` with `Truffle::Interop.to_array(foreign_object)`'] do
|
235 |
| - pfo, obj, l = proxy[Object.new] |
| 236 | + pfo, _, l = proxy[Object.new] |
236 | 237 | -> { pfo.to_a }.should raise_error(RuntimeError)
|
237 | 238 | l.log.should include(["hasArrayElements"])
|
238 | 239 | end
|
239 | 240 |
|
240 | 241 | it doc['.to_ary', 'converts to a Ruby `Array` with `Truffle::Interop.to_array(foreign_object)`'] do
|
241 |
| - pfo, obj, l = proxy[Object.new] |
| 242 | + pfo, _, l = proxy[Object.new] |
242 | 243 | -> { pfo.to_a }.should raise_error(RuntimeError)
|
243 | 244 | l.log.should include(["hasArrayElements"])
|
244 | 245 | end
|
|
254 | 255 | end
|
255 | 256 |
|
256 | 257 | it description['.respond_to?(:to_str)', :isString] do
|
257 |
| - pfo, obj, l = proxy[Object.new] |
| 258 | + pfo, _, l = proxy[Object.new] |
258 | 259 | pfo.respond_to?(:to_str)
|
259 | 260 | l.log.should include(["isString"])
|
260 | 261 | end
|
261 | 262 |
|
262 | 263 | it description['.respond_to?(:to_a)', :hasArrayElements] do
|
263 |
| - pfo, obj, l = proxy[Object.new] |
| 264 | + pfo, _, l = proxy[Object.new] |
264 | 265 | pfo.respond_to?(:to_a)
|
265 | 266 | l.log.should include(["hasArrayElements"])
|
266 | 267 | end
|
267 | 268 |
|
268 | 269 | it description['.respond_to?(:to_ary)', :hasArrayElements] do
|
269 |
| - pfo, obj, l = proxy[Object.new] |
| 270 | + pfo, _, l = proxy[Object.new] |
270 | 271 | pfo.respond_to?(:to_ary)
|
271 | 272 | l.log.should include(["hasArrayElements"])
|
272 | 273 | end
|
273 | 274 |
|
274 | 275 | it description['.respond_to?(:size)', :hasArrayElements] do
|
275 |
| - pfo, obj, l = proxy[Object.new] |
| 276 | + pfo, _, l = proxy[Object.new] |
276 | 277 | pfo.respond_to?(:size)
|
277 | 278 | l.log.should include(["hasArrayElements"])
|
278 | 279 | end
|
279 | 280 |
|
280 | 281 | it description['.respond_to?(:keys)', :hasMembers] do
|
281 |
| - pfo, obj, l = proxy[Object.new] |
| 282 | + pfo, _, l = proxy[Object.new] |
282 | 283 | pfo.respond_to?(:keys)
|
283 | 284 | l.log.should include(["hasMembers"])
|
284 | 285 | end
|
285 | 286 |
|
286 | 287 | it description['.respond_to?(:call)', :isExecutable] do
|
287 |
| - pfo, obj, l = proxy[Object.new] |
| 288 | + pfo, _, l = proxy[Object.new] |
288 | 289 | pfo.respond_to?(:call)
|
289 | 290 | l.log.should include(["isExecutable"])
|
290 | 291 | end
|
291 | 292 |
|
292 | 293 | it description['.respond_to?(:new)', :isInstantiable] do
|
293 |
| - pfo, obj, l = proxy[Object.new] |
| 294 | + pfo, _, l = proxy[Object.new] |
294 | 295 | pfo.respond_to?(:new)
|
295 | 296 | l.log.should include(["isInstantiable"])
|
296 | 297 | end
|
|
0 commit comments