bring class methods down to mom
not functionally correct, still compiling into class, not metaclass part of #24
This commit is contained in:
23
test/vool/blocks/test_class_blocks.rb
Normal file
23
test/vool/blocks/test_class_blocks.rb
Normal file
@ -0,0 +1,23 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module VoolBlocks
|
||||
class TestClassAssignMom < MiniTest::Test
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
def as_class_method(source)
|
||||
"class Space;def self.main();#{source};end;end"
|
||||
end
|
||||
def test_block_not_compiles
|
||||
source = "main{|val| val = 0}"
|
||||
vool = Ruby::RubyCompiler.compile( as_class_method(source) ).to_vool
|
||||
begin
|
||||
vool.to_mom(nil)
|
||||
rescue => err
|
||||
assert err.message.include?("Blocks")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
30
test/vool/send/test_send_class.rb
Normal file
30
test/vool/send/test_send_class.rb
Normal file
@ -0,0 +1,30 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Vool
|
||||
class TestSendClassMom < MiniTest::Test
|
||||
include SimpleSendHarness
|
||||
include Mom
|
||||
|
||||
def send_method
|
||||
"Object.get_internal_word(0)"
|
||||
end
|
||||
def test_receiver
|
||||
assert_equal SlotDefinition, @ins.next.receiver.class
|
||||
end
|
||||
def test_arg_one
|
||||
assert_equal SlotLoad, @ins.next(1).arguments[0].class
|
||||
end
|
||||
def test_call_two
|
||||
assert_equal SimpleCall, @ins.next(2).class
|
||||
end
|
||||
def test_call_has_method
|
||||
assert_equal Parfait::CallableMethod, @ins.next(2).method.class
|
||||
end
|
||||
def test_call_has_right_method
|
||||
assert_equal :get_internal_word, @ins.next(2).method.name
|
||||
end
|
||||
def test_call_has_right_receiver
|
||||
assert_equal "Object_Type", @ins.next(2).method.self_type.name
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user