linked list of methods instead of list of methods
api changes slightly, especially for each, but mostly sama sama
This commit is contained in:
@ -149,13 +149,13 @@ class TestSpace < MiniTest::Test
|
||||
def test_no_methods_in_types
|
||||
test_remove_methods
|
||||
@space.each_type do |type|
|
||||
assert_equal 0 , type.methods.get_length , "name #{type.name}"
|
||||
assert_equal 0 , type.methods_length , "name #{type.name}"
|
||||
end
|
||||
end
|
||||
def test_no_methods_in_classes
|
||||
test_remove_methods
|
||||
@space.classes.each do |name , cl|
|
||||
assert_equal 0 , cl.instance_type.methods.get_length , "name #{cl.name}"
|
||||
assert_equal 0 , cl.instance_type.methods_length , "name #{cl.name}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -25,24 +25,30 @@ class TestMethodApi < MiniTest::Test
|
||||
@space.get_class_by_name(:Object).instance_type
|
||||
end
|
||||
def test_new_methods
|
||||
assert_equal @try_type.method_names.class, @try_type.methods.class
|
||||
assert_equal @try_type.method_names.get_length , @try_type.methods.get_length
|
||||
assert_equal Parfait::List , @try_type.method_names.class
|
||||
assert_equal @try_type.method_names.get_length , @try_type.methods_length
|
||||
end
|
||||
def test_add_method
|
||||
before = @try_type.methods.get_length
|
||||
before = @try_type.methods_length
|
||||
add_foo_to
|
||||
assert_equal 1 , @try_type.methods.get_length - before
|
||||
assert_equal 1 , @try_type.methods_length - before
|
||||
assert @try_type.method_names.inspect.include?(":foo")
|
||||
end
|
||||
def test_remove_method
|
||||
add_foo_to
|
||||
assert_equal true , @try_type.remove_method(:foo)
|
||||
assert @try_type.remove_method(:foo)
|
||||
end
|
||||
def test_remove_not_there
|
||||
assert_raises RuntimeError do
|
||||
@try_type.remove_method(:foo)
|
||||
end
|
||||
end
|
||||
def test_remove_method_missing
|
||||
# assert @try_type.get_method( :method_missing)
|
||||
assert_raises RuntimeError do
|
||||
@try_type.remove_method(:method_missing)
|
||||
end
|
||||
end
|
||||
def test_create_method
|
||||
args = Parfait::Type.for_hash( @try_class , { bar: :Integer})
|
||||
@try_type.create_method :bar, args , empty_frame
|
||||
|
@ -50,6 +50,10 @@ module Risc
|
||||
assert_equal Label , call_ins.class
|
||||
assert_equal "Word_Type.resolve_method" , call_ins.name
|
||||
end
|
||||
def est_dyn
|
||||
cal = ticks(102)
|
||||
assert_equal DynamicJump , cal.class
|
||||
end
|
||||
#should end in exit, but doesn't, becasue resolve never returns
|
||||
def ttest_sys
|
||||
sys = ticks(20)
|
||||
|
Reference in New Issue
Block a user