direct index access helper for type
This commit is contained in:
parent
ab8b574e9c
commit
648ec772ec
@ -205,6 +205,12 @@ module Parfait
|
||||
@types.get(index)
|
||||
end
|
||||
|
||||
def type_for( name )
|
||||
index = variable_index(name)
|
||||
return nil unless index
|
||||
type_at(index)
|
||||
end
|
||||
|
||||
def inspect
|
||||
"Type[#{names.inspect}]"
|
||||
end
|
||||
|
@ -64,8 +64,17 @@ module Parfait
|
||||
assert_equal 55 , @mess.get_internal_word(message_ind)
|
||||
end
|
||||
|
||||
def test_instance_type
|
||||
assert_equal 1 , @mess.get_type.variable_index(:next_message)
|
||||
def test_variable_index
|
||||
assert_equal 1 , @type.variable_index(:next_message)
|
||||
end
|
||||
def test_name_at
|
||||
assert_equal :next_message , @type.name_at(1)
|
||||
end
|
||||
def test_type_at
|
||||
assert_equal :Message , @type.type_at(1)
|
||||
end
|
||||
def test_type_for
|
||||
assert_equal :Message , @type.type_for(:next_message)
|
||||
end
|
||||
|
||||
def test_remove_me
|
||||
|
Loading…
Reference in New Issue
Block a user