fix ivar test by actually creating ivar first
nice to know one gets errors for using an ivar that was not assigned to
This commit is contained in:
parent
e2729513ed
commit
ed902c343c
@ -6,29 +6,29 @@ module Vool
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@stats = compile_first_method( "local = 5")
|
||||
@ins = compile_first_method( "local = 5")
|
||||
end
|
||||
|
||||
def test_class_compiles
|
||||
assert_equal Mom::SlotLoad , @stats.class , @stats
|
||||
assert_equal Mom::SlotLoad , @ins.class , @ins
|
||||
end
|
||||
def test_slot_is_set
|
||||
assert @stats.left
|
||||
assert @ins.left
|
||||
end
|
||||
def test_slot_starts_at_message
|
||||
assert_equal :message , @stats.left.known_object
|
||||
assert_equal :message , @ins.left.known_object
|
||||
end
|
||||
def test_slot_gets_self
|
||||
assert_equal :frame , @stats.left.slots[0]
|
||||
assert_equal :frame , @ins.left.slots[0]
|
||||
end
|
||||
def test_slot_assigns_to_local
|
||||
assert_equal :local , @stats.left.slots[-1]
|
||||
assert_equal :local , @ins.left.slots[-1]
|
||||
end
|
||||
def test_slot_assigns_something
|
||||
assert @stats.right
|
||||
assert @ins.right
|
||||
end
|
||||
def test_slot_assigns_int
|
||||
assert_equal Mom::IntegerConstant , @stats.right.known_object.class
|
||||
assert_equal Mom::IntegerConstant , @ins.right.known_object.class
|
||||
end
|
||||
end
|
||||
|
||||
@ -37,10 +37,10 @@ module Vool
|
||||
include MomCompile
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@stats = compile_first_method( "local = @a")
|
||||
@ins = compile_first_method( "@a = 5 ; local = @a")
|
||||
end
|
||||
def test_class_compiles
|
||||
assert_equal Mom::SlotLoad , @stats.class , @stats
|
||||
assert_equal Mom::SlotLoad , @ins.next.class , @ins
|
||||
end
|
||||
end
|
||||
|
||||
@ -50,23 +50,23 @@ module Vool
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@stats = compile_first_method( "arg = 5")
|
||||
@ins = compile_first_method( "arg = 5")
|
||||
end
|
||||
|
||||
def test_class_compiles
|
||||
assert_equal Mom::SlotLoad , @stats.class , @stats
|
||||
assert_equal Mom::SlotLoad , @ins.class , @ins
|
||||
end
|
||||
def test_slot_is_set
|
||||
assert @stats.left
|
||||
assert @ins.left
|
||||
end
|
||||
def test_slot_starts_at_message
|
||||
assert_equal :message , @stats.left.known_object
|
||||
assert_equal :message , @ins.left.known_object
|
||||
end
|
||||
def test_slot_gets_self
|
||||
assert_equal :arguments , @stats.left.slots[0]
|
||||
assert_equal :arguments , @ins.left.slots[0]
|
||||
end
|
||||
def test_slot_assigns_to_local
|
||||
assert_equal :arg , @stats.left.slots[-1]
|
||||
assert_equal :arg , @ins.left.slots[-1]
|
||||
end
|
||||
end
|
||||
|
||||
@ -76,14 +76,14 @@ module Vool
|
||||
Risc.machine.boot
|
||||
end
|
||||
def test_assigns_const
|
||||
@stats = compile_first_method( "@a = 5")
|
||||
assert_equal Mom::SlotLoad , @stats.class , @stats
|
||||
assert_equal Mom::IntegerConstant , @stats.right.known_object.class , @stats
|
||||
@ins = compile_first_method( "@a = 5")
|
||||
assert_equal Mom::SlotLoad , @ins.class , @ins
|
||||
assert_equal Mom::IntegerConstant , @ins.right.known_object.class , @ins
|
||||
end
|
||||
def test_assigns_move
|
||||
@stats = compile_first_method( "@a = arg")
|
||||
assert_equal Mom::SlotLoad , @stats.class , @stats
|
||||
assert_equal Mom::SlotDefinition , @stats.right.class , @stats
|
||||
@ins = compile_first_method( "@a = arg")
|
||||
assert_equal Mom::SlotLoad , @ins.class , @ins
|
||||
assert_equal Mom::SlotDefinition , @ins.right.class , @ins
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user