rubyx/test/compiler/test_hello.rb

42 lines
871 B
Ruby
Raw Normal View History

2015-07-19 10:54:36 +03:00
require_relative "compiler_helper"
class HelloTest < MiniTest::Test
def check
2015-07-19 11:52:43 +03:00
machine = Virtual.machine.boot
Parfait::Space.object_space.get_class_by_name(:Integer).remove_instance_method :plus
#TODO remove this hack: write proper aliases
expressions = machine.compile_main @string_input
2015-06-22 22:48:42 +03:00
output_at = "Register::CallImplementation"
2015-06-21 00:21:42 +03:00
#{}"Register::CallImplementation"
machine.run_before output_at
2015-06-30 10:22:54 +03:00
#puts Sof.write(machine.space)
2015-06-21 00:21:42 +03:00
machine.run_after output_at
writer = Elf::ObjectWriter.new(machine)
2014-08-30 14:17:00 +03:00
writer.save "hello.o"
end
2014-08-22 09:21:59 +03:00
def qtest_simplest_function
@string_input = <<HERE
def foo(x)
5
end
HERE
check
end
2015-07-02 09:49:52 +03:00
def ttest_puts_string
@string_input = <<HERE
2015-05-30 14:49:10 +03:00
putstring("Hello")
HERE
check
end
def test_string_put
@string_input = <<HERE
2015-07-02 13:49:33 +03:00
"Hello again\n".putstring()
HERE
check
end
end