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