add parfait block
This commit is contained in:
@ -7,5 +7,11 @@ module Parfait
|
||||
Parfait.boot!
|
||||
@space = Parfait.object_space
|
||||
end
|
||||
def make_method
|
||||
@obj = Parfait.object_space.get_class_by_name(:Object).instance_type
|
||||
@args = Parfait::Type.for_hash( @obj.object_class , { bar: :Integer , foo: :Type})
|
||||
@frame = Parfait::Type.for_hash( @obj.object_class , { local_bar: :Integer , local_foo: :Type})
|
||||
@method = Parfait::CallableMethod.new( @obj , :meth , @args , @frame)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
24
test/parfait/test_block.rb
Normal file
24
test/parfait/test_block.rb
Normal file
@ -0,0 +1,24 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Parfait
|
||||
class TestBlock < ParfaitTest
|
||||
|
||||
def setup
|
||||
super
|
||||
make_method
|
||||
end
|
||||
|
||||
def test_make_block
|
||||
assert_equal Block , @method.create_block(@args , @frame ).class
|
||||
end
|
||||
|
||||
def test_block_type
|
||||
assert_equal @method.self_type , @method.create_block(@args , @frame ).self_type
|
||||
end
|
||||
|
||||
def test_block_in_method
|
||||
assert @method.has_block( @method.create_block(@args , @frame ))
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -5,10 +5,7 @@ module Parfait
|
||||
|
||||
def setup
|
||||
super
|
||||
@obj = Parfait.object_space.get_class_by_name(:Object).instance_type
|
||||
@args = Parfait::Type.for_hash( @obj.object_class , { bar: :Integer , foo: :Type})
|
||||
@frame = Parfait::Type.for_hash( @obj.object_class , { local_bar: :Integer , local_foo: :Type})
|
||||
@method = Parfait::CallableMethod.new( @obj , :meth , @args , @frame)
|
||||
make_method
|
||||
end
|
||||
|
||||
def test_method_name
|
||||
|
@ -4,7 +4,7 @@ module Parfait
|
||||
class TestSpace < ParfaitTest
|
||||
|
||||
def classes
|
||||
[:BinaryCode,:CacheEntry,:Callable,:CallableMethod,:Class,
|
||||
[:BinaryCode,:Block,:CacheEntry,:Callable,:CallableMethod,:Class,
|
||||
:DataObject,:Data4,:Data8,:Data16,:Dictionary,:Integer,:FalseClass,
|
||||
:List,:Message,:NamedList,:NilClass,:Object,:ReturnAddress,
|
||||
:Space,:TrueClass,:Type,:VoolMethod,:Word]
|
||||
|
Reference in New Issue
Block a user